Versions Compared

Key

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

...

void  OSStartHighRdy (void)

File

Called from

Code enabled by

os_cpu_a.asm

...

...

OSStart()

...

N/A

...

OSStartHighRdy() is responsible for starting the highest-priority task that was created prior to calling OSStart(). OSStartHighRdy() is a µC/OS-III port function that is generally written in assembly language.anchor10038051003805

Arguments

...

10038061003806None Anchor10038071003807

Returned Values

Anchor10038081003808None Anchor10038091003809

Notes/Warnings

...

None Anchor10038111003811

Example

...

1003833The pseudocode for OSStartHighRdy() is shown below. Anchor10689431068943  

...

...

rowspan7

...

(1)

...

OSStartHighRdy() must call OSTaskSwHook().

...

When called, OSTCBCurPtr and OSTCBHighRdyPtr both point to the OS_TCB of the highest-priority task created.

...

OSTaskSwHook() should check that OSTCBCurPtr is not equal to OSTCBHighRdyPtr as this is the first time OSTaskSwHook() is called and there is not a task being switched out.

...

10038381003838(2)anchor10038391003839

The CPU stack pointer register is loaded with the top-of-stack (TOS) of the task being started. The TOS is found in the .StkPtr field of the OS_TCB. For convenience, the .StkPtr field is the very first field of the OS_TCB data structure. This makes it easily accessible from assembly language.

Anchor10038411003841(3) Anchor10038421003842

The registers are popped from the task’s stack frame. Recall that the registers should have been placed on the stack frame in the same order as if they were pushed at the beginning of an interrupt service routine.

...

(4) Anchor10038441003844

You must execute a return from interrupt. This starts the task as if it was resumed when returning from a real interrupt.