This is the mail archive of the ecos-discuss@sourceware.cygnus.com 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]

drv_lock() cond_wait() drv_unlock() sequence



From looking at the documentation it would appear that calling
cyg_drv_dsr_lock() will prevent DSRs from running until
cyg_drv_dsr_unlock() is called.  

But, after looking at the serial driver, this can't be the
case, since it does a cyg_cond_wait() after locking out DSRs,
and a DSR is what does a signal() to wake up the waiting task.

It does something like:

  cyg_drv_mutex_lock(&mtx)
  cyg_drv_dsr_lock();
  while (1)
    {
    if (done)
       break;
    else
       cyg_drv_cond_wait(&cv);
    }
  cyg_drv_dsr_unlock();
  cyg_drv_mutex_unlock(&mtx);  

The call to cyg_drv_cond_wait() must unlock DSRs or the whole
system would just grind to a halt at that point.  When
cyg_drv_cond_wait() returns, are DSRs again locked out until
either cyg_drv_cond_wait()or cyg_drv_dsr_unlock() is called?

-- 
Grant Edwards
grante@visi.com

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