📄 tcce.c
字号:
/* moved validate resume function */
/* to this file, resulting in */
/* version 1.1 */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS TCCE_Resume_Service(NU_TASK *task_ptr)
{
TC_TCB *task; /* Task control block ptr */
STATUS status; /* Completion status */
/* Move task control block pointer into internal pointer. */
task = (TC_TCB *) task_ptr;
/* Determine if the task pointer is valid. */
if ((task == NU_NULL) || (task -> tc_id != TC_TASK_ID))
/* Task pointer is invalid. */
status = NU_INVALID_TASK;
/* Make sure that the task is suspended in an identical manner. */
else if (TCCE_Validate_Resume(NU_PURE_SUSPEND, task_ptr))
/* Task is not unconditionally suspended, return error status. */
status = NU_INVALID_RESUME;
else
/* Call the actual resume service. */
status = TCC_Resume_Service(task_ptr);
/* Return the completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Suspend_Service */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the suspend service. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Suspend_Service Actual suspend service */
/* function */
/* */
/* INPUTS */
/* */
/* task_ptr Task control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS If successful completion */
/* NU_INVALID_TASK Task pointer is invalid */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* resulting in version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS TCCE_Suspend_Service(NU_TASK *task_ptr)
{
TC_TCB *task; /* Task control block ptr */
STATUS status; /* Completion status */
/* Move task control block pointer into internal pointer. */
task = (TC_TCB *) task_ptr;
/* Determine if the task pointer is valid. */
if ((task == NU_NULL) || (task -> tc_id != TC_TASK_ID))
/* Task pointer is invalid. */
status = NU_INVALID_TASK;
else
/* Call the actual service routine. */
status = TCC_Suspend_Service(task_ptr);
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Relinquish */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking for the relinquish */
/* function. If the current thread is not a task, this request */
/* is ignored. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Relinquish Actual relinquish function */
/* */
/* INPUTS */
/* */
/* None */
/* */
/* OUTPUTS */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* */
/*************************************************************************/
VOID TCCE_Relinquish(VOID)
{
TC_TCB *task; /* Pointer to task */
/* Pickup the current thread and place it in the task pointer. */
task = (TC_TCB *) TCD_Current_Thread;
/* Determine if the current thread is a task. If so, call the actual
relinquish routine. Otherwise, ignore the request. */
if ((task) && (task -> tc_id == TC_TASK_ID))
/* Valid request, call the relinquish function. */
TCC_Relinquish();
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Task_Sleep */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking for the task sleep */
/* function. If the current thread is not a task, this request */
/* is ignored. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Task_Sleep Actual task sleep function */
/* */
/* INPUTS */
/* */
/* ticks Number of ticks to sleep for */
/* */
/* OUTPUTS */
/* */
/* None */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* B. Sellew 03-19-1996 Added check for parameter of 0 */
/* or negative number, resulting */
/* in version 1.1+ (spr037) */
/* */
/*************************************************************************/
VOID TCCE_Task_Sleep(UNSIGNED ticks)
{
TC_TCB *task; /* Pointer to task */
/* If parameter is negative or zero, return */
if (ticks <= 0)
return;
/* Pickup the current thread and place it in the task pointer. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -