ncurses tests

Charles-Antoine Gauthier charles.gauthier at nrc.ca
Mon Jun 5 15:01:03 UTC 2000


Chris Johns wrote:
> 
> Joel Sherrill wrote:
> >
> > Eric Norum wrote:
> > >
> > > Now, where's the bug?   Should the smc1Initialize abide by the termios
> > > speed?  Probably.  But then how would anyone get a power-up serial line
> > > rate of anything other than 9600 baud?  I'd say that there's some
> > > configuration information missing on startup -- but where to put it?
> >
> > This is a hardware problem to solve in a general way.  Baud rate is
> > but one termios harware setting (character size, parity, stop bits)
> > even if one ignores the logical settings.   This makes me lean to
> > being able to override the entire default termios settings.
> >
> > But then there is the issue of default on a port per port basis.
> > In many systems, there are more than more serial port.  I hate
> > to create a solution for /dev/console and nothing else.
> >
> > Maybe termios_open should ask the device driver for its initial
> > hardware oriented settings for that port with a new termios handler.
> > If the handler is NULL, then use 9600-8N1.
> >
> 
> Is this really needed ?

In the case of the MVME167, the use of termios is NOT optional. The
calls to termios are built into the driver. Of course, one could code up
a different driver (different entry points in the console.c file) and
specify those in the driver table rather than the existing ones. But
then, this introduces yet more configuration info. If we are to add
configuration information, then lets go for it all hog and specify the
initial setting of each port, and whether termios is to be used or not.
That way, the driver open call can make the right decisions. By adding
support to configure the struct termios during the device open,
everything will fall into place.

> 
> If I am going to use a termios port I will make sure my code initialises
> every parameter I need set. What if I rely on a parameter and the
> default changes ?
> 
> The console is the only termios port opened by RTEMS and for which the
> issue exists. The first thing I do in my BSP code is :
> 
>   /*
>    * Make the stdin stream baud rate what we expect as a default.
>    */
> 
>   if (tcgetattr (STDIN_FILENO, &term) < 0)
>   {
>     printf ("rtems-target-init: cannot get terminal attributes.\n");
>   }
>   else
>   {
>     /*
>      * Set the datasize and baudrate. Should do the lot at some stage.
>      */
> 
>     term.c_cflag &= ~(CSIZE | CBAUD);
>     term.c_cflag |= CS8 | B19200;
> 
>     if (tcsetattr (STDIN_FILENO, TCSANOW, &term) < 0)
>       printf ("rtems-target-init: cannot set terminal attributes.\n");
>   }
> 
> It is simple and standard.
> 
> --
>  Chris Johns, mailto:ccj at acm.org

-- 
Charles-Antoine Gauthier
Institute for Information Technology   Institut de technologie de
l'information
National Research Council of Canada    Conseil national de recherches du
Canada



More information about the users mailing list