Changeset 8ad5399 in rtems
- Timestamp:
- 10/18/00 16:10:50 (23 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 552051f
- Parents:
- 664db30b
- Location:
- c/src/lib/libbsp/i386/shared
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/shared/ChangeLog
r664db30b r8ad5399 1 2 * comm/i386-stub-glue.c, comm/tty_drv.c, comm/uart.c, comm/uart.h: 3 Add the ability to set parity, number of data bits and 4 number of stop bits to the existing i386 serial drivers. 5 6 2000-10-17 Joel Sherrill <joel@OARcorp.com> 1 7 2 8 * irq/idt.c, irq/Makefile.am: Moved idt.c to from libcpu/i386 so -
c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c
r664db30b r8ad5399 38 38 uart_current = uart; 39 39 40 BSP_uart_init(uart, 38400, 0);40 BSP_uart_init(uart, 38400, CHR_8_BITS, 0, 0, 0); 41 41 } 42 42 -
c/src/lib/libbsp/i386/shared/comm/tty_drv.c
r664db30b r8ad5399 19 19 * 20 20 * $Log$ 21 * Revision 1.1 2000/08/30 08:18:56 joel 22 * 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> 23 * 24 * * shared/comm: Added "/dev/ttyS1" & "/dev/ttyS2" support for 25 * the i386 BSPs. 26 * * shared/comm/gdb_glue.c: New file. 27 * * shared/comm/i386_io.c: New file. 28 * * shared/comm/tty_drv.c: New file. 29 * * shared/comm/tty_drv.h: New file. 30 * * shared/comm/Makefile.am: Account for new files. 31 * * shared/comm/uart.c: Adds support for sending characters to 32 * another "line discipline." 33 * 21 34 ****************************************************************************/ 22 35 … … 120 133 */ 121 134 /* 9600-8-N-1, without hardware flow control */ 122 BSP_uart_init( BSP_UART_COM1, 9600, 0 );135 BSP_uart_init( BSP_UART_COM1, 9600, CHR_8_BITS, 0, 0, 0 ); 123 136 status = BSP_install_rtems_irq_handler( &tty1_isr_data ); 124 137 if( !status ) … … 260 273 conSetAttr(int port, int minor, const struct termios *t) 261 274 { 262 int baud;275 unsigned long baud, databits, parity, stopbits; 263 276 264 277 switch (t->c_cflag & CBAUD) … … 320 333 return 0; 321 334 } 322 printk("Setting baud, port=%X, baud=%d\n", port, baud ); 323 BSP_uart_set_baud( port, baud ); 335 if (t->c_cflag & PARENB) { 336 /* Parity is enabled */ 337 if (t->c_cflag & PARODD) { 338 /* Parity is odd */ 339 parity = PEN; 340 } 341 else { 342 /* Parity is even */ 343 parity = PEN | EPS; 344 } 345 } 346 else { 347 /* No parity */ 348 parity = 0; 349 } 350 351 switch (t->c_cflag & CSIZE) { 352 case CS5: databits = CHR_5_BITS; break; 353 case CS6: databits = CHR_6_BITS; break; 354 case CS7: databits = CHR_7_BITS; break; 355 case CS8: databits = CHR_8_BITS; break; 356 } 357 358 if (t->c_cflag & CSTOPB) { 359 /* 2 stop bits */ 360 stopbits = STB; 361 } 362 else { 363 /* 1 stop bit */ 364 stopbits = 0; 365 } 366 367 printk("Setting attributes, port=%X, baud=%d, linemode = 0x%02x\n", port, baud, databits | parity | stopbits ); 368 BSP_uart_set_attributes(port, baud, databits, parity, stopbits); 324 369 return 0; 325 370 } … … 363 408 */ 364 409 /* 9600-8-N-1, without hardware flow control */ 365 BSP_uart_init( BSP_UART_COM2, 9600, 0);410 BSP_uart_init( BSP_UART_COM2, 9600, CHR_8_BITS, 0, 0, 0); 366 411 status = BSP_install_rtems_irq_handler( &tty2_isr_data ); 367 412 if( !status ) -
c/src/lib/libbsp/i386/shared/comm/uart.c
r664db30b r8ad5399 21 21 { 22 22 int hwFlow; 23 int baud; 23 unsigned long baud; 24 unsigned long databits; 25 unsigned long parity; 26 unsigned long stopbits; 24 27 }; 25 28 … … 93 96 */ 94 97 void 95 BSP_uart_init(int uart, int baud, int hwFlow) 98 BSP_uart_init 99 ( 100 int uart, 101 unsigned long baud, 102 unsigned long databits, 103 unsigned long parity, 104 unsigned long stopbits, 105 int hwFlow 106 ) 96 107 { 97 108 unsigned char tmp; … … 129 140 130 141 /* 8-bit, no parity , 1 stop */ 131 uwrite(uart, LCR, CHR_8_BITS);142 uwrite(uart, LCR, databits | parity | stopbits); 132 143 133 144 … … 156 167 */ 157 168 void 158 BSP_uart_set_baud(int uart, int baud) 169 BSP_uart_set_attributes 170 ( 171 int uart, 172 unsigned long baud, 173 unsigned long databits, 174 unsigned long parity, 175 unsigned long stopbits 176 ) 159 177 { 160 178 unsigned char mcr, ier; … … 169 187 */ 170 188 171 if(baud == uart_data[uart].baud) 189 if( (baud == uart_data[uart].baud) && 190 (databits == uart_data[uart].databits) && 191 (parity == uart_data[uart].parity) && 192 (stopbits == uart_data[uart].stopbits) ) 172 193 { 173 194 return; … … 177 198 ier = uread(uart, IER); 178 199 179 BSP_uart_init(uart, baud, uart_data[uart].hwFlow);200 BSP_uart_init(uart, baud, databits, parity, stopbits, uart_data[uart].hwFlow); 180 201 181 202 uwrite(uart, MCR, mcr); -
c/src/lib/libbsp/i386/shared/comm/uart.h
r664db30b r8ad5399 11 11 #define _BSPUART_H 12 12 13 void BSP_uart_init(int uart, int baud, int hwFlow);14 void BSP_uart_set_ baud(int aurt, int baud);13 void BSP_uart_init(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits, int hwFlow); 14 void BSP_uart_set_attributes(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits); 15 15 void BSP_uart_intr_ctrl(int uart, int cmd); 16 16 void BSP_uart_throttle(int uart);
Note: See TracChangeset
for help on using the changeset viewer.