?? landzo
字號:
/******************** (C) COPYRIGHT 2011 野火嵌入式開發工作室 ********************
* 文件名 :app_hook.c
* 描述 :用戶任務鉤子函數,目前只有官方編寫的鉤子函數
*
* 實驗平臺 :野火kinetis開發板
* 庫版本 :
* 嵌入系統 :uC/OS-II V2.92
*
* 作者 :Micrium公司
* 淘寶店 :http://firestm32.taobao.com
* 技術支持論壇 :http://www.ourdev.cn/bbs/bbs_list.jsp?bbs_id=1008
**********************************************************************************/
/*
*********************************************************************************************************
* EXAMPLE CODE
*
* (c) Copyright 2003-2009; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
* Knowledge of the source code may NOT be used to develop a similar product.
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/OS-II
* Application Hooks
*
* Filename : app_hooks.c
* Version : V1.00
* Programmer(s) : FT
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
//#include <includes.h>
#include "ucos_ii.h" //uC/OS-II系統函數頭文件
/*
*********************************************************************************************************
* EXTERN GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL CONSTANTS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL TABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
/*
**********************************************************************************************************
**********************************************************************************************************
** GLOBAL FUNCTIONS
**********************************************************************************************************
**********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
** uC/OS-II APP HOOKS
*********************************************************************************************************
*********************************************************************************************************
*/
#if (OS_APP_HOOKS_EN > 0)
/*
*********************************************************************************************************
* TASK CREATION HOOK (APPLICATION)
*
* Description : This function is called when a task is created.
*
* Argument(s) : ptcb is a pointer to the task control block of the task being created.
*
* Note(s) : (1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void App_TaskCreateHook (OS_TCB *ptcb)
{
#if (APP_CFG_PROBE_OS_PLUGIN_EN == DEF_ENABLED) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TaskCreateHook(ptcb);
#endif
}
/*
*********************************************************************************************************
* TASK DELETION HOOK (APPLICATION)
*
* Description : This function is called when a task is deleted.
*
* Argument(s) : ptcb is a pointer to the task control block of the task being deleted.
*
* Note(s) : (1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void App_TaskDelHook (OS_TCB *ptcb)
{
(void)ptcb;
}
/*
*********************************************************************************************************
* IDLE TASK HOOK (APPLICATION)
*
* Description : This function is called by OSTaskIdleHook(), which is called by the idle task. This hook
* has been added to allow you to do such things as STOP the CPU to conserve power.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts are enabled during this call.
*********************************************************************************************************
*/
#if OS_VERSION >= 251
void App_TaskIdleHook (void)
{
}
#endif
/*
*********************************************************************************************************
* STATISTIC TASK HOOK (APPLICATION)
*
* Description : This function is called by OSTaskStatHook(), which is called every second by uC/OS-II's
* statistics task. This allows your application to add functionality to the statistics task.
*
* Argument(s) : none.
*********************************************************************************************************
*/
void App_TaskStatHook (void)
{
}
/*
*********************************************************************************************************
* TASK RETURN HOOK (APPLICATION)
*
* Description: This function is called if a task accidentally returns. In other words, a task should
* either be an infinite loop or delete itself when done.
*
* Arguments : ptcb is a pointer to the task control block of the task that is returning.
*
* Note(s) : none
*********************************************************************************************************
*/
#if OS_VERSION >= 289
void App_TaskReturnHook (OS_TCB *ptcb)
{
(void)ptcb;
}
#endif
/*
*********************************************************************************************************
* TASK SWITCH HOOK (APPLICATION)
*
* Description : This function is called when a task switch is performed. This allows you to perform other
* operations during a context switch.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts are disabled during this call.
*
* (2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
* will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
* task being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
#if OS_TASK_SW_HOOK_EN > 0
void App_TaskSwHook (void)
{
#if (APP_CFG_PROBE_OS_PLUGIN_EN > 0) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TaskSwHook();
#endif
}
#endif
/*
*********************************************************************************************************
* OS_TCBInit() HOOK (APPLICATION)
*
* Description : This function is called by OSTCBInitHook(), which is called by OS_TCBInit() after setting
* up most of the TCB.
*
* Argument(s) : ptcb is a pointer to the TCB of the task being created.
*
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
#if OS_VERSION >= 204
void App_TCBInitHook (OS_TCB *ptcb)
{
(void)ptcb;
}
#endif
/*
*********************************************************************************************************
* TICK HOOK (APPLICATION)
*
* Description : This function is called every tick.
*
* Argument(s) : none.
*
* Note(s) : (1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
#if OS_TIME_TICK_HOOK_EN > 0
void App_TimeTickHook (void)
{
#if (APP_CFG_PROBE_OS_PLUGIN_EN == DEF_ENABLED) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TickHook();
#endif
}
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -