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.
This commit is contained in:
Joel Sherrill
2014-12-14 16:45:08 -06:00
parent 93546b879f
commit 0a36af04bb
3 changed files with 38 additions and 27 deletions

View File

@@ -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.])

View File

@@ -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
};

View File

@@ -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;
}