[ECOS] drv_lock() cond_wait() drv_unlock() sequence

Grant Edwards grante@visi.com
Tue Apr 4 16:00:00 GMT 2000


>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


More information about the Ecos-discuss mailing list