This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
driver development, how to make timeouts?
- From: "Richard Rauch" <rrauch at itrgmbh dot de>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Sat, 28 May 2011 17:59:28 +0200
- Subject: [ECOS] driver development, how to make timeouts?
Hi all,
How I have to implement a timeout inside an eCos Driver?
I have following code, which is waiting on an interrupt event:
cyg_drv_mutex_lock(&(extra->i2c_lock));
cyg_drv_dsr_lock();
while (!extra->i2c_completed) {
cyg_drv_cond_wait(&(extra->i2c_wait));
}
cyg_drv_dsr_unlock();
cyg_drv_mutex_unlock(&(extra->i2c_lock));
The cyg_drv_cond_wait() never returns, as long as no interrupt occurs. But
in special cases (if the hardware is not wired properly), there will be
never an interrupt.
How can I break in this function after a while?
In normal user API, there is a function cyg_cond_timed_wait() which is able
to return in case of timeout.
I haven't found a similar function in driver's kernel API!
Who knows a solution?
Thanks
Richard
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss