From e9bb4fbc7539300476dfa04fb64354b0a0f30aac Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 10 Aug 2009 14:54:52 +0000 Subject: 2009-08-10 Joel Sherrill * console.c: Fix tabs and allow the BSP to override the default baud rate. --- c/src/lib/libbsp/shared/console.c | 42 +++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'c/src/lib/libbsp/shared/console.c') diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c index c477aae4eb..440a2cb293 100644 --- a/c/src/lib/libbsp/shared/console.c +++ b/c/src/lib/libbsp/shared/console.c @@ -82,26 +82,34 @@ rtems_device_driver console_open( status = rtems_termios_open ( major, minor, arg, &Callbacks ); Console_Port_Data[minor].termios_data = args->iop->data1; - /* Get tty pointeur from the Console_Port_Data */ + /* Get tty pointur from the Console_Port_Data */ current_tty = Console_Port_Data[minor].termios_data; if ( (current_tty->refcount == 1) ) { - /* - * If it's the first open, modified, if need, the port parameters - */ - if (minor!=Console_Port_Minor) { - /* - * If this is not the console we do not want ECHO and - * so forth - */ - IoctlArgs.iop=args->iop; - IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; - IoctlArgs.buffer=&Termios; - rtems_termios_ioctl(&IoctlArgs); - Termios.c_lflag=ICANON; - IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; - rtems_termios_ioctl(&IoctlArgs); - } + + /* + * If this BSP has a preferred default rate, then use that. + */ + #if defined(BSP_DEFAULT_BAUD_RATE) + rtems_termios_set_initial_baud( current_tty, BSP_DEFAULT_BAUD_RATE ); + #endif + + /* + * If it's the first open, modified, if need, the port parameters + */ + if (minor!=Console_Port_Minor) { + /* + * If this is not the console we do not want ECHO and + * so forth + */ + IoctlArgs.iop=args->iop; + IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; + IoctlArgs.buffer=&Termios; + rtems_termios_ioctl(&IoctlArgs); + Termios.c_lflag=ICANON; + IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; + rtems_termios_ioctl(&IoctlArgs); + } } if ( (args->iop->flags&LIBIO_FLAGS_READ) && -- cgit v1.2.3