[ECOS] from ISR to thread

Nick Garnett nickg@redhat.com
Wed Dec 5 08:30:00 GMT 2001


"Patrick Doyle" <wpd@delcomsys.com> writes:

> > ISR code:
> > {
> >   cyg_drv_isr_lock()
> >   rbuf.putdata(hw.data)
> >   cyg_drv_isr_unlock()
> >
> >   cyg_drv_interrupt_acknowledge()
> >
> >   return cyg_isr_call_dsr
> > }
> This one caught me by surprise.  Why would you have to an ISR lock/unlock
> from within an ISR?  Were you just being extra careful in case some other
> (higher priority?) ISR's happen to use the same ring buffer?
> 

Partly that. Also in SMP systems, the thread may be running on a
different CPU, so merely disabling interrupts on this CPU has no
effect. To make the ISR lock usable it must also contain a spinlock,
to block other CPUs if necessary. Hence it is necessary to use it in
ISRs too.

-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK



More information about the Ecos-discuss mailing list