[ECOS] short reads on serial port..

Jonathan Larmour jlarmour@redhat.com
Thu Oct 26 13:09:00 GMT 2000


Dave Airlie wrote:
> 
> k> > Should I use select, what does it drag in the way of extra stuff to
> my
> > > build ... I don't want to have to add POSIX stuff really...
> > >
> > > Is there another way?
> >
> > Um, serial reads do block by default. If you want to wait on multiple
> > devices but avoid select, you could use multiple threads using blocking
> > reads, which then signal your original thread when data arrives.
> 
> yes but they block for the number of bytes you request .. so if I want a
> max of 127 bytes they block up to 127 bytes, they can't return when they
> get data.. I know I could probably could some mess with reading 1 byte and
> then checking how much was left .. but I'd say it would be a bit messy ...

Well, a bit yes. The eCos version of select itself should be quite
efficient. The problem is that it operates on fd's so that pulls in all the
other file I/O stuff, plug-in filesystem support, devfs etc.

Maybe you'd find it easier just to hack
io/serial/current/src/common/serial.c and change every mention of
cyg_selwakeup() to some function of your own.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault


More information about the Ecos-discuss mailing list