void BSP_uart_set_baud( int uart, unsigned long baud ) { /* Sanity check */ assert(uart == BSP_UART_COM1 || uart == BSP_UART_COM2); BSP_uart_set_attributes( uart, baud, uart_data[uart].databits, uart_data[uart].parity, uart_data[uart].stopbits ); }
static int conSetAttr(int port, int minor, const struct termios *t) { unsigned long baud, databits, parity, stopbits; baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD); if ( baud > 115200 ) rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR); 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; default: /* just to avoid warnings -- all cases are covered. */ case CS8: databits = CHR_8_BITS; break; } if (t->c_cflag & CSTOPB) { /* 2 stop bits */ stopbits = STB; } else { /* 1 stop bit */ stopbits = 0; } printk("Mouse baud, port=%X, baud=%d\n", port, baud ); BSP_uart_set_attributes(port, baud, databits, parity, stopbits); return 0; }