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]

Re: Synchronization primitive for DSRs


Ivan Djelic <ivan.djelic@parrot.fr> writes:

> On Thu, Nov 30, 2006 at 04:40:23PM +0100, Andrew Lunn wrote:
> > On Thu, Nov 30, 2006 at 04:21:58PM +0100, Stefan Sommerfeld wrote:
> > > 
> > > It looks like the cyg_drv_dsr_lock() will lock all DSRs and so it will stop 
> > > multitasking and any other DSRs to run. That's not what I'm searching for. 
> > > Any other solution?
> > 
> > It should not stop multi-tasking. The scheduler can still run and do
> > task switches. But all DSR are blocked. So, for example, round-robin
> > will not happen, since that needs a timer tick, and so a DSR.  All
> > your device driver IO stops etc. But plain thread/thread interactions
> > should keep working.
> 
> Correct me if I am wrong, but unless you build a kernel-less configuration,
> cyg_drv_dsr_lock() is just an alias for cyg_scheduler_lock().
> Therefore it prevents thread scheduling as well as other DSR processing.

That is correct.

The usual approach for dealing with this sort of thing is to do it at
the interrupt level. DSRs are only scheduled to run by the ISR. So
masking the appropriate vector will stop ISRs and hence DSRs being
delivered.

If you still want the ISRs to run but not the DSRs, then is it a
simple matter of setting a flag that the ISR tests to decide whether
to post the DSR. If you still want the DSR to run eventually, the ISR
should also set a flag indicating that it has postponed DSR delivery,
and when you clear the first flag you can check the second and call
the DSR directly.

-- 
Nick Garnett                                     eCos Kernel Architect
http://www.ecoscentric.com                The eCos and RedBoot experts


-- 
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]