This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: problem with layered drivers
- From: Bernard Fouchà <bernard dot fouche at kuantic dot com>
- To: Michele Paselli <miguelon at tiscali dot it>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 07 Nov 2006 12:08:56 +0100
- Subject: Re: [ECOS] problem with layered drivers
- References: <32843526.1162894594399.JavaMail.root@ps9>
Hi Michele.
I'm a newbie to eCos, so don't take my word for the Truth ;-). However I
recently wrote code that fire a thread that uses open() on all available
/dev/tty? and:
- use select() on all handles returned by open()
- when select() returns because data is available, look for the handle
that gave the data.
- perform a non blocking read on this handle.
- send traffic to whatever thread needs it, using message boxes.
(you have to configure 'tty-mode serial driver' (CYGPKG_IO_SERIAL_TTY)
and activate the uarts you need). You also need "support for non
blocking read and write calls" (CYGPKG_IO_SERIAL_SUPPORT_NONBLOCKING),
"Enable serial device select support" (CYGPKG_IO_SERIAL_SELECT_SUPPORT)
and maybe a few others accord to conflicts that configtool may detect).
Termios are not needed.
The thread performing this job can enforce its own kind of line
discipline to avoid producing a message per character, but that depends
on the data expected from the UARTs.
This design is very similar to a multi-thread daemon that would process
many incoming internet connections on a unix machine and redirect trafic
to whatever process that needs it (for instance by multiplexing traffic
on a single socket)
Bernard
Michele Paselli wrote:
Hi Bernard,
could you please be more precise? Where can I find the open function
and how can I use that?
Thanks
Michele
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss