fread blocks on device data read?

Eric Norum wenorum at lbl.gov
Tue Aug 17 15:46:39 UTC 2010


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





More information about the users mailing list