⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_c.c

📁 DSP RTOS源代码
💻 C
字号:
#define  OS_CPU_GLOBALS
#include "..\EX1\includes.h"

void *OSTaskStkInit (void (*task)(void *pd), void *pdata, void *ptos, INT16U opt)
{
    INT16U *stk;

    opt    = opt;                           /* 'opt' is not used, prevent warning                      */
    stk=(INT16U*)ptos;

    *stk--=(INT16U)task;		//返回地址
    *stk--=(INT16U)(*(int*)0x0006);		//ST0
    *stk--=(INT16U)(*(int*)0x0007);		//ST1
    *stk--=(INT16U)pdata;		//AL
    *stk--=(INT16U)0x0001;		//AH
    *stk--=(INT16U)0x0002;		//AG
    *stk--=(INT16U)0x0003;		//BL
    *stk--=(INT16U)0x0004;		//BH
    *stk--=(INT16U)0x0005;		//BG
    *stk--=(INT16U)0x0006;		//T
    *stk--=(INT16U)0x0007;		//TRN
    *stk--=(INT16U)0x0008;		//AR0
    *stk--=(INT16U)0x0009;		//AR1
    *stk--=(INT16U)0x0010;		//AR2
    *stk--=(INT16U)0x0011;		//AR3
    *stk--=(INT16U)0x0012;		//AR4
    *stk--=(INT16U)0x0013;		//AR5
    *stk--=(INT16U)0x0014;		//AR6
    *stk--=(INT16U)0x0015;		//AR7
    *stk--=(INT16U)0x0000;		//BK
    *stk--=(INT16U)0x0000;		//BRC
    *stk--=(INT16U)0x0000;		//RSA
    *stk  =(INT16U)0x0000;		//REA
    
    return ((void *)stk);
}

#if OS_CPU_HOOKS_EN
/*
*********************************************************************************************************
*                                          TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being created.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskCreateHook (OS_TCB *ptcb)
{
    ptcb = ptcb;                       /* Prevent compiler warning                                     */
}


/*
*********************************************************************************************************
*                                           TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
*
* Note(s)    : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskDelHook (OS_TCB *ptcb)
{
    ptcb = ptcb;                       /* Prevent compiler warning                                     */
}

/*
*********************************************************************************************************
*                                           TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed.  This allows you to perform other
*              operations during a context switch.
*
* Arguments  : 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).
*********************************************************************************************************
*/
void OSTaskSwHook (void)
{
}

/*
*********************************************************************************************************
*                                           STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
*              application to add functionality to the statistics task.
*
* Arguments  : none
*********************************************************************************************************
*/
void OSTaskStatHook (void)
{
}

/*
*********************************************************************************************************
*                                               TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments  : none
*
* Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
void OSTimeTickHook (void)
{
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -