?? os_cpu_c.c
字號:
/*Example,porting ucosii to simuos 20041123*/
/*Author:lmjx
**Email :limiao@yeah.net
**You can FREE use this copy for LEARN or EDUCATE purpose.
**For more information access www.mshowtec.com
**/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "../example/includes.h"
/*
*********************************************************************************************************
Global variables
*********************************************************************************************************
*/
INT32U curTick = 0;
/*********************************************************************************************************
uCOS-II Functions
*********************************************************************************************************
*/
void *OSTaskStkInit(void (*task) (void *pd), void *pdata, void *ptos, INT16U opt)
{
OS_STK *stk;
stk = (OS_STK *) ptos;
*--stk = (INT32U) pdata;
*--stk = (INT32U) task;
return stk;
}
// OSTaskCreateHook **********************************************************
// This hook is invoked during task creation. MUST NOT BE DEFINED BY THE APPLICATION.
void OSTaskCreateHook(OS_TCB * pTcb)
{
simuTaskCreate( *(pTcb->OSTCBStkPtr),(void *) *(pTcb->OSTCBStkPtr + 1));
//ADD YOUR OWN HOOK CODE HERE IF NECESSARY
}
// OSTaskIdleHook ************************************************************
// This hook is invoked from the idle task. MUST NOT BE DEFINED BY THE APPLICATION.
void OSTaskIdleHook()
{
}
/*
*******************************************************************************
Hook functions (user hookable)
*******************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
/*
void OSInitHookBegin() MUST NOT BE DEFINED BY THE APPLICATION, see above.
*/
// OSInitHookEnd *************************************************************
// This hook is invoked at the end of the OS initialization.
void OSInitHookEnd()
{
}
/*
void OSTaskCreateHook(OS_TCB * pTcb) MUST NOT BE DEFINED BY THE APPLICATION, see above.
*/
// OSTaskDelHook *************************************************************
// This hook is invoked during task deletion.
void OSTaskDelHook(OS_TCB * pTcb)
{
}
// OSTCBInitHook
// This hook is invoked during TCB initialization
void OSTCBInitHook(OS_TCB * ptcb)
{
}
/*
void OSTaskIdleHook() MUST NOT BE DEFINED BY THE APPLICATION, see above.
*/
// OSTaskStatHook ************************************************************
// This hook is invoked by the statistical task every second.
void OSTaskStatHook()
{
}
// OSTimeTickHook ************************************************************
// This hook is invoked during a time tick.
void OSTimeTickHook()
{
}
// OSTaskSwHook **************************************************************
// This hook is invoked during a task switch.
// OSTCBCur points to the current task (being switched out).
// OSTCBHighRdy points on the new task (being switched in).
void OSTaskSwHook()
{
}
#else
#pragma message("INFO: Hook functions must be defined in the application")
#endif
/*
*******************************************************************************
Internal Task switch functions
*******************************************************************************
*/
// OSStartHighRdy *************************************************************
// Start first task
void OSStartHighRdy(void)
{
OSRunning++;
simuSchedule();
while(OSRunning)
{
simuWin32ThreadSwitch();
}
}
void OSTickISR(void)
{
curTick++;
OSTimeTick();
}
// OSCtxSw ********************************************************************
// Task context switch
void OSCtxSw(void)
{
simuSchedule();
}
// OSIntCtxSw *****************************************************************
// Interrupt context switch
void OSIntCtxSw(void)
{
simuSchedule();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -