亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? os_sem.c

?? 基于S3C44B0X的ucosii,穩(wěn)定版 基于S3C44B0X的ucosii,穩(wěn)定版
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                          SEMAPHORE MANAGEMENT
*
*                          (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_SEM.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

#if OS_SEM_EN > 0
/*
*********************************************************************************************************
*                                           ACCEPT SEMAPHORE
*
* Description: This function checks the semaphore to see if a resource is available or, if an event
*              occurred.  Unlike OSSemPend(), OSSemAccept() does not suspend the calling task if the
*              resource is not available or the event did not occur.
*
* Arguments  : pevent     is a pointer to the event control block
*
* Returns    : >  0       if the resource is available or the event did not occur the semaphore is
*                         decremented to obtain the resource.
*              == 0       if the resource is not available or the event did not occur or,
*                         if 'pevent' is a NULL pointer or,
*                         if you didn't pass a pointer to a semaphore
*********************************************************************************************************
*/

#if OS_SEM_ACCEPT_EN > 0
INT16U  OSSemAccept (OS_EVENT *pevent)
{
#if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    OS_CPU_SR  cpu_sr;
#endif    
    INT16U     cnt;


#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
        return (0);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
        return (0);
    }
#endif
    OS_ENTER_CRITICAL();
    cnt = pevent->OSEventCnt;
    if (cnt > 0) {                                    /* See if resource is available                  */
        pevent->OSEventCnt--;                         /* Yes, decrement semaphore and notify caller    */
    }
    OS_EXIT_CRITICAL();
    return (cnt);                                     /* Return semaphore count                        */
}
#endif    

/*$PAGE*/
/*
*********************************************************************************************************
*                                           CREATE A SEMAPHORE
*
* Description: This function creates a semaphore.
*
* Arguments  : cnt           is the initial value for the semaphore.  If the value is 0, no resource is
*                            available (or no event has occurred).  You initialize the semaphore to a
*                            non-zero value to specify how many resources are available (e.g. if you have
*                            10 resources, you would initialize the semaphore to 10).
*
* Returns    : != (void *)0  is a pointer to the event control clock (OS_EVENT) associated with the
*                            created semaphore
*              == (void *)0  if no event control blocks were available
*********************************************************************************************************
*/

OS_EVENT  *OSSemCreate (INT16U cnt)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;
#endif    
    OS_EVENT  *pevent;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        return ((OS_EVENT *)0);                            /* ... can't CREATE from an ISR             */
    }
    OS_ENTER_CRITICAL();
    pevent = OSEventFreeList;                              /* Get next free event control block        */
    if (OSEventFreeList != (OS_EVENT *)0) {                /* See if pool of free ECB pool was empty   */
        OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
    }
    OS_EXIT_CRITICAL();
    if (pevent != (OS_EVENT *)0) {                         /* Get an event control block               */
        pevent->OSEventType = OS_EVENT_TYPE_SEM;
        pevent->OSEventCnt  = cnt;                         /* Set semaphore value                      */
        OS_EventWaitListInit(pevent);
    }
    return (pevent);
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                         DELETE A SEMAPHORE
*
* Description: This function deletes a semaphore and readies all tasks pending on the semaphore.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired
*                            semaphore.
*
*              opt           determines delete options as follows:
*                            opt == OS_DEL_NO_PEND   Delete semaphore ONLY if no task pending
*                            opt == OS_DEL_ALWAYS    Deletes the semaphore even if tasks are waiting.
*                                                    In this case, all the tasks pending will be readied.
*
*              err           is a pointer to an error code that can contain one of the following values:
*                            OS_NO_ERR               The call was successful and the semaphore was deleted
*                            OS_ERR_DEL_ISR          If you attempted to delete the semaphore from an ISR
*                            OS_ERR_INVALID_OPT      An invalid option was specified
*                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the semaphore
*                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a semaphore
*                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
*
* Returns    : pevent        upon error
*              (OS_EVENT *)0 if the semaphore was successfully deleted.
*
* Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
*                 the semaphore MUST check the return code of OSSemPend().
*              2) OSSemAccept() callers will not know that the intended semaphore has been deleted unless
*                 they check 'pevent' to see that it's a NULL pointer.
*              3) This call can potentially disable interrupts for a long time.  The interrupt disable
*                 time is directly proportional to the number of tasks waiting on the semaphore.
*              4) Because ALL tasks pending on the semaphore will be readied, you MUST be careful in
*                 applications where the semaphore is used for mutual exclusion because the resource(s)
*                 will no longer be guarded by the semaphore.
*********************************************************************************************************
*/

