?? tcce.c
字號:
if (task == NU_NULL)
/* Error, suspend request probably from initialization. */
status = NU_TRUE;
else if (task -> tc_id != TC_TASK_ID)
/* Control block is probably an HISR not a task. */
status = NU_TRUE;
else if (task -> tc_signal_active)
/* Called from a signal handler. */
status = NU_TRUE;
/* Return status to caller. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Activate_HISR */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the activate HISR function. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCT_Activate_HISR Actual HISR activate call */
/* */
/* INPUTS */
/* */
/* hisr_ptr HISR control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_HISR Invalid HISR pointer */
/* */
/* 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_Activate_HISR(NU_HISR *hisr_ptr)
{
TC_HCB *hisr; /* HISR control block ptr */
STATUS status; /* Completion status */
NU_SUPERV_USER_VARIABLES
NU_SUPERVISOR_MODE();
/* Move input HISR control block pointer into internal pointer. */
hisr = (TC_HCB *) hisr_ptr;
/* Check each parameter. */
if (hisr == NU_NULL)
/* Invalid HISR control block pointer. */
status = NU_INVALID_HISR;
else if (hisr -> tc_id != TC_HISR_ID)
/* Invalid HISR control block pointer. */
status = NU_INVALID_HISR;
else
/* Call the routine to activate the HISR. */
status = TCT_Activate_HISR(hisr_ptr);
/* Return to user mode */
NU_USER_MODE();
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Validate_Resume */
/* */
/* DESCRIPTION */
/* */
/* This function validates the resume service and resume driver */
/* calls with scheduling protection around the examination of the */
/* task status. */
/* */
/* CALLED BY */
/* */
/* IOCE_Resume_Driver Driver error checking funct. */
/* TCCE_Resume_Service Error checking function */
/* */
/* CALLS */
/* */
/* TCT_Set_Current_Protect Setup current protect pointer*/
/* TCT_System_Protect Protect from system access */
/* TCT_System_Unprotect Release system protection */
/* TCT_Unprotect Release current protection */
/* */
/* INPUTS */
/* */
/* resume_type Type of resume request */
/* task_ptr Task control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_TRUE Invalid resume */
/* NU_FALSE Valid resume */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1994 Created initial version of */
/* function for version 1.0g */
/* 03-01-1994 Verified version 1.0g */
/* 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* added system protection logic, */
/* moved to TCCE since it is an */
/* error interface function, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 10-16-1996 Modified to save the current */
/* thread's protection rather */
/* than that of the task being */
/* resumed (SPR212)(SPR268) */
/* */
/*************************************************************************/
STATUS TCCE_Validate_Resume(OPTION resume_type, NU_TASK *task_ptr)
{
R1 TC_TCB *task; /* Task control block ptr */
TC_PROTECT *save_protect; /* Save current protection */
STATUS status; /* Return status variable */
NU_SUPERV_USER_VARIABLES
NU_SUPERVISOR_MODE();
/* Move input task pointer into internal pointer. */
task = (TC_TCB *) task_ptr;
/* Save current protection. */
if (TCD_Current_Thread != NU_NULL)
{
save_protect = TCT_Get_Current_Protect();
}
else
{
save_protect = NU_NULL;
}
/* Protect the scheduling structures from multiple access. */
TCT_System_Protect();
/* Does the resume type match the current status? */
if (task -> tc_status == resume_type)
/* Indicate that there is no error. */
status = NU_FALSE;
/* Check for a resumption of a delayed pure suspend. */
else if ((resume_type == NU_PURE_SUSPEND) && (task -> tc_delayed_suspend))
/* Indicate that there is no error. */
status = NU_FALSE;
/* Check for a signal active and the saved status the same as
the resume request. */
else if ((resume_type == task -> tc_saved_status) &&
(task -> tc_signal_active))
/* Indicate that there is no error. */
status = NU_FALSE;
else
/* Indicate that there is an error. */
status = NU_TRUE;
/* Determine how to get out of protection. */
if (save_protect)
{
/* Restore current protection. */
TCT_Set_Current_Protect(save_protect);
/* Release system protect. */
TCT_System_Unprotect();
}
else
/* Release protection of system structures. */
TCT_Unprotect();
/* Return to user mode */
NU_USER_MODE();
/* Return status to caller. */
return(status);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -