From 664db30bd38371a14c82d61f78dde7db2cbed41d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 18 Oct 2000 15:51:41 +0000 Subject: 2000-10-18 Charles-Antoine Gauthier * console/console.c, console/serial_mouse.c, include/bsp.h: Add the ability to set parity, number of data bits and number of stop bits to the existing i386 serial drivers. --- c/src/lib/libbsp/i386/pc386/ChangeLog | 6 ++++ c/src/lib/libbsp/i386/pc386/console/console.c | 39 +++++++++++++++++++--- c/src/lib/libbsp/i386/pc386/console/serial_mouse.c | 35 ++++++++++++++++++- c/src/lib/libbsp/i386/pc386/include/bsp.h | 5 +++ 4 files changed, 80 insertions(+), 5 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/i386/pc386/ChangeLog b/c/src/lib/libbsp/i386/pc386/ChangeLog index b7cb391cd9..f6c2295cc4 100644 --- a/c/src/lib/libbsp/i386/pc386/ChangeLog +++ b/c/src/lib/libbsp/i386/pc386/ChangeLog @@ -1,3 +1,9 @@ +2000-10-18 Charles-Antoine Gauthier + + * console/console.c, console/serial_mouse.c, include/bsp.h: + Add the ability to set parity, number of data bits and + number of stop bits to the existing i386 serial drivers. + 2000-10-17 Joel Sherrill * startup/Makefile.am: Added idt.c since it has been moved libcpu/i386 diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c index 2293d81389..b93e0cc284 100644 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ b/c/src/lib/libbsp/i386/pc386/console/console.c @@ -226,7 +226,7 @@ console_initialize(rtems_device_major_number major, * Do device-specific initialization */ /* 9600-8-N-1 */ - BSP_uart_init(BSPConsolePort, 9600, 0); + BSP_uart_init(BSPConsolePort, 9600, CHR_8_BITS, 0, 0, 0); /* Set interrupt handler */ @@ -454,7 +454,7 @@ console_control(rtems_device_major_number major, static int conSetAttr(int minor, const struct termios *t) { - int baud; + unsigned long baud, databits, parity, stopbits; switch (t->c_cflag & CBAUD) { @@ -510,12 +510,43 @@ conSetAttr(int minor, const struct termios *t) baud = 115200; break; default: - baud = 0; rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR); return 0; } - BSP_uart_set_baud(BSPConsolePort, baud); + if (t->c_cflag & PARENB) { + /* Parity is enabled */ + if (t->c_cflag & PARODD) { + /* Parity is odd */ + parity = PEN; + } + else { + /* Parity is even */ + parity = PEN | EPS; + } + } + else { + /* No parity */ + parity = 0; + } + + switch (t->c_cflag & CSIZE) { + case CS5: databits = CHR_5_BITS; break; + case CS6: databits = CHR_6_BITS; break; + case CS7: databits = CHR_7_BITS; break; + case CS8: databits = CHR_8_BITS; break; + } + + if (t->c_cflag & CSTOPB) { + /* 2 stop bits */ + stopbits = STB; + } + else { + /* 1 stop bit */ + stopbits = 0; + } + + BSP_uart_set_attributes(BSPConsolePort, baud, databits, parity, stopbits); return 0; } diff --git a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c index dbdb7ea14c..2ec2730a17 100644 --- a/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c +++ b/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c @@ -18,6 +18,39 @@ * MODIFICATION/HISTORY: * * $Log$ + * Revision 1.1 2000/08/30 08:15:30 joel + * 2000-08-26 Rosimildo da Silva + * + * * Major rework of the "/dev/console" driver. + * * Added termios support for stdin ( keyboard ). + * * Added ioctls() to support modes similar to Linux( XLATE, + * RAW, MEDIUMRAW ). + * * Added Keyboard mapping and handling of the keyboard's leds. + * * Added Micro FrameBuffer driver ( "/dev/fb0" ) for bare VGA + * controller ( 16 colors ). + * * Added PS/2 and Serial mouse support for PC386 BSP. + * * console/defkeymap.c: New file. + * * console/fb_vga.c: New file. + * * console/fb_vga.h: New file. + * * console/i386kbd.h: New file. + * * console/kd.h: New file. + * * console/keyboard.c: New file. + * * console/keyboard.h: New file. + * * console/mouse_parser.c: New file. + * * console/mouse_parser.h: New file. + * * console/pc_keyb.c: New file. + * * console/ps2_drv.h: New file. + * * console/ps2_mouse.c: New file. + * * console/ps2_mouse.h: New file. + * * console/serial_mouse.c: New file. + * * console/serial_mouse.h: New file. + * * console/vgainit.c: New file. + * * console/vt.c: New file. + * * console/Makefile.am: Reflect new files. + * * console/console.c, console/inch.c, console/outch.c: Console + * functionality modifications. + * * startup/Makefile.am: Pick up tty_drv.c and gdb_glue.c + * ****************************************************************************/ #include @@ -126,7 +159,7 @@ serial_mouse_initialize(rtems_device_major_number major, * Do device-specific initialization */ /* 9600-8-N-1, without hardware flow control */ - BSP_uart_init( BSP_UART_PORT, 1200, 0 ); + BSP_uart_init( BSP_UART_PORT, 1200, CHR_8_BITS, 0, 0, 0 ); status = BSP_install_rtems_irq_handler( &serial_mouse_isr_data ); if( !status ) { diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h index dc1d2e497e..90d5e407b1 100644 --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h +++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h @@ -60,7 +60,12 @@ extern "C" { */ #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1 + +#if STACK_MINIMUM_SIZE < (4 * 1024) #define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024) +#else +#define CONFIGURE_INTERRUPT_STACK_MEMORY STACK_MINIMUM_SIZE +#endif /* * Network driver configuration -- cgit v1.2.3