...
If the #define
OS_CFG_APP_HOOKS_EN
is set to 1 in DEF_ENABLED
in os_cfg.h
, OSTimeTickHook()
will call App_OS_TimeTickHook()
.
...
Files
os.h/os_cpu_c.c
Prototype
Code Block |
---|
void OSTimeTickHook (void); |
Arguments
None
Returned Value
None
Required Configuration
NoneOS_CFG_APP_HOOKS_EN
must be enabled in os_cfg.h
. Refer to µC-OS-III Configuration Manual.
Callers
None
Notes/Warnings
...
The code below calls an application-specific hook that the application programmer can define. The user can simply set the value of OS_AppTimeTickHookPtr
to point to the desired hook function OSTimeTickHook()
is called by OSTimeTick()
which in turn calls App_OS_TimeTickHook()
through the pointer OS_AppTimeTickHookPtr
.
Code Block | ||
---|---|---|
| ||
void App_OS_TimeTickHook (void) /* os_app_hooks.c */
{
/* Your code goes here! */
}
void App_OS_SetAllHooks (void) /* os_app_hooks.c */
{
CPU_SR_ALLOC();
CPU_CRITICAL_ENTER();
:
OS_AppTimeTickHookPtr = App_OS_TimeTickHook;
:
CPU_CRITICAL_EXIT();
}
void OSTimeTickHook (void) /* os_cpu_c.c */
{
#if OS_CFG_APP_HOOKS_EN > 0u
if (OS_AppTimeTickHookPtr != (OS_APP_HOOK_VOID)0) { /* Call application hook */
(*OS_AppTimeTickHookPtr)();
}
#endif
} |