28.12.2014 Views

uC/OS-II (Structure) - 경희대학교

uC/OS-II (Structure) - 경희대학교

uC/OS-II (Structure) - 경희대학교

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Kernel <strong>Structure</strong> (Cont’d)<br />

• Clock Tick / <strong>OS</strong>TimeTick()<br />

MicroC/<strong>OS</strong>-<strong>II</strong> Clock Tick <br />

Multitasking <strong>OS</strong>Start() Clock Tick<br />

Interrupt .<br />

Clock Tick <br />

‣ <strong>OS</strong>TimeTick(), <strong>OS</strong>TickISR()<br />

void <strong>OS</strong>TickISR(void)<br />

{<br />

Save processor registers;<br />

Call <strong>OS</strong>IntEnter() or increment <strong>OS</strong>IntNesting;<br />

if (<strong>OS</strong>IntNesting == 1) {<br />

<strong>OS</strong>TCBCur-><strong>OS</strong>TCBStkPtr = SP;<br />

}<br />

Post a 'dummy' message (e.g. (void *)1) to the tick mailbox;<br />

}<br />

Call <strong>OS</strong>IntExit();<br />

Restore processor registers;<br />

Execute a return from interrupt instruction;<br />

Embedded System Lab. <strong>II</strong> 32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!