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: stack switching in step (4) (5) (6) for previous question.Clock Tick??


Thank you very much on this help.

There is just one thing I would like to make sure:
Clock Tick process:

When clock interrupt happens:

1. Cyg_RealTimeClock::isr() invoked 
--> 2. return Cyg_Interrupt::CALL_DSR|Cyg_Interrupt::HANDLED 
--> 3. Cyg_RealTimeClock::dsr() invoked(right?? how and where is dsr
called?)
--> 4. rtc->tick() invoked in dsr()
--> 5. Cyg_Scheduler::unlock() called in rtc->tick()
--> 6. unlock_inner(0) called in unlock()
-->
process of unlock_inner()
--> 7. call_pending_DSRs() [supplied in assembly code]
--> 8. switch stack from thread --> interrupt stack

--> 9. calls back to the kernel to execute DSRs
**Confused here**: At step does the DSRs include the
Cyg_RealTimeClock::dsr()of the Cyg_RealTimeClock(which has already
been called in step 3 above? recursive call?), if no what DSRs will
probably called here during a Real Time Clock interrupt happens?

--> 10. switch stack from interrupt --> user thread 
--> 11. call HAL_THREAD_SWITCH_CONTEXT then switch to destination
thread

BTW: how the dsr is called after the isr called? who is resposible for
this mechanism?


Thanks a lot.



-----Original Message-----
From: Nick Garnett [mailto:nickg@ecoscentric.com]
Sent: Monday, September 23, 2002 6:39 PM
To: Qiang Huang
Cc: Sandeep; Ecos-Discuss
Subject: Re: [ECOS] stack switching in step (4) (5) (6) for previous
question
http://sources.redhat.com/ml/ecos-discuss/2002-09/msg00224.html??


"Qiang Huang" <jameshq@liverpool.ac.uk> writes:

> Hi nick:
>    Thanks for your helpful post.
> I just wonder **where** and how are those step (4)-switch to thread
stack,
> (5)- switch back to thread stack, (6)-switch to interrupt stack
implemented
> in ecos?
> 
> It seems in ecos the only place we can access the stack point(in
assembly
> code) is vector.S (the place when enter interrupt)and context.S (the
place
> when switch the context). So When "Request DSR run" (end of
> Cyg_RealTimeClock::isr())how can we switch the stack from interrupt
stack to
> user thread stack(Isn't that should be changed in assembly code?)?

It is, there is a call from the kernel DSR handling code to an
optional HAL assembler routine to do this.

> 
> for step (5), before entering the HAL_THREAD_SWITCH_CONTEXT() in
> Cyg_Scheduler::unlock_inner() how can we change the stack back to
"switch
> back to thread stack" without using the assembly code?
> 

See my other answers on this subject elsewhere for more detail.

-- 
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/

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