📄 os_cpu_c.c
字号:
/*
**********************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* ADSP-21065L SHARC Specific Code version 1.1
*
* File : OS_CPU_C.C
* By : Bertrand Hurst, Francois Veuve, Cedric Bornand (dspos@engineer.com)
* CETT - MIS
* Rte de Galilee 15
* 1400 Yverdon
* Switzerland
**********************************************************************************************
*/
#ifndef OS_MASTER_FILE
#include "includes.h"
#endif
/**********************************************************************************************************
* INITIALIZE A TASK'S STACK
*
* Description: Called by OSTaskCreate() or OSTaskCreateExt() to initialize a new task's stack
* Arguments : task pointer to the task's code
* pdata pointer to the user's data for the first execution
* ptos pointer to the top of stack
* opt specifies otions given by OStaskInit()
* Returns :
**********************************************************************************************************/
void *OSTaskStkInit (void (*task)(void *pd), void *pdata, void *ptos, INT16U opt)
{
INT32U *stk;
stk = (void*)ptos;
opt = opt; /* Prevent compiler warning */
*stk-- = (INT32U)0; /* Previous frame ptr */
*stk-- = (INT32U)0; /* Previous PC */
*stk-- = (INT32U)ptos; /* Frame ptr */
*stk-- = (INT32U)(task); /* PC */
/* Registers R0 to R15 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)pdata; /* Ptr to user's data go into R4 (1st func. param.) */
*stk-- = (INT32U)0; /* 2nd and 3rd parameters, if needed, go into R8 and R12 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
/* Registers I8 to I15 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
/* Registers M8 to M12 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0;
/* Registers I0 to I5 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
/* Registers M0 to M4 */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0;
/* Registers MRF, MRB, USTAT1, USTAT2 and ASTAT */
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0; *stk-- = (INT32U)0;
*stk-- = (INT32U)0;
return ((void *)stk);
}
/**********************************************************************************************************
* TASK CREATION HOOK
*
* Description: Called when a task is created. May be used to add new features
* Arguments : ptcb = ptr to the TCB of the newly created task
**********************************************************************************************************/
void OSTaskCreateHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
/**********************************************************************************************************
* TASK DELETION HOOK
*
* Description: Called when a task is deleted. May be used to add new features
* Arguments : ptcb = ptr to the TCB of the just deleted task
**********************************************************************************************************/
void OSTaskDelHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
/**********************************************************************************************************
* TASK SWITCH HOOK
* Description: Called each time a task switch occurs. May be used to add new features
**********************************************************************************************************/
void OSTaskSwHook (void)
{
}
/**********************************************************************************************************
* STATISTIC TASK HOOK
* Description: Called each second by the statistic's task of uC/OS-II. May be used to add new features
**********************************************************************************************************/
void OSTaskStatHook (void)
{
}
/**********************************************************************************************************
* TICK HOOK
* Description: Called each clock's tick. May be used to add new features
**********************************************************************************************************/
void OSTimeTickHook (void)
{
}
/**************************************** End of file ****************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -