This is the mail archive of the ecos-discuss@sources.redhat.com 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: from ISR to thread


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]