📄 cxtwak.c
字号:
/*********************************************************
Copyright (c) CMX Company. 1999. All rights reserved
*********************************************************/
/* version 5.30 */
#define CMXMODULE 1
#include <cxfuncs.h> /* get cmx include header file */
#include <cxextern.h> /* get cmx include header file */
#if (defined(CMXTRACKER) || defined(WINTRACKER))
#include <cmxtrack.h> /* get cmx include header file */
#endif
/************************************************************
The following function will be called by both the K_Task_Wake and
K_Task_Wake_Force functions. This will determine whether a task will
be forced to wake up, or to normally be woken up.
************************************************************/
byte K_I_Wake_Common(byte tskid,byte force)
{
tcbpointer tcbptr;
if(K_I_Get_Ptr(tskid,&tcbptr)) /* send address of pointer */
{
#if (defined(CMXTRACKER) || defined(WINTRACKER))
if (CMXTRACKER_ON)
{
cmxtracker_in2(CXTWAK_K_ERROR,tskid);
}
#endif
return(K_ERROR);
}
K_I_Disable_Sched(); /* set task block */
/* if force non 0, then wake task, regardless of what it
was waiting for. If force = 0, then only wake task
if it was waiting on time or indefinitely. */
if (tcbptr->tcbstate & (force ? ANY_WAIT : WAIT))
{
/* see if task was waiting for a resource */
if (tcbptr->tcbstate & (RESOURCE | SEMAPHORE))
{
/* yes, remove task from resource wait linked list. */
tcbptr->fwlink->bwlink = tcbptr->bwlink;
tcbptr->bwlink->fwlink = tcbptr->fwlink;
}
/* put task into the RESUME state, also possibly indicate time
expired, though it may not in the true sense */
if (force)
tcbptr->tcbstate = RESUME | TIME_EXPIRED;
else
tcbptr->tcbstate = RESUME;
/* see if this task has a higher priority then the current RUNNING task */
if (tcbptr->priority < active_priority)
{
PREEMPTED; /* yes, set the preempted scheduling flag */
}
#if (defined(CMXTRACKER) || defined(WINTRACKER))
if (CMXTRACKER_ON)
{
cmxtracker_in2(CXTWAK_K_OK,tskid);
}
#endif
K_I_Func_Return(); /* release task block */
return(K_OK); /* return good status */
}
else
{
#if (defined(CMXTRACKER) || defined(WINTRACKER))
if (CMXTRACKER_ON)
{
cmxtracker_in1(CXTWAK_K_NOT_WAITING);
}
#endif
K_I_Func_Return(); /* release task block */
return(K_NOT_WAITING); /* return error that task was not waiting */
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -