Versions Compared

Key

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

...

void  OSTaskCreateHook (OS_TCB  *p_tcb)

...

File

...

...

Called from

...

Code enabled by

...

...

os_cpu_c.c

...

OSTaskCreate() ONLY

...

N/A

...

10045721004572This function is called by OSTaskCreate() after initializing the OS_TCB fields and setting up the stack frame for the task, just before adding the task to the ready list. When OSTaskCreateHook() is called, all of the OS_TCB fields are assumed to be initialized. Anchor10045751004575

OSTaskCreateHook() is part of the CPU port code and this function must not be called by the application code. OSTaskCreateHook() is actually used by the µC/OS-III port developer. Anchor10045771004577

You can use this hook to initialize and store the contents of ?oating-point registers, MMU registers, or anything else that can be associated with a task. Typically, you would store this additional information in memory allocated by the application. Anchor10045781004578

Arguments

...

p_tcb Anchor10045801004580

is a pointer to the TCB of the task being created. Note that the OS_TCB has been validated by OSTaskCreate() and is guaranteed to not be a NULL pointer when OSTaskCreateHook() is called.

...

Returned Value

...

None Anchor10045831004583

Notes/Warnings

Anchor10045841004584Do not call this function from the application. Anchor10045851004585

Example

...

The code below calls an application-specific hook that the application programmer can define. The user can simply set the value of OS_AppTaskCreateHookPtr to point to the desired hook function as shown in the example. OSTaskCreate() calls OSTaskCreateHook() which in turns calls App_OS_TaskCreateHook() through OS_AppTaskCreateHookPtr. As can be seen, when called, the application hook is passed the address of the OS_TCB of the newly created task. Anchor10691751069175  

...

rowspan4

...