📄 smce.c
字号:
/* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/STATUS SMCE_Delete_Semaphore(NU_SEMAPHORE *semaphore_ptr){SM_SCB *semaphore; /* Semaphore control blk ptr */STATUS status; /* Completion status */ /* Move input semaphore pointer into internal pointer. */ semaphore = (SM_SCB *) semaphore_ptr; /* Determine if the semaphore pointer is valid. */ if ((semaphore) && (semaphore -> sm_id == SM_SEMAPHORE_ID)) /* Semaphore pointer is valid, call function to delete it. */ status = SMC_Delete_Semaphore(semaphore_ptr); else /* Semaphore pointer is invalid, indicate in completion status. */ status = NU_INVALID_SEMAPHORE; /* Return completion status. */ return(status);}/*************************************************************************//* *//* FUNCTION *//* *//* SMCE_Obtain_Semaphore *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the obtain semaphore function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* SMC_Obtain_Semaphore Actual function to obtain an *//* instance of the semaphore *//* TCCE_Suspend_Error Check for illegal suspend *//* *//* INPUTS *//* *//* semaphore_ptr Semaphore control block ptr *//* suspend Suspension option if full *//* *//* OUTPUTS *//* *//* NU_INVALID_SEMAPHORE Invalid semaphore pointer *//* NU_INVALID_SUSPEND Suspension from non-task *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Modified function interface, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/STATUS SMCE_Obtain_Semaphore(NU_SEMAPHORE *semaphore_ptr, UNSIGNED suspend){SM_SCB *semaphore; /* Semaphore control blk ptr */STATUS status; /* Completion status */ /* Move input semaphore pointer into internal pointer. */ semaphore = (SM_SCB *) semaphore_ptr; /* Determine if semaphore pointer is invalid. */ if (semaphore == NU_NULL) /* Semaphore pointer is invalid, indicate in completion status. */ status = NU_INVALID_SEMAPHORE; else if (semaphore -> sm_id != SM_SEMAPHORE_ID) /* Semaphore pointer is invalid, indicate in completion status. */ status = NU_INVALID_SEMAPHORE; else if ((suspend) && (TCCE_Suspend_Error())) /* Suspension from an non-task thread. */ status = NU_INVALID_SUSPEND; else { /* Parameters are valid, call actual function. */ status = SMC_Obtain_Semaphore(semaphore_ptr, suspend); } /* Return the completion status. */ return(status);}/*************************************************************************//* *//* FUNCTION *//* *//* SMCE_Release_Semaphore *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the release semaphore function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* SMC_Release_Semaphore Actual release semaphore fct.*//* *//* INPUTS *//* *//* semaphore_ptr Semaphore control block ptr *//* *//* OUTPUTS *//* *//* NU_INVALID_SEMAPHORE Invalid semaphore 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, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/STATUS SMCE_Release_Semaphore(NU_SEMAPHORE *semaphore_ptr){SM_SCB *semaphore; /* Semaphore control blk ptr */STATUS status; /* Completion status */ /* Move input semaphore pointer into internal pointer. */ semaphore = (SM_SCB *) semaphore_ptr; /* Determine if semaphore pointer is invalid. */ if (semaphore == NU_NULL) /* Semaphore pointer is invalid, indicate in completion status. */ status = NU_INVALID_SEMAPHORE; else if (semaphore -> sm_id != SM_SEMAPHORE_ID) /* Semaphore pointer is invalid, indicate in completion status. */ status = NU_INVALID_SEMAPHORE; else { /* Parameters are valid, call actual function. */ status = SMC_Release_Semaphore(semaphore_ptr); } /* Return the completion status. */ return(status);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -