diff --git a/bsps/sparc/shared/uart/apbuart_cons.c b/bsps/sparc/shared/uart/apbuart_cons.c index ac8a4369b2..a54c222935 100644 --- a/bsps/sparc/shared/uart/apbuart_cons.c +++ b/bsps/sparc/shared/uart/apbuart_cons.c @@ -515,57 +515,6 @@ static int read_task(rtems_termios_device_context *base) return EOF; } - -struct apbuart_baud { - unsigned int num; - unsigned int baud; -}; -static struct apbuart_baud apbuart_baud_table[] = { - {B50, 50}, - {B75, 75}, - {B110, 110}, - {B134, 134}, - {B150, 150}, - {B200, 200}, - {B300, 300}, - {B600, 600}, - {B1200, 1200}, - {B1800, 1800}, - {B2400, 2400}, - {B4800, 4800}, - {B9600, 9600}, - {B19200, 19200}, - {B38400, 38400}, - {B57600, 57600}, - {B115200, 115200}, - {B230400, 230400}, - {B460800, 460800}, -}; -#define BAUD_NUM (sizeof(apbuart_baud_table)/sizeof(struct apbuart_baud)) - -static int apbuart_baud_num2baud(unsigned int num) -{ - int i; - - for(i=0; ic_ospeed); + baud = rtems_termios_baud_to_number(t->c_ospeed); if (baud > 0){ /* Get APBUART core frequency */ drvmgr_freq_get(uart->dev, DEV_APB_SLV, &core_clk_hz); @@ -666,9 +610,8 @@ static void get_attributes( { struct apbuart_priv *uart = base_get_priv(base); unsigned int ctrl; - struct apbuart_baud *baud; - t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL); + t->c_cflag = t->c_cflag & ~(CSIZE|PARENB|PARODD|CLOCAL); /* Hardware support only CS8 */ t->c_cflag |= CS8; @@ -685,8 +628,7 @@ static void get_attributes( if ((ctrl & LEON_REG_UART_CTRL_FL) == 0) t->c_cflag |= CLOCAL; - baud = apbuart_get_baud_closest(uart); - t->c_cflag |= baud->num; + rtems_termios_set_best_baud(t, apbuart_get_baud(uart)); } static void write_polled(