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]

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


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