This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: How to handle serial port input?
- To: Tom Vandeplas <tom dot vandeplas at 4g-radio dot com>
- Subject: Re: [ECOS] How to handle serial port input?
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Tue, 19 Jun 2001 23:27:57 +0100
- Cc: ecos-discuss at sourceware dot cygnus dot com
- Organization: Red Hat UK Ltd.
- References: <NBEOLLLNGJIDDDCAHFAGAEIMCAAA.tom.vandeplas@4g-radio.com>
Tom Vandeplas wrote:
>
> Hi,
>
> I'm working on a Cirrus edb7212 board. I would like to write a thread to
> handle input on the serial port. The ideal would be that the thread
> continues as long as there's data available.
>
> I read the "simple serial" driver, as I understand any input to a serial
> port is written to a buffer by the kernel, by using "cyg_io_read" one can
> read this buffer... is this correct?
>
> If this is correct, how can I know when to read this buffer, polling it all
> the time would be a disaster for performance. Is there some way to attach an
> interrupt to this or even better is there a synchrioniation primitive
> available?
You could have a separate thread that continuously does blocking reads. Or
you can instead use the fileio layer to give a POSIX style interface, and
use select().
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions http://www.redhat-techworld.com/