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

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

?? os_sem.c

?? 此文件為uCOS-II下錄音放音實(shí)驗(yàn)(原創(chuàng))
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                          SEMAPHORE MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_SEM.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.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)
{
    INT16U     cnt;
#if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                       /* Prevent compiler warning                      */
#endif    
#if OS_ARG_CHK_EN > 0
    if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
        return (0);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
        return (0);
    }
    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)
{
    OS_EVENT  *pevent;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                            /* Prevent compiler warning                 */
#endif    
    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                      */
        pevent->OSEventPtr     = (void *)0;                /* Unlink from ECB free list                */
#if OS_EVENT_NAME_SIZE > 1
        pevent->OSEventName[0] = '?';                      /* Unknown name                             */
        pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
        OS_EventWaitListInit(pevent);                      /* Initialize to 'nobody waiting' on sem.   */
    }
    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)
{
    BOOLEAN    tasks_waiting;
#if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                            /* Prevent compiler warning                 */
#endif    
    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);
    }
#endif
    if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
        *err = OS_ERR_EVENT_TYPE;
        return (pevent);
    }
    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) {
#if OS_EVENT_NAME_SIZE > 1
                 pevent->OSEventName[0] = '?';             /* Unknown name                             */
                 pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
                 pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
                 pevent->OSEventPtr     = OSEventFreeList; /* Return Event Control Block to free list  */
                 pevent->OSEventCnt     = 0;
                 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    */
                 (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM);
             }
#if OS_EVENT_NAME_SIZE > 1
             pevent->OSEventName[0] = '?';                 /* Unknown name                             */
             pevent->OSEventName[1] = OS_ASCII_NUL;
