This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: how to set overtime to serial port block read/write?


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 cyg_io_get_config().


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").

Jifl
--
--["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


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