Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
          void  OSIntCtxSw (void)
          {
              OSTaskSwHook();                                 (1)
              OSPrioCur           = OSPrioHighRdy;            (2)
              OSTCBCurPtr         = OSTCBHighRdyPtr;          (3)
              SP                  = OSTCBHighRdyPtr->StkPtr;  (4)
              Restore all CPU registers;                      (5)
              Return from interrupt;                          (6)
          }


Panel
bgColor#f0f0f0

(1) OSIntCtxSw() must call OSTaskSwHook().

(2) OSPrioHighRdy needs to be copied to OSPrioCur.

(3) OSTCBHighRdyPtr needs to be copied to OSTCBCurPtr because the current task will now be the new task.

(4) The stack pointer of the new task is restored from the OS_TCB of the new task.

(5) All the CPU registers need to be restored from the new task’s stack.

(6) A return from interrupt instruction must be executed.

...