termios and raw data - bug?

jennifer averett jennifer.averett at oarcorp.com
Wed Sep 19 21:21:22 UTC 2001


If I remember correctly the code used to be
  return (unsigned char)((*getReg)(pNS16550, NS16550_RECEIVE_BUFFER));
But this did not work correctly for the last board I used it on.  If the status line indicated
that there was no data available I read garbage out of the register.  I now have
the code looking as below.  Would it work to change cChar from a char to an unsigned char?

Jennifer


{
  unsigned32           pNS16550;
  unsigned char        ucLineStatus;
  char                      cChar;
  getRegister_f        getReg;

  pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
  getReg   = Console_Port_Tbl[minor].getRegister;

  ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS);
  if(ucLineStatus & SP_LSR_RDY) {
    cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER);
    return (int)cChar;
  } else {
    return -1;
  }

Joel Sherrill wrote:

> peter.o.mueller at gmx.de wrote:
> >
> > >
> > > That seems a little complicated.  Would not
> > >       return (unsigned char)((*getReg)(pNS16550, NS16550_RECEIVE_BUFFER));
> > > work properly?
> > >
> >
> > Who takes care about the changes. Joel, do you patch the serial driver code?
>
> I know I care and suspect that others care as well. :)
>
> In this type of case, I fall to my virtual knees and beg you to fix it
> in the BSPs you can test and make a stab at the others.  This is what I
> have had to do many times when a change impacts every BSP.  Just be
> careful.
>
> I will merge a patch.
>
> > Peter
> >
> > --
> > GMX - Die Kommunikationsplattform im Internet.
> > http://www.gmx.net
>
> --
> Joel Sherrill, Ph.D.             Director of Research & Development
> joel at OARcorp.com                 On-Line Applications Research
> Ask me about RTEMS: a free RTOS  Huntsville AL 35805
>    Support Available             (256) 722-9985




More information about the users mailing list