select on UART
Paul Whitfield
paulw at omnitronics.com.au
Mon Apr 30 00:54:58 UTC 2007
Thomas Dörfler wrote:
> Hi,
>
> AFAIK select is currently limited to sockets, so there is no select
> support for serial or other devices. It would be a nice thing to add
> select support to the termios layer, but this has not yet been implemented.
FYI
The work around is to use the RTEMS specific receive call back functions
in termios.
See http://www.rtems.com/ml/rtems-users/2001/july/msg00090.html
Here is a code snippet that uses the function
if ( status >= 0 )
{
rtems_id task;
struct ttywakeup wakeup;
rtems_task_ident( RTEMS_SELF, RTEMS_LOCAL, &task);
wakeup.sw_pfn = receive_callback;
wakeup.sw_arg = (void *) task ;
status = ioctl( fd, RTEMS_IO_RCVWAKEUP, &wakeup);
}
And the callback is
static void passthru_receive_callback(struct termios *tty, void * arg )
{
(void) rtems_event_send( (rtems_id) arg, EVENT_RS232_RX );
}
The sends the calling task an event when there is serial data available.
I could not find any documentation for this _non_standard_ API, so I
added a entry to the FAQ on the wiki.
Hope that helps.
Regards
Paul
=========================================================================
The information in this e-mail is intended for the addressee only.
Unauthorised use, copying, disclosure or distribution by anyone else
is prohibited. Please let us know immediately if you receive this
e-mail in error. Thank you.
=========================================================================
More information about the users
mailing list