public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] I2C driver DSR locking
@ 2007-04-03 19:08 Rob Duncan
  2007-04-03 21:28 ` Paul D. DeRocco
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Duncan @ 2007-04-03 19:08 UTC (permalink / raw)
  To: ecos-discuss

Can someone explain to me how this code fragment from i2c_mcf52xx.c is
supposed to work?  extra->i2c_lock is a mutex to control access to the
extra->i2c_wait condition variable which is used to signal that the
extra->i2c_completed flag should be re-examined.  However
extra->i2c_completed is set true and the condition variable is
signaled by the DSR, which won't be able to run because the DSR lock
has been taken.  Isn't this liable to hang the system?  It looks to me
that locking the DSR is exactly what you don't want to do.

        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));

Thanks,

Rob.

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-04-10 10:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-03 19:08 [ECOS] I2C driver DSR locking Rob Duncan
2007-04-03 21:28 ` Paul D. DeRocco
2007-04-03 21:39   ` Rob Duncan
2007-04-04  4:41   ` Daniel Helgason
2007-04-04 14:25     ` Nick Garnett
2007-04-04 16:59       ` Paul D. DeRocco
2007-04-10 10:31         ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).