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: how does the scheduler lock works when the DSR is interruptedby ext IRQ?


Qiang Huang wrote:
Hi all:
   I can't understand how the **scheduler lock** works when DSR interrupted
by ext IRQ and resumes execution?
>
assert ext_IRQ1-->
At this point, before the ISR is executed, the code in vectors.S will increment the scheduler lock (i.e. this will lock the scheduler if unlocked, or increment the count if it's already locked, e.g. if it was already processing a DSR)

> run ISR1( ) --> finish ISR1( ) --> interrupt_end() -->
post DSR --> unlock scheduler
Note: unlock means decrement the scheduler lock by 1.

> --> run DSR1( ) --> assert ext_IRQ2 --> run
ISR2( ) --> finish ISR2( ) --> interrupt_end() --> post DSR --> how does the
scheduler lock works to ensure the DSR2( ) is not run here and only runs
after DSR1( ) finished?
Note: DSRs are not run until the scheduler is unlocked i.e. scheduler lock == 0. That's part of the purpose of locking the scheduler. What this means is that the call to Cyg_Scheduler::unlock() in interrupt_end() above will not cause DSR2 to be run then as the scheduler is still locked. Instead interrupt_end() will just return, drop through and the processor state will be restored, i.e. DSR1 will continue executing. When DSR1 finishes, it returns to Cyg_Interrupt::call_pending_DSRs_inner() which will then run DSR2.

BTW Is there anywhere I can find some *more detail* about the kernel
handling mechanism?(any docs?)
The source, which has plenty of comments. It isn't that hard. Anthony Massa will shortly have a book out on eCos. You can pre-order it at Amazon. It might be worth you getting that too.

Jifl
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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