Changeset 8ad5399 in rtems


Ignore:
Timestamp:
10/18/00 16:10:50 (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
552051f
Parents:
664db30b
Message:

2000-10-18 Charles-Antoine Gauthier <charles.gauthier@…>

  • comm/i386-stub-glue.c, comm/tty_drv.c, comm/uart.c, comm/uart.h: Add the ability to set parity, number of data bits and number of stop bits to the existing i386 serial drivers.
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
     62000-10-17      Joel Sherrill <joel@OARcorp.com>
    17
    28        * 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  
    3838  uart_current = uart;
    3939
    40   BSP_uart_init(uart, 38400, 0);
     40  BSP_uart_init(uart, 38400, CHR_8_BITS, 0, 0, 0);
    4141}
    4242
  • c/src/lib/libbsp/i386/shared/comm/tty_drv.c

    r664db30b r8ad5399  
    1919 *
    2020 * $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 *
    2134 ****************************************************************************/
    2235
     
    120133   */
    121134  /* 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 );
    123136  status = BSP_install_rtems_irq_handler( &tty1_isr_data );
    124137  if( !status )
     
    260273conSetAttr(int port, int minor, const struct termios *t)
    261274{
    262   int baud;
     275  unsigned long baud, databits, parity, stopbits;
    263276
    264277  switch (t->c_cflag & CBAUD)
     
    320333      return 0;
    321334    }
    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);
    324369  return 0;
    325370}
     
    363408   */
    364409  /* 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);
    366411  status = BSP_install_rtems_irq_handler( &tty2_isr_data );
    367412  if( !status )
  • c/src/lib/libbsp/i386/shared/comm/uart.c

    r664db30b r8ad5399  
    2121{
    2222  int hwFlow;
    23   int baud;
     23  unsigned long baud;
     24  unsigned long databits;
     25  unsigned long parity;
     26  unsigned long stopbits;
    2427};
    2528
     
    9396 */
    9497void
    95 BSP_uart_init(int uart, int baud, int hwFlow)
     98BSP_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)
    96107{
    97108  unsigned char tmp;
     
    129140
    130141  /* 8-bit, no parity , 1 stop */
    131   uwrite(uart, LCR, CHR_8_BITS);
     142  uwrite(uart, LCR, databits | parity | stopbits);
    132143 
    133144
     
    156167 */
    157168void
    158 BSP_uart_set_baud(int uart, int baud)
     169BSP_uart_set_attributes
     170(
     171  int uart,
     172  unsigned long baud,
     173  unsigned long databits,
     174  unsigned long parity,
     175  unsigned long stopbits
     176)
    159177{
    160178  unsigned char mcr, ier;
     
    169187   */
    170188
    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) )
    172193    {
    173194      return;
     
    177198  ier = uread(uart, IER);
    178199
    179   BSP_uart_init(uart, baud, uart_data[uart].hwFlow);
     200  BSP_uart_init(uart, baud, databits, parity, stopbits, uart_data[uart].hwFlow);
    180201
    181202  uwrite(uart, MCR, mcr);
  • c/src/lib/libbsp/i386/shared/comm/uart.h

    r664db30b r8ad5399  
    1111#define _BSPUART_H
    1212
    13 void BSP_uart_init(int uart, int baud, int hwFlow);
    14 void BSP_uart_set_baud(int aurt, int baud);
     13void BSP_uart_init(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits, int hwFlow);
     14void BSP_uart_set_attributes(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits);
    1515void BSP_uart_intr_ctrl(int uart, int cmd);
    1616void BSP_uart_throttle(int uart);
Note: See TracChangeset for help on using the changeset viewer.