#endif
             pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
             pevent->OSEventPtr     = OSEventFreeList;     /* Return Event Control Block to free list  */
             pevent->OSEventCnt     = 0;
             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);
    }
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                           PEND ON SEMAPHORE
*
* Description: This function waits for a semaphore.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired
*                            semaphore.
*
*              timeout       is an optional timeout period (in clock ticks).  If non-zero, your task will
*                            wait for the resource up to the amount of time specified by this argument.
*                            If you specify 0, however, your task will wait forever at the specified
*                            semaphore or, until the resource becomes available (or the event occurs).
*
*              err           is a pointer to where an error message will be deposited.  Possible error
*                            messages are:
*

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品在线看| 在线播放91灌醉迷j高跟美女| 一个色妞综合视频在线观看| 久久久久久久网| 日韩一区二区高清| 日韩天堂在线观看| 制服丝袜日韩国产| 欧美日本一区二区三区四区 | 亚洲一区av在线| 1区2区3区欧美| 久久久精品综合| 久久综合久久综合久久综合| 精品粉嫩超白一线天av| 久久综合色播五月| 中文字幕欧美日韩一区| 亚洲欧美在线观看| 亚洲一区二区三区四区在线免费观看| 一区二区三区日本| 亚洲国产精品久久一线不卡| 天堂资源在线中文精品| 日本在线不卡一区| 激情文学综合网| 成人毛片视频在线观看| 91猫先生在线| 91精品久久久久久久91蜜桃| 精品久久人人做人人爰| 国产精品网站在线观看| 亚洲人成影院在线观看| 亚洲一区在线播放| 亚洲精品ww久久久久久p站| 亚洲欧洲一区二区在线播放| 中文字幕免费不卡在线| 日韩精品在线网站| 欧美日韩国产bt| 欧美在线观看一区| 欧美亚洲国产一区在线观看网站| 懂色一区二区三区免费观看| 国产不卡在线播放| 精品一区二区三区在线视频| 蜜臀a∨国产成人精品| 日本不卡在线视频| 日本欧美一区二区| 蜜臀av性久久久久av蜜臀妖精 | 欧美视频一区二区三区在线观看| 成人的网站免费观看| 国产成人精品影视| gogogo免费视频观看亚洲一| 成人动漫一区二区在线| 日本黄色一区二区| 欧美日韩国产大片| 欧美成人vr18sexvr| 日韩免费电影网站| 欧美视频在线观看一区| 日韩三区在线观看| 欧美国产综合一区二区| 亚洲日本va午夜在线影院| 欧美在线观看视频在线| 色综合天天综合色综合av| 成人av电影在线| 精品一区二区在线看| 国产精品一区二区黑丝| 青青草国产精品亚洲专区无| 极品尤物av久久免费看| 福利91精品一区二区三区| 在线免费观看一区| 欧美一级理论性理论a| 国产日韩欧美不卡在线| 国产精品久久夜| 亚洲国产精品久久人人爱 | 欧美一区二区私人影院日本| 久久亚洲一区二区三区四区| 中文字幕一区二区三区四区不卡| 亚洲综合免费观看高清在线观看| 五月综合激情网| 九九久久精品视频| www.成人网.com| 精品久久久网站| 亚洲观看高清完整版在线观看| 六月丁香婷婷色狠狠久久| 99久久国产综合精品色伊 | 一区二区三区精品视频在线| 青青草视频一区| 在线一区二区观看| 精品国产一区二区三区四区四 | 一级女性全黄久久生活片免费| 日本视频在线一区| 91欧美激情一区二区三区成人| 国产精品一区二区三区网站| 成人三级伦理片| 日韩无一区二区| 亚洲激情校园春色| 国产999精品久久久久久| 91精品国产综合久久久蜜臀图片 | 色综合天天天天做夜夜夜夜做| 欧美tk—视频vk| 午夜久久久久久| 91国产成人在线| 亚洲天天做日日做天天谢日日欢 | 制服丝袜激情欧洲亚洲| 日韩区在线观看| 国产精品高清亚洲| 视频一区欧美精品| 国产欧美在线观看一区| 日本美女一区二区三区| 欧美三级资源在线| 自拍偷拍亚洲欧美日韩| 成人少妇影院yyyy| 欧美国产精品专区| 五月婷婷综合在线| 欧美日韩在线播放| 亚洲电影第三页| 91黄视频在线观看| 一区二区三区中文免费| 一本大道久久精品懂色aⅴ | 亚洲影院免费观看| 在线观看日韩av先锋影音电影院| 成人免费小视频| 一本一道波多野结衣一区二区| 中文字幕在线不卡一区| 99久久婷婷国产精品综合| 日韩一区在线免费观看| 一本到一区二区三区| 亚洲成a天堂v人片| 欧美日韩精品欧美日韩精品| 亚洲成av人片一区二区三区| 在线观看亚洲成人| 一区二区三区中文在线| 99久久久久免费精品国产| 精品国产免费一区二区三区四区 | 久久国产福利国产秒拍| 欧美日本一区二区三区| 天天影视涩香欲综合网| 91精品国产手机| 精品亚洲成a人| 国产女人aaa级久久久级| 不卡av免费在线观看| 亚洲欧美在线视频| 欧美午夜一区二区三区免费大片| 精品1区2区在线观看| 国产精品中文字幕一区二区三区| 中文字幕制服丝袜一区二区三区 | 麻豆精品新av中文字幕| 精品黑人一区二区三区久久| 日韩成人一区二区三区在线观看| 91精品国产综合久久久久久久久久 | 激情综合色播激情啊| 久久九九久精品国产免费直播| 99国内精品久久| 日韩激情一区二区| 久久久久久久久久久99999| 北岛玲一区二区三区四区| 国产精品天美传媒沈樵| 99r国产精品| 一区二区三区91| 精品国一区二区三区| 99久久er热在这里只有精品15| 天堂午夜影视日韩欧美一区二区| 日韩一区二区影院| 色94色欧美sute亚洲线路一久| 美女一区二区三区在线观看| 国产精品网站在线| 日韩欧美中文字幕精品| 一本一道久久a久久精品| 国产一区二区三区不卡在线观看 | 亚洲欧美另类久久久精品2019| 欧美三级日韩在线| 国产不卡一区视频| 美女尤物国产一区| 亚洲va中文字幕| 国产精品久久二区二区| 久久久噜噜噜久久中文字幕色伊伊| 91蜜桃免费观看视频| 狠狠色狠狠色综合系列| 亚洲一二三区不卡| 18欧美亚洲精品| 日本一区二区三区视频视频| 成人午夜免费视频| 国产精品免费丝袜| 欧美日韩国产影片| 青青草视频一区| 久久一区二区三区国产精品| 欧美精品精品一区| 欧美日韩一级视频| 欧美午夜精品一区二区三区| 成人毛片视频在线观看| 成人免费黄色在线| 成人精品一区二区三区中文字幕 | 国产精品久久久久久亚洲伦 | 亚洲女人****多毛耸耸8| 欧美激情艳妇裸体舞| 精品国产一区二区三区四区四 | 国产成人精品影院| 激情五月婷婷综合| 国产在线精品一区二区三区不卡| 日韩高清在线观看| 奇米精品一区二区三区在线观看 | 欧美日韩国产欧美日美国产精品| 色综合色综合色综合| 99久久国产免费看| 欧美精品一区二区三区高清aⅴ |