#if OS_SEM_DEL_EN > 0
OS_EVENT  *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;
#endif    
    BOOLEAN    tasks_waiting;


    if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
        *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
        return (pevent);
    }
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
        *err = OS_ERR_PEVENT_NULL;
        return (pevent);
    }
    if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
#endif
    OS_ENTER_CRITICAL();
    if (pevent->OSEventGrp != 0x00) {                      /* See if any tasks waiting on semaphore    */
        tasks_waiting = TRUE;                              /* Yes                                      */
    } else {
        tasks_waiting = FALSE;                             /* No                                       */
    }
    switch (opt) {
        case OS_DEL_NO_PEND:                               /* Delete semaphore only if no task waiting */
             if (tasks_waiting == FALSE) {
                 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
                 pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
                 OSEventFreeList     = pevent;             /* Get next free event control block        */
                 OS_EXIT_CRITICAL();
                 *err = OS_NO_ERR;
                 return ((OS_EVENT *)0);                   /* Semaphore has been deleted               */
             } else {
                 OS_EXIT_CRITICAL();
                 *err = OS_ERR_TASK_WAITING;
                 return (pevent);
             }

        case OS_DEL_ALWAYS:                                /* Always delete the semaphore              */
             while (pevent->OSEventGrp != 0x00) {          /* Ready ALL tasks waiting for semaphore    */
                 OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM);
             }
             pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
             pevent->OSEventPtr  = OSEventFreeList;        /* Return Event Control Block to free list  */
             OSEventFreeList     = pevent;                 /* Get next free event control block        */
             OS_EXIT_CRITICAL();
             if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
                 OS_Sched();                               /* Find highest priority task ready to run  */
             }
             *err = OS_NO_ERR;
             return ((OS_EVENT *)0);                       /* Semaphore has been deleted               */

        default:
             OS_EXIT_CRITICAL();
             *err = OS_ERR_INVALID_OPT;
             return (pevent);

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美久久一二区| 欧美日韩国产成人在线免费| 欧美精品乱码久久久久久| 久久女同精品一区二区| 午夜精品一区二区三区免费视频| 成人免费看黄yyy456| 91麻豆精品国产91久久久资源速度| 国产精品国产馆在线真实露脸| 日本aⅴ亚洲精品中文乱码| 日本乱人伦一区| 中文在线免费一区三区高中清不卡| 免费观看91视频大全| 欧美亚洲另类激情小说| 亚洲欧洲性图库| 国产精品456露脸| 日韩久久久久久| 午夜欧美电影在线观看| 久久久精品免费观看| 人人精品人人爱| 欧美日韩一区二区三区免费看| 国产精品久久久久久久蜜臀| 国产麻豆视频精品| 精品国产区一区| 蜜桃精品在线观看| 5566中文字幕一区二区电影 | 波多野结衣在线aⅴ中文字幕不卡| 在线播放/欧美激情| 亚洲一区二区三区视频在线| 91免费观看视频在线| 国产精品久久久久精k8| 国产成人av电影免费在线观看| 精品电影一区二区| 麻豆精品国产91久久久久久 | 成人丝袜18视频在线观看| 久久夜色精品国产噜噜av| 黄色日韩网站视频| 欧美精品一区二区三区蜜桃视频| 久久国产精品露脸对白| 日韩三级高清在线| 精品在线播放免费| 精品免费国产二区三区 | 夜夜亚洲天天久久| 91福利区一区二区三区| 一区二区理论电影在线观看| 在线观看亚洲精品视频| 亚洲电影在线免费观看| 欧美日韩在线一区二区| 丝袜亚洲另类欧美| 欧美一区二区国产| 久久99这里只有精品| 精品国产伦理网| 国产在线不卡视频| 国产精品午夜免费| 97国产一区二区| 亚洲韩国精品一区| 91精品国产综合久久久久久久久久 | 337p粉嫩大胆色噜噜噜噜亚洲| 韩国成人在线视频| 国产免费久久精品| 91在线码无精品| 亚洲h精品动漫在线观看| 91精品欧美福利在线观看| 精品中文字幕一区二区小辣椒 | 91久久人澡人人添人人爽欧美| 一区二区三区中文字幕在线观看| 91成人看片片| 日本免费新一区视频| 欧美精品一区二区三| 成人精品高清在线| 亚洲精品视频在线| 欧美一区在线视频| 国产suv一区二区三区88区| 亚洲美女屁股眼交| 51午夜精品国产| 国产精品91一区二区| 综合久久久久久| 91精品国产全国免费观看| 国产九色精品成人porny| 亚洲视频1区2区| 91精品国产aⅴ一区二区| 国产sm精品调教视频网站| 一区二区三区免费| 亚洲精品在线一区二区| 91在线观看成人| 奇米888四色在线精品| 中文在线一区二区| 欧美日韩aaaaaa| 国产成人亚洲综合a∨婷婷图片 | 国产亚洲精品aa| 欧美亚洲日本一区| 国产精品一区三区| 亚洲综合无码一区二区| 精品捆绑美女sm三区| 色婷婷香蕉在线一区二区| 久久99深爱久久99精品| 亚洲精品视频一区| 精品日韩成人av| 91黄视频在线| 国产老妇另类xxxxx| 亚洲a一区二区| 久久精品人人爽人人爽| 欧美日韩一区在线观看| 国产电影一区二区三区| 五月婷婷久久综合| 日韩一区中文字幕| 精品国产91亚洲一区二区三区婷婷| 色素色在线综合| 国产高清不卡一区二区| 日韩和欧美的一区| 专区另类欧美日韩| 久久女同精品一区二区| 7777精品伊人久久久大香线蕉完整版 | 91浏览器在线视频| 久久不见久久见免费视频1| 日韩美女啊v在线免费观看| 精品久久久久久无| 欧美蜜桃一区二区三区| jizz一区二区| 国产高清亚洲一区| 麻豆精品国产传媒mv男同| 亚洲一区二区精品3399| 国产精品福利一区| 久久蜜桃av一区精品变态类天堂| 欧美日韩国产天堂| 色猫猫国产区一区二在线视频| 国产成人精品网址| 极品少妇xxxx精品少妇偷拍| 日韩电影免费在线看| 亚洲美女偷拍久久| 中文字幕亚洲在| 日本一区二区三区久久久久久久久不| 91精品国产乱| 欧美日韩国产经典色站一区二区三区| gogo大胆日本视频一区| 国产成人午夜电影网| 精品一区二区三区在线播放视频| 亚洲gay无套男同| 亚洲亚洲人成综合网络| 亚洲人成精品久久久久久| 中文字幕精品综合| 国产欧美视频一区二区| 欧美精品一区男女天堂| 日韩欧美一级精品久久| 91麻豆精品国产91久久久| 欧美日韩黄色一区二区| 欧美日韩精品福利| 欧美色图天堂网| 在线看国产一区| 欧美综合欧美视频| 91豆麻精品91久久久久久| 91片在线免费观看| 99国产精品久久| 色偷偷久久一区二区三区| 91日韩一区二区三区| 91蝌蚪porny| 色婷婷综合久久久中文一区二区| 91丨九色丨尤物| 91成人网在线| 欧美三级乱人伦电影| 欧美精品丝袜中出| 日韩一区二区三区四区| 欧美大白屁股肥臀xxxxxx| 精品国产乱子伦一区| 国产亚洲综合在线| 国产精品久久久久毛片软件| 国产精品久久久久久久裸模| 中文字幕一区二区三区四区不卡| 国产精品国产三级国产有无不卡 | 亚洲一区二区三区视频在线播放| 亚洲专区一二三| 亚洲成av人**亚洲成av**| 午夜精品久久久久久久99水蜜桃| 午夜精品福利视频网站| 人人狠狠综合久久亚洲| 黄网站免费久久| 成人免费毛片嘿嘿连载视频| 99精品视频一区二区| 欧美亚洲愉拍一区二区| 欧美精品自拍偷拍| 欧美不卡123| 国产精品天美传媒沈樵| 亚洲乱码国产乱码精品精的特点| 一区二区三区.www| 青青青伊人色综合久久| 精品一区在线看| 成人精品gif动图一区| 欧美在线一区二区| 欧美一区二区性放荡片| 久久网站最新地址| 亚洲欧洲日韩女同| 香蕉成人啪国产精品视频综合网| 老司机精品视频导航| 成人免费观看视频| 欧美三级视频在线播放| 欧美成人r级一区二区三区| 国产农村妇女毛片精品久久麻豆| 一区二区不卡在线视频 午夜欧美不卡在 | 日韩一区二区三区视频| 亚洲国产成人一区二区三区| 伊人一区二区三区|