lpc2138嵌入式uC/OS信号量的问题?

发布网友

我来回答

2个回答

热心网友

OSSemPost()结束前会引发一次调度OS_Sched(),选择就绪表中优先级最高的任务运行,如果任务1的优先级高,会运行任务1,实时操作系统的任务都会被及时运行

void OSSemPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif

if (OSIntNesting > 0) { /* See if called from ISR ... */
*err = OS_ERR_PEND_ISR; /* ... can't PEND from an ISR */
return;
}
#if OS_ARG_CHK_EN > 0
if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
*err = OS_ERR_PEVENT_NULL;
return;
}
if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
*err = OS_ERR_EVENT_TYPE;
return;
}
#endif
OS_ENTER_CRITICAL();
if (pevent->OSEventCnt > 0) { /* If sem. is positive, resource available ... */
pevent->OSEventCnt--; /* ... decrement semaphore only if positive. */
OS_EXIT_CRITICAL();
*err = OS_NO_ERR;
return;
}
/* Otherwise, must wait until event occurs */
OSTCBCur->OSTCBStat |= OS_STAT_SEM; /* Resource not available, pend on semaphore */
OSTCBCur->OSTCBDly = timeout; /* Store pend timeout in TCB */
OS_EventTaskWait(pevent); /* Suspend task until event or timeout occurs */
OS_EXIT_CRITICAL();
OS_Sched(); /* Find next highest priority task ready */
OS_ENTER_CRITICAL();
if (OSTCBCur->OSTCBStat & OS_STAT_SEM) { /* Must have timed out if still waiting for event*/
OS_EventTO(pevent);
OS_EXIT_CRITICAL();
*err = OS_TIMEOUT; /* Indicate that didn't get event within TO */
return;
}
OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;
OS_EXIT_CRITICAL();
*err = OS_NO_ERR;
}

热心网友

Summary of financial and accounting department

Chinese papers League finishing. Summary of financial and accounting department GHD gl?tteisen, the Associated Press in the provinces in the inter-bank bond market to buy bonds ***** million, while the Associated Press concted with the provincial inter-bank short-term funds, and increase efficiency in the use of funds.
Fourth, the application of special central bank bills issued
** million to further deepen the reform of rural credit cooperatives, financial support for the effective use of the country policy, according to the state treasury Home [XX] 15 number) and the People's Bank of China, #] 4) spirit of the document in the first quarter to develop a proction of nuclear data, while the capital increase our capital, and to take measures to clear income and lower non-performing loans issued in the second quarter, the central bank successfully applied for special notes ** million, and in the second quarter reached to apply for a redemption conditions.
five full capital and enhance their business strength and ability to resist risks.
rural credit cooperatives under the Jin **** million, effectively supporting the local economic development, strengthening of the 2 pages, current page 1 1 2

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com