fread blocks on device data read?

João Rasta freakforever at gmail.com
Tue Aug 17 15:56:25 UTC 2010


You mean setting termios struct and use tcsetattr() to set the parameters?
tcsetattr() only accepts the file descriptor ID as an int, not a FILE *
pointer which is returned by fopen()..

Anyway it was working with the uart in polling mode so it should work also
in interrupt mode without changing any RTEMS parameter right?


Best,
JM



On Tue, Aug 17, 2010 at 4:46 PM, Eric Norum <wenorum at lbl.gov> wrote:

> You need to set up the termios parameters appropriately.   By default the
> serial ports work in "cooked" mode -- the fread won't return until a line
> terminator character has been received.
>
> On Aug 17, 2010, at 8:34 AM, João Rasta wrote:
>
> > Hi,
> >
> > I'm trying to read data from UART2 that works in interrupt mode in RTEMS.
> As far as i understand, the driver loads the data to a software buffer using
> interrupts when the data arrives, so the task of geting the data from the
> buffer should be invisible to the user and could be made, for instance,
> with:
> >
> > FILE * A;
> >     char buff;
> >     A = fopen(COMMS__DKE_LOOP_DEVICE_NAME,"r+");
> >     while(1)
> >     {
> >         fread(&buff,1,1,A);
> >         printf("%02X\n",buff);
> >     }
> >
> > However this routine is blocking on fread(). Do i need to set any special
> settings uppon RTEMS initialization? I'm adding
> CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER so the driver is up and running
> (tested with stdio UART). What am i missing?
> >
> >
> > Best,
> > JM
> >
> >
> > _______________________________________________
> > rtems-users mailing list
> > rtems-users at rtems.org
> > http://www.rtems.org/mailman/listinfo/rtems-users
>
> --
> Eric Norum
> wenorum at lbl.gov
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20100817/efd1fe42/attachment-0001.html>


More information about the users mailing list