Versions Compared

Key

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

...

Application hook functions could be declared as shown in the code below.It’s also up to a user to set the value of the pointers so that they point to the appropriate functions as shown below. The pointers do not have to be set in main() but, you can set them after calling OSInit().

Code Block
void  App_OS_TaskCreateHook (OS_TCB *p_tcb)
{
    /* Your code here */
}
 
 
void  App_OS_TaskDelHook (OS_TCB *p_tcb)
{
    /* Your code here */
}
 
 
void  App_OS_TaskReturnHook (OS_TCB *p_tcb)
{
    /* Your code here */
}
 
 
void  App_OS_IdleTaskHook (void)
{
    /* Your code here */
}
 
 
void  App_OS_StatTaskHook (void)
{
    /* Your code here */
}
 
 
void  App_OS_TaskSwHook (void)
{
    /* Your code here */
}
 
 
void  App_OS_TimeTickHook (void)
{
    /* Your code here */
}

It’s also up to a user to set the value of the pointers so that they point to the appropriate functions as shown below. The pointers do not have to be set in main() but, you can set them after calling OSInit().

Code Block
void  main (void)
{
     OS_ERR  err;
 
 
     OSInit(&err);
     :
     :
     OS_AppTaskCreateHookPtr = (OS_APP_HOOK_TCB )App_OS_TaskCreateHook;
     OS_AppTaskDelHookPtr    = (OS_APP_HOOK_TCB )App_OS_TaskDelHook;
     OS_AppTaskReturnHookPtr = (OS_APP_HOOK_TCB )App_OS_TaskReturnHook;
     OS_AppIdleTaskHookPtr   = (OS_APP_HOOK_VOID)App_OS_IdleTaskHook;
     OS_AppStatTaskHookPtr   = (OS_APP_HOOK_VOID)App_OS_StatTaskHook;
     OS_AppTaskSwHookPtr     = (OS_APP_HOOK_VOID)App_OS_TaskSwHook;
     OS_AppTimeTickHookPtr   = (OS_APP_HOOK_VOID)App_OS_TimeTickHook;
     :
     :
     OSStart(&err);
}

Note that not every hook function need to be defined, only the ones the user wants to place in the application code.

...

Priority

Reserved by µC/OS-III for

0The ISR Handler Task (OS_IntQTask()), if used
1Reserved  


OS_CFG_PRIO_MAX-2Reserved
OS_CFG_PRIO_MAX-1The Idle Task (OS_IdleTask()), if used

...