Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

void  OSTaskCreateHook (OS_TCB  *p_tcb)

File

Called from

Code enabled by

os_cpu_c.c

OSTaskCreate() ONLY

N/A

This 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.

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.

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.

Arguments

p_tcb

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

Notes/Warnings

Do not call this function from the application.

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.

  • No labels