This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to handle serial port input?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]