summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-12-14 16:45:08 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-01-04 13:44:56 -0600
commit0a36af04bb81afb0e006582cc0751bd4854714b3 (patch)
treee53230dd823b8174170dd7c6c05542bbff025749
parentpc386: Add BSP_ENABLE_IDE BSP option (diff)
downloadrtems-0a36af04bb81afb0e006582cc0751bd4854714b3.tar.bz2
pc386: Add BSP_ENABLE_COM1_COM4 BSP option
This allows the support for the legacy COM1-COM4 serial ports to be completely disabled. It is needed to prevent hangs on some hardware. In particular, the Intel Edison where it is not present.
-rw-r--r--c/src/lib/libbsp/i386/pc386/configure.ac5
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/conscfg.c50
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/printk_support.c10
3 files changed, 38 insertions, 27 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/configure.ac b/c/src/lib/libbsp/i386/pc386/configure.ac
index 96812c8b70..9c039c927c 100644
--- a/c/src/lib/libbsp/i386/pc386/configure.ac
+++ b/c/src/lib/libbsp/i386/pc386/configure.ac
@@ -22,6 +22,11 @@ RTEMS_BSPOPTS_HELP([BSP_ENABLE_VGA],
[Set if the VGA and keyboard console support is enabled.])
AM_CONDITIONAL(RTEMS_VGA,[test "$BSP_ENABLE_VGA" = "1"])
+RTEMS_BSPOPTS_SET([BSP_ENABLE_COM1_COM4],[*],[1])
+RTEMS_BSPOPTS_HELP([BSP_ENABLE_COM1_COM4],
+[Set if COM1..COM4 support is enabled.])
+AM_CONDITIONAL(RTEMS_VGA,[test "$BSP_ENABLE_COM1_COM4" = "1"])
+
RTEMS_BSPOPTS_SET([BSP_ENABLE_IDE],[*],[1])
RTEMS_BSPOPTS_HELP([BSP_ENABLE_IDE],
[Set if IDE support is enabled.])
diff --git a/c/src/lib/libbsp/i386/pc386/console/conscfg.c b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
index 72ccfe3709..a34f0e5217 100644
--- a/c/src/lib/libbsp/i386/pc386/console/conscfg.c
+++ b/c/src/lib/libbsp/i386/pc386/console/conscfg.c
@@ -29,34 +29,36 @@
#define VGA_CONSOLE_FUNCTIONS &vgacons_fns
#endif
-#if 0
-#define COM_CONSOLE_FUNCTIONS &ns16550_fns_polled
-#else
-#define COM_CONSOLE_FUNCTIONS &ns16550_fns
-#endif
+#if BSP_ENABLE_COM1_COM4
+ #if 0
+ #define COM_CONSOLE_FUNCTIONS &ns16550_fns_polled
+ #else
+ #define COM_CONSOLE_FUNCTIONS &ns16550_fns
+ #endif
-/*
- * Base IO for UART
- */
-#define COM1_BASE_IO 0x3F8
-#define COM2_BASE_IO 0x3E8
-#define COM3_BASE_IO 0x2F8
-#define COM4_BASE_IO 0x2E8
+ /*
+ * Base IO for UART
+ */
+ #define COM1_BASE_IO 0x3F8
+ #define COM2_BASE_IO 0x3E8
+ #define COM3_BASE_IO 0x2F8
+ #define COM4_BASE_IO 0x2E8
-#define CLOCK_RATE (115200 * 16)
+ #define CLOCK_RATE (115200 * 16)
-static uint8_t com_get_register(uint32_t addr, uint8_t i)
-{
- register uint8_t val;
+ static uint8_t com_get_register(uint32_t addr, uint8_t i)
+ {
+ register uint8_t val;
- inport_byte( (addr + i),val );
- return val;
-}
+ inport_byte( (addr + i),val );
+ return val;
+ }
-static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
-{
- outport_byte( (addr + i),val );
-}
+ static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
+ {
+ outport_byte( (addr + i),val );
+ }
+#endif
console_tbl Console_Configuration_Ports[] = {
#if BSP_ENABLE_VGA
@@ -80,6 +82,7 @@ console_tbl Console_Configuration_Ports[] = {
0x0 /* ulIntVector -- base for port */
},
#endif
+#if BSP_ENABLE_COM1_COM4
{
"/dev/com1", /* sDeviceName */
SERIAL_NS16550, /* deviceType */
@@ -158,6 +161,7 @@ console_tbl Console_Configuration_Ports[] = {
CLOCK_RATE, /* ulClock */
BSP_UART_COM4_IRQ /* ulIntVector -- base for port */
},
+#endif
};
diff --git a/c/src/lib/libbsp/i386/pc386/console/printk_support.c b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
index b34e3e9f79..c6b0fe5c00 100644
--- a/c/src/lib/libbsp/i386/pc386/console/printk_support.c
+++ b/c/src/lib/libbsp/i386/pc386/console/printk_support.c
@@ -29,9 +29,9 @@
rtems_device_minor_number BSPPrintkPort = 0;
-int ns16550_inbyte_nonblocking_polled(
- int minor
-);
+#if BSP_ENABLE_COM1_COM4
+int ns16550_inbyte_nonblocking_polled( int minor );
+#endif
void BSP_outch(char ch);
int BSP_inch(void);
@@ -52,18 +52,20 @@ void BSP_outch(char ch)
int BSP_inch(void)
{
- int result;
+ int result = -1;
#if BSP_ENABLE_VGA
if ( BSPPrintkPort == BSP_CONSOLE_VGA ) {
result = BSP_wait_polled_input();
} else
#endif
+ #if BSP_ENABLE_COM1_COM4
{
do {
result = ns16550_inbyte_nonblocking_polled( BSPPrintkPort );
} while (result == -1);
}
+ #endif
return result;
}