[ECOS] how to set overtime to serial port block read/write?

Jonathan Larmour jifl@jifvik.org
Sun Sep 27 21:55:00 GMT 2009

wb ning wrote:
> Hi, everyone:
>     I think it's a common question, but i can't find the answer. I
> think block read/write of serial port need a overtime, if time exceeds
> that, i can made my program don't
> wait any longer, if i can't set overtime, maybe i send a command and
> wait for response, but when some error occurs and the reponse is lost,
> my thread will wait forever.
> Do anyone have find how to send overtime to block read/write? Please help me.

By overtime, I assume you mean a timeout. You can use a kernel alarm and 
from the alarm callback (after the timeout) use the 
CYG_IO_GET_CONFIG_SERIAL_ABORT config key with cyg_io_get_config(). Look 
at the eCos documentation for how to use kernel alarms, and 

Alternatively don't forget that with the file I/O package, you can use 
select() with serial drivers (e.g. if opened as filename "/dev/ser0").

--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list