This is the mail archive of the
mailing list for the eCos project.
cyg_drv_dsr_unlock() and non-kernel cfg
- From: Jani Monoses <jani at iv dot ro>
- To: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Tue, 23 Nov 2004 19:10:29 +0200
- Subject: cyg_drv_dsr_unlock() and non-kernel cfg
I noticed by looking at the code and then testing it out that in the nonkernel config
a cyg_drv_dsr_unlock() 'closes' so to say any number of previous cyg_drv_dsr_lock()s
is equivalent to a lock/unlock pair.
Although the docs and the comment above the unlock function says that DSRs will fire only
when the count which is incremented by dsr_lock (dsr_disable_counter) is 0, this counter
is never decremented in unlock but set to 0 regardless of how large it was.
Is this intended and somehow reflects that in non-kernel mode there's no realistic use for
such behaviour or is it really an oversight due to this code not being used much?
Attached is the change that made my small test app behave the same way when compiled with
and without the kernel, i.e when the lock count is > 0 DSRs will not be run (except when
explicitely called from a cond_wait)
I'd appreciate any comments
--- ../../cvs/packages/hal/common/current/src/drv_api.c 2004-04-13 17:38:59.000000000 +0300
+++ hal/common/current/src/drv_api.c 2004-11-23 18:56:49.803121624 +0200
@@ -289,29 +289,29 @@ externC void cyg_drv_dsr_unlock()
if( dsr_disable_counter == 1 )
- dsr_disable_counter = 0;
// Check that no DSRs have been posted between calling
// call_dsrs() and zeroing dsr_disable_counter. If so,
// loop back and call them.
- if( dsr_list != NULL )
+ if( dsr_list != NULL && dsr_disable_counter == 0)
dsr_disable_counter = 1;