[ECOS] driver development, how to make timeouts?
Richard Rauch
rrauch@itrgmbh.de
Sat May 28 17:15:00 GMT 2011
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
More information about the Ecos-discuss
mailing list