[ECOS] The select() method

Jonathan Larmour jlarmour@redhat.com
Tue Mar 13 13:03:00 GMT 2001

Nielsen Linus wrote:
> I recently fetched the latest version of eCos from the CVS .
> I am beginning to write a simple character device just to
> understand how it is done.
> I wonder how the select() method is supposed to be implemented?
> What does eCos expect it to do? Is it like poll() in Linux or what?
> I can't find a simple character device in the CVS to look at, and
> not any docs either.

Not a good situation I know. I think the generic serial driver is bound to
be the closest fit to what you are looking for. See

If you try to blot out the flow control stuff it should be okay. Basically
the driver exports a function like serial_select in its DEVIO_TABLE (see
io/common/current/include/devtab.h). When something calls select on an fd
associated with this driver, then e.g. serial_select is called and
cyg_selrecord() is used to register that this device is being "selected"
for reading/writing/exceptions.

Then at any other point in the driver, when one of the conditions has been
fulfilled to cause something to be woken up by a select, e.g. an rx buffer
going from empty to non-empty, or a tx buffer filling up, then
cyg_selwakeup() is called to indicate this.

Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

More information about the Ecos-discuss mailing list