void OSTimeTick (void):
处理System Tick,在System Tick中断函数中调用。
调用钩子函数,根据
OS_CFG_ISR_POST_DEFERRED_EN给OSTickTask发出Sem,根据
OS_CFG_SCHED_ROUND_ROBIN_EN调用时间片轮询,根据
OS_CFG_TMR_EN当
OSTmrUpdateCtr==0时给OSTmrTask发出Sem。
OS_TICK OSTimeGet (OS_ERR *p_err):
获取
OSTickCtr的值。系统没有用到。
void OSTimeSet (OS_TICK ticks,
OS_ERR *p_err):
设置OSTickCtr的值。系统没有用到。
void OSTimeDly (OS_TICK dly,
OS_OPT opt,
OS_ERR *p_err):
先进行参数检验,更新
OSTCBCurPtr->TaskState = OS_TASK_STATE_DLY,将OSTCBCurPtr插入到TickList中,如果出现错误
OS_CRITICAL_EXIT_NO_SCHED();,将OSTCBCurPtr从RdyList中移除,启动调度。
void OSTimeDlyHMSM (CPU_INT16U hours,
CPU_INT16U minutes,
CPU_INT16U seconds,
CPU_INT32U milli,
OS_OPT opt,
OS_ERR *p_err):
和OSTimeDly ()相同,只是通过参数计算得到dly,在开发中感觉还是OSTimeDly 好用。
void OSTimeDlyResume (OS_TCB *p_tcb,
OS_ERR *p_err):
恢复调用了
OSTimeDly()或
OSTimeDlyHMSM()的任务。
判断p_tcb->TaskState:
如果OS_TASK_STATE_DLY:
更新p_tcb->TaskState,将p_tcb从TickList中删除,将p_tcb添加的ready_list中。
如果
OS_TASK_STATE_DLY_SUSPENDED
:更新p_tcb->TaskState,将p_tcb从TickList中删除。
其他状态不能Resume,返回对应的错误码。