Kernel Port Hooks API#

OSInitHook()#

Description#

Called by OSInit() at the beginning of OSInit().

Files#

os.h/os_cpu_c.c

Prototype#

void  OSInitHook (void)

Arguments#

None.

Returned Value#

None.

Notes / Warnings#

None.

OSRedzoneHitHook()#

Description#

Called when a task's stack has overflowed.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSRedzoneHitHook (OS_TCB  *p_tcb)

Arguments#

p_tcb

  • Pointer to the TCB of the offending task.

  • NULL if ISR.

Returned Value#

None.

Notes / Warnings#

None.

OSStatTaskHook()#

Description#

Allows your application to add functionality to the statistics task. This function is called every second by the Kernel's statistics task.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSStatTaskHook (void)

Arguments#

None.

Returned Value#

None.

Notes / Warnings#

None.

OSTaskCreateHook()#

Description#

Called when a task is created.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSTaskCreateHook (OS_TCB  *p_tcb)

Arguments#

p_tcb

Pointer to the TCB of the task being created.

Returned Value#

None.

Notes / Warnings#

None.

OSTaskDelHook()#

Description#

Called when a task is deleted.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSTaskDelHook (OS_TCB  *p_tcb)

Arguments#

p_tcb

Pointer to the TCB of the task being deleted.

Returned Value#

None.

Notes / Warnings#

None.

OSTaskReturnHook()#

Description#

Called if a task accidentally returns. In other words, a task should either be an infinite loop or delete itself when done.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSTaskReturnHook (OS_TCB  *p_tcb)

Arguments#

p_tcb

Pointer to the TCB of the task that is returning.

Returned Value#

None.

Notes / Warnings#

None.

OSTaskStkInit()#

Description#

Initializes the stack frame of the task being created as if it had been already switched-out. This function is called by OSTaskCreate() and is highly processor specific.

Files#

os.h/os_cpu_c.c

Prototype#

CPU_STK  *OSTaskStkInit (OS_TASK_PTR    p_task,
                         void          *p_arg,
                         CPU_STK       *p_stk_base,
                         CPU_STK       *p_stk_limit,
                         CPU_STK_SIZE   stk_size,
                         OS_OPT         opt)

Arguments#

p_task

Pointer to the task entry point address.

p_arg

Pointer to a user-supplied data area that will be passed to the task when the task first executes.

p_stk_base

Pointer to the base address of the stack.

p_stk_limit

Pointer to the element to set as the 'watermark' limit of the stack.

stk_size

Size of the stack (measured as number of CPU_STK elements).

opt

Options used to alter the behavior of OSTaskStkInit(). See OS.H for OS_TASK_OPT_xxx.

Returned Value#

Always returns the location of the new top-of-stack once the processor registers have been placed on the stack in the proper order.

Notes / Warnings#

None.

OSTaskSwHook()#

Description#

Allows you to perform other operations during a context switch. This function is called when a task switch is performed.

Files#

os.h/os_cpu_c.c

Prototype#

void  OSTaskSwHook (void)

Arguments#

None.

Returned Value#

None.

Notes / Warnings#

  1. Interrupts are disabled during this call.

  2. It is assumed that the global pointer 'OSTCBHighRdyPtr' points to the TCB of the task that will be 'switched in' (i.e., the highest priority task) and, 'OSTCBCurPtr' points to the task being switched out (i.e., the preempted task).