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: why is it wrong to call cyg_semaphore_post() in ISR???


In gmane.os.ecos.general, you wrote:

> Also, you would expect 99% of your DSR's to run straight after the ISR
> in the ISR context. So normally a DSR does not cause an additional
> context switch, it is just piggybacked onto the ISR context switch.

Another way to visualize it is to think about ISRs that are
split into two parts.  The first part runs with interrupts
disabled, then interrupts are enabled and the second part runs.
Linux device driver interrupts used to be done that way: there
was a "top half" and a "bottom half".  The top half (which one
always tried to keep much smaller than the bottom half) was
entered with interrupts disabled.  At some point in the code,
you enabled interrupts and continued on with interrupts
enabled.

This isn't 100% accurate, since 

 1) there are times when DSRs are "locked out" so that some
    normal task code runs between what would have been the "top
    half" and the "bottom half"

 2) the order of execution of multiple pending DSRs is
    undefined.  [even though we all know what it is. ;) ]

-- 
Grant Edwards                   grante             Yow!  There's a lot of BIG
                                  at               MONEY in MISERY if you have
                               visi.com            an AGENT!!

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