大学生
最后登录1970-1-1
在线时间 小时
注册时间2015-1-23
|
本帖最后由 liuchang 于 2015-7-13 15:47 编辑
如下为ucos_iii的一段源码,恳请大神指教~~~
void OSSemCreate (OS_SEM *p_sem,
CPU_CHAR *p_name,
OS_SEM_CTR cnt,
OS_ERR *p_err)
{
CPU_SR_ALLOC();
#ifdef OS_SAFETY_CRITICAL /*问题1:OS_SAFETY_CRITICAL是什么意思?*/
if (p_err == (OS_ERR *)0) {
OS_SAFETY_CRITICAL_EXCEPTION();
return;
}
#endif
#ifdef OS_SAFETY_CRITICAL_IEC61508 /*问题2:OS_SAFETY_CRITICAL_IEC61508是什么意思?*/
if (OSSafetyCriticalStartFlag == DEF_TRUE) {
*p_err = OS_ERR_ILLEGAL_CREATE_RUN_TIME;
return;
}
#endif
#if OS_CFG_CALLED_FROM_ISR_CHK_EN > 0u
if (OSIntNestingCtr > (OS_NESTING_CTR)0) {
*p_err = OS_ERR_CREATE_ISR;
return;
}
#endif
#if OS_CFG_ARG_CHK_EN > 0u
if (p_sem == (OS_SEM *)0) {
*p_err = OS_ERR_OBJ_PTR_NULL;
return;
}
#endif
CPU_CRITICAL_ENTER();
p_sem->Type = OS_OBJ_TYPE_SEM;
p_sem->Ctr = cnt;
p_sem->TS = (CPU_TS)0;
p_sem->NamePtr = p_name;
OS_PendListInit(&p_sem->PendList);
#if OS_CFG_DBG_EN > 0u
OS_SemDbgListAdd(p_sem);
#endif
OSSemQty++; /*问题3:OSSemQty是什么意思?Qty是什么单词的缩写???*/
CPU_CRITICAL_EXIT();
*p_err = OS_ERR_NONE;
} |
|