📄 tcce.c
字号:
/* 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 *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Modified function interface, *//* added register optimizations, *//* resulting in version 1.1 *//* *//* 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 if ((task->tc_status == NU_FINISHED) || (task->tc_status == NU_TERMINATED)) /* Can't suspend a task in a finished or terminated state */ status = NU_INVALID_SUSPEND; 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. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCC_Relinquish Actual relinquish function *//* *//* INPUTS *//* *//* None *//* *//* OUTPUTS *//* *//* None *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 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. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCC_Task_Sleep Actual task sleep function *//* *//* INPUTS *//* *//* ticks Number of ticks to sleep for *//* *//* OUTPUTS *//* *//* None *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 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 zero, return */ if (ticks == 0) return; /* 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 task sleep routine. Otherwise, ignore the request. */ if ((task) && (task -> tc_id == TC_TASK_ID)) /* Valid request, call the sleep function. */ TCC_Task_Sleep(ticks);}/*************************************************************************//* *//* FUNCTION *//* *//* TCCE_Suspend_Error *//* *//* DESCRIPTION *//* *//* This function checks for a suspend request error. Suspension *//* requests are only allowed from task threads. A suspend request *//* from any other thread is an error. *//* *//* CALLED BY *//* *//* Other Components *//* *//* CALLS *//* *//* None *//* *//* INPUTS *//* *//* None *//* *//* OUTPUTS *//* *//* NU_TRUE If an error is detected *//* NU_FALSE If no error is detected *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* *//*************************************************************************/INT TCCE_Suspend_Error(VOID){TC_TCB *task; /* Task pointer */INT status = NU_FALSE; /* Initialize to no error */ /* Setup the task pointer. */ task = (TC_TCB *) TCD_Current_Thread; /* Check for suspension errors. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -