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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? semphr.h

?? FreeRTOS source code as bundled with the book "Using FreeRTOS Real-Time Kernel - A Practical Approac
?? H
?? 第 1 頁 / 共 2 頁
字號:
/*
	FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 Richard Barry.

	This file is part of the FreeRTOS.org distribution.

	FreeRTOS.org is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	FreeRTOS.org is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with FreeRTOS.org; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	A special exception to the GPL can be applied should you wish to distribute
	a combined work that includes FreeRTOS.org, without being obliged to provide
	the source code for any proprietary components.  See the licensing section 
	of http://www.FreeRTOS.org for full details of how and when the exception
	can be applied.

    ***************************************************************************
    ***************************************************************************
    *                                                                         *
    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *
    * and even write all or part of your application on your behalf.          *
    * See http://www.OpenRTOS.com for details of the services we provide to   *
    * expedite your project.                                                  *
    *                                                                         *
    ***************************************************************************
    ***************************************************************************

	Please ensure to read the configuration and relevant port sections of the
	online documentation.

	http://www.FreeRTOS.org - Documentation, latest information, license and 
	contact details.

	http://www.SafeRTOS.com - A version that is certified for use in safety 
	critical systems.

	http://www.OpenRTOS.com - Commercial support, development, porting, 
	licensing and training services.
*/

#ifndef INC_FREERTOS_H
	#error "#include FreeRTOS.h" must appear in source files before "#include semphr.h"
#endif

#ifndef SEMAPHORE_H
#define SEMAPHORE_H

#include "queue.h"

typedef xQueueHandle xSemaphoreHandle;

#define semBINARY_SEMAPHORE_QUEUE_LENGTH	( ( unsigned portCHAR ) 1 )
#define semSEMAPHORE_QUEUE_ITEM_LENGTH		( ( unsigned portCHAR ) 0 )
#define semGIVE_BLOCK_TIME					( ( portTickType ) 0 )


/**
 * semphr. h
 * <pre>vSemaphoreCreateBinary( xSemaphoreHandle xSemaphore )</pre>
 *
 * <i>Macro</i> that implements a semaphore by using the existing queue mechanism.
 * The queue length is 1 as this is a binary semaphore.  The data size is 0
 * as we don't want to actually store any data - we just want to know if the
 * queue is empty or full.
 *
 * This type of semaphore can be used for pure synchronisation between tasks or
 * between an interrupt and a task.  The semaphore need not be given back once
 * obtained, so one task/interrupt can continuously 'give' the semaphore while
 * another continuously 'takes' the semaphore.  For this reason this type of
 * semaphore does not use a priority inheritance mechanism.  For an alternative
 * that does use priority inheritance see xSemaphoreCreateMutex().
 *
 * @param xSemaphore Handle to the created semaphore.  Should be of type xSemaphoreHandle.
 *
 * Example usage:
 <pre>
 xSemaphoreHandle xSemaphore;

 void vATask( void * pvParameters )
 {
    // Semaphore cannot be used before a call to vSemaphoreCreateBinary ().
    // This is a macro so pass the variable in directly.
    vSemaphoreCreateBinary( xSemaphore );

    if( xSemaphore != NULL )
    {
        // The semaphore was created successfully.
        // The semaphore can now be used.  
    }
 }
 </pre>
 * \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
 * \ingroup Semaphores
 */
#define vSemaphoreCreateBinary( xSemaphore )		{																								\
														xSemaphore = xQueueCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH );	\
														if( xSemaphore != NULL )																	\
														{																							\
															xSemaphoreGive( xSemaphore );															\
														}																							\
													}

/**
 * semphr. h
 * xSemaphoreTake( 
 *                   xSemaphoreHandle xSemaphore, 
 *                   portTickType xBlockTime 
 *               )</pre>
 *
 * <i>Macro</i> to obtain a semaphore.  The semaphore must have previously been
 * created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
 * xSemaphoreCreateCounting().
 *
 * @param xSemaphore A handle to the semaphore being taken - obtained when
 * the semaphore was created.
 *
 * @param xBlockTime The time in ticks to wait for the semaphore to become
 * available.  The macro portTICK_RATE_MS can be used to convert this to a
 * real time.  A block time of zero can be used to poll the semaphore.  A block
 * time of portMAX_DELAY can be used to block indefinitely (provided
 * INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h).
 *
 * @return pdTRUE if the semaphore was obtained.  pdFALSE
 * if xBlockTime expired without the semaphore becoming available.
 *
 * Example usage:
 <pre>
 xSemaphoreHandle xSemaphore = NULL;

 // A task that creates a semaphore.
 void vATask( void * pvParameters )
 {
    // Create the semaphore to guard a shared resource.
    vSemaphoreCreateBinary( xSemaphore );
 }

 // A task that uses the semaphore.
 void vAnotherTask( void * pvParameters )
 {
    // ... Do other things.

    if( xSemaphore != NULL )
    {
        // See if we can obtain the semaphore.  If the semaphore is not available
        // wait 10 ticks to see if it becomes free.	
        if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
        {
            // We were able to obtain the semaphore and can now access the
            // shared resource.

            // ...

            // We have finished accessing the shared resource.  Release the 
            // semaphore.
            xSemaphoreGive( xSemaphore );
        }
        else
        {
            // We could not obtain the semaphore and can therefore not access
            // the shared resource safely.
        }
    }
 }
 </pre>
 * \defgroup xSemaphoreTake xSemaphoreTake
 * \ingroup Semaphores
 */
#define xSemaphoreTake( xSemaphore, xBlockTime )		xQueueGenericReceive( ( xQueueHandle ) xSemaphore, NULL, xBlockTime, pdFALSE )

/**
 * semphr. h
 * xSemaphoreTakeRecursive( 
 *                          xSemaphoreHandle xMutex, 
 *                          portTickType xBlockTime 
 *                        )
 *
 * <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.  
 * The mutex must have previously been created using a call to 
 * xSemaphoreCreateRecursiveMutex();
 * 
 * configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this
 * macro to be available.
 * 
 * This macro must not be used on mutexes created using xSemaphoreCreateMutex().
 *
 * A mutex used recursively can be 'taken' repeatedly by the owner. The mutex 
 * doesn't become available again until the owner has called 
 * xSemaphoreGiveRecursive() for each successful 'take' request.  For example, 
 * if a task successfully 'takes' the same mutex 5 times then the mutex will 
 * not be available to any other task until it has also  'given' the mutex back
 * exactly five times.
 *
 * @param xMutex A handle to the mutex being obtained.  This is the
 * handle returned by xSemaphoreCreateRecursiveMutex();
 *
 * @param xBlockTime The time in ticks to wait for the semaphore to become
 * available.  The macro portTICK_RATE_MS can be used to convert this to a
 * real time.  A block time of zero can be used to poll the semaphore.  If
 * the task already owns the semaphore then xSemaphoreTakeRecursive() will
 * return immediately no matter what the value of xBlockTime. 
 *
 * @return pdTRUE if the semaphore was obtained.  pdFALSE if xBlockTime
 * expired without the semaphore becoming available.
 *
 * Example usage:
 <pre>
 xSemaphoreHandle xMutex = NULL;

 // A task that creates a mutex.
 void vATask( void * pvParameters )
 {
    // Create the mutex to guard a shared resource.
    xMutex = xSemaphoreCreateRecursiveMutex();
 }

 // A task that uses the mutex.
 void vAnotherTask( void * pvParameters )
 {
    // ... Do other things.

    if( xMutex != NULL )
    {
        // See if we can obtain the mutex.  If the mutex is not available
        // wait 10 ticks to see if it becomes free.	
        if( xSemaphoreTakeRecursive( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
        {
            // We were able to obtain the mutex and can now access the
            // shared resource.

            // ...
            // For some reason due to the nature of the code further calls to 
			// xSemaphoreTakeRecursive() are made on the same mutex.  In real
			// code these would not be just sequential calls as this would make
			// no sense.  Instead the calls are likely to be buried inside
			// a more complex call structure.
            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
            xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );

            // The mutex has now been 'taken' three times, so will not be 
			// available to another task until it has also been given back
			// three times.  Again it is unlikely that real code would have
			// these calls sequentially, but instead buried in a more complex
			// call structure.  This is just for illustrative purposes.
            xSemaphoreGiveRecursive( xMutex );
			xSemaphoreGiveRecursive( xMutex );
			xSemaphoreGiveRecursive( xMutex );

			// Now the mutex can be taken by other tasks.
        }
        else
        {
            // We could not obtain the mutex and can therefore not access
            // the shared resource safely.
        }
    }
 }
 </pre>
 * \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
 * \ingroup Semaphores
 */
#define xSemaphoreTakeRecursive( xMutex, xBlockTime )	xQueueTakeMutexRecursive( xMutex, xBlockTime )


/* 
 * xSemaphoreAltTake() is an alternative version of xSemaphoreTake().
 *
 * The source code that implements the alternative (Alt) API is much 
 * simpler	because it executes everything from within a critical section.  
 * This is	the approach taken by many other RTOSes, but FreeRTOS.org has the 
 * preferred fully featured API too.  The fully featured API has more 
 * complex	code that takes longer to execute, but makes much less use of 
 * critical sections.  Therefore the alternative API sacrifices interrupt 
 * responsiveness to gain execution speed, whereas the fully featured API
 * sacrifices execution speed to ensure better interrupt responsiveness.
 */
#define xSemaphoreAltTake( xSemaphore, xBlockTime )		xQueueAltGenericReceive( ( xQueueHandle ) xSemaphore, NULL, xBlockTime, pdFALSE )

/**
 * semphr. h
 * <pre>xSemaphoreGive( xSemaphoreHandle xSemaphore )</pre>
 *
 * <i>Macro</i> to release a semaphore.  The semaphore must have previously been
 * created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
 * xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
 *
 * This macro must not be used from an ISR.  See xSemaphoreGiveFromISR () for
 * an alternative which can be used from an ISR.
 *
 * This macro must also not be used on semaphores created using 
 * xSemaphoreCreateRecursiveMutex().
 *
 * @param xSemaphore A handle to the semaphore being released.  This is the
 * handle returned when the semaphore was created.
 *
 * @return pdTRUE if the semaphore was released.  pdFALSE if an error occurred.
 * Semaphores are implemented using queues.  An error can occur if there is
 * no space on the queue to post a message - indicating that the 
 * semaphore was not first obtained correctly.
 *
 * Example usage:
 <pre>
 xSemaphoreHandle xSemaphore = NULL;

 void vATask( void * pvParameters )
 {
    // Create the semaphore to guard a shared resource.
    vSemaphoreCreateBinary( xSemaphore );

    if( xSemaphore != NULL )
    {
        if( xSemaphoreGive( xSemaphore ) != pdTRUE )
        {
            // We would expect this call to fail because we cannot give
            // a semaphore without first "taking" it!
        }

        // Obtain the semaphore - don't block if the semaphore is not
        // immediately available.
        if( xSemaphoreTake( xSemaphore, ( portTickType ) 0 ) )
        {
            // We now have the semaphore and can access the shared resource.

            // ...

            // We have finished accessing the shared resource so can free the
            // semaphore.
            if( xSemaphoreGive( xSemaphore ) != pdTRUE )
            {
                // We would not expect this call to fail because we must have
                // obtained the semaphore to get here.
            }
        }
    }
 }
 </pre>
 * \defgroup xSemaphoreGive xSemaphoreGive
 * \ingroup Semaphores
 */
#define xSemaphoreGive( xSemaphore )		xQueueGenericSend( ( xQueueHandle ) xSemaphore, NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )

/**
 * semphr. h
 * <pre>xSemaphoreGiveRecursive( xSemaphoreHandle xMutex )</pre>
 *
 * <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天堂影院一区二区| 欧洲精品在线观看| 色吊一区二区三区| 精品免费视频一区二区| 一区二区三区精品久久久| 国产乱一区二区| 69久久夜色精品国产69蝌蚪网| 国产精品国产三级国产专播品爱网| 日韩高清在线不卡| 在线免费观看日本一区| 欧美国产日产图区| 国内偷窥港台综合视频在线播放| 欧美日韩大陆一区二区| 亚洲色图欧美激情| 成人高清免费在线播放| 精品国产123| 日本中文字幕一区| 欧美伦理电影网| 亚洲影院理伦片| 99re亚洲国产精品| 中文字幕一区二区5566日韩| 国产在线精品一区在线观看麻豆| 欧美一区二区在线观看| 亚洲电影欧美电影有声小说| 91日韩在线专区| 国产精品久久久久一区| 成人精品视频一区| 国产亚洲精品福利| 成人成人成人在线视频| 中文字幕乱码亚洲精品一区| 成人午夜电影久久影院| 国产欧美综合色| 成人中文字幕电影| 亚洲国产成人在线| 96av麻豆蜜桃一区二区| 自拍偷拍亚洲激情| 欧美性xxxxx极品少妇| 一区二区三区在线视频观看58| 99re热这里只有精品视频| 亚洲精品欧美激情| 欧洲日韩一区二区三区| 婷婷久久综合九色综合绿巨人| 欧美丝袜第三区| 日韩黄色在线观看| 亚洲黄色小说网站| 色婷婷香蕉在线一区二区| 一区二区三区在线观看视频| 色综合天天性综合| 亚洲成人精品一区| 欧美mv日韩mv国产| 成人综合婷婷国产精品久久蜜臀 | 日本电影欧美片| 亚洲一二三区视频在线观看| 欧美三级日韩三级| 免费观看一级特黄欧美大片| 久久只精品国产| 99视频一区二区三区| 亚洲一区二区三区中文字幕| 日韩三级视频在线看| 国产sm精品调教视频网站| 中文字幕日韩一区| 欧美一级高清片| www.在线成人| 日韩国产欧美视频| 国产精品毛片无遮挡高清| 欧美性高清videossexo| 国产在线精品国自产拍免费| 国产精品理论片| 欧美一区日韩一区| 不卡av电影在线播放| 日韩精品视频网站| 亚洲色图制服诱惑| 精品日韩欧美一区二区| 99精品欧美一区| 久久国产精品色| 亚洲免费在线看| 久久综合久色欧美综合狠狠| 色狠狠av一区二区三区| 国产激情一区二区三区四区| 亚洲国产精品久久不卡毛片 | 色婷婷综合五月| 欧美视频在线播放| 狠狠色伊人亚洲综合成人| 亚洲精品你懂的| 久久久99免费| 欧美电影影音先锋| 91麻豆高清视频| 国产精品综合一区二区三区| 亚洲国产成人av| 一区免费观看视频| 国产欧美综合色| 日韩一区二区免费在线观看| 色噜噜狠狠色综合中国| 国产乱一区二区| 精品伊人久久久久7777人| 亚洲午夜久久久| 中文字幕一区二区在线观看| 欧美精品一区二区三区一线天视频| 欧美影院一区二区三区| 91最新地址在线播放| 成人午夜精品在线| 国产成人综合在线播放| 精品一区二区三区免费毛片爱| 视频一区视频二区中文| 亚洲一区二区精品视频| 亚洲女同ⅹxx女同tv| **性色生活片久久毛片| 国产欧美一区二区三区在线老狼| 精品久久五月天| 日韩一级二级三级| 91精品中文字幕一区二区三区| 91久久精品一区二区三| 色吧成人激情小说| 色哟哟亚洲精品| 色综合色综合色综合| 波多野结衣中文字幕一区二区三区| 国产盗摄视频一区二区三区| 国产成人精品免费| 成人激情校园春色| 91亚洲永久精品| 欧洲精品视频在线观看| 亚洲国产高清不卡| 最近日韩中文字幕| 亚洲精品精品亚洲| 亚洲mv在线观看| 日韩国产成人精品| 久久99精品国产.久久久久| 国产一区二区三区免费| 国产精品88av| 91丨九色丨黑人外教| 色狠狠一区二区三区香蕉| 欧美性受极品xxxx喷水| 9191成人精品久久| 久久精品视频在线免费观看| 国产精品久久午夜| 亚洲在线视频免费观看| 天天综合色天天综合| 久久国产精品无码网站| 粉嫩一区二区三区在线看| 97国产精品videossex| 欧美日韩激情一区| 久久伊人蜜桃av一区二区| 国产精品免费免费| 五月激情综合色| 国产一区二区福利视频| 99久久精品国产一区二区三区 | 欧美日韩综合在线| 日韩精品中文字幕一区 | 成人激情文学综合网| 91久久精品一区二区二区| 欧美一区二区三级| 国产精品色婷婷| 亚洲aaa精品| 成人三级伦理片| 在线不卡欧美精品一区二区三区| 精品福利视频一区二区三区| 日韩伦理av电影| 精品一二三四区| 日本精品视频一区二区| 精品日韩一区二区| 亚洲国产精品欧美一二99| 狠狠色综合播放一区二区| 色先锋久久av资源部| 久久婷婷国产综合国色天香| 亚洲国产成人精品视频| 不卡一卡二卡三乱码免费网站| 欧美视频完全免费看| 中文字幕精品三区| 蜜臀久久99精品久久久久久9| 91在线免费看| 久久午夜电影网| 蜜臂av日日欢夜夜爽一区| 色婷婷激情综合| 国产精品亲子乱子伦xxxx裸| 六月婷婷色综合| 欧美精品一二三四| 一区二区三区四区国产精品| 国产精品1024| 精品剧情v国产在线观看在线| 亚洲一区二区三区自拍| 97se亚洲国产综合在线| 亚洲国产成人午夜在线一区| 色婷婷综合五月| 最好看的中文字幕久久| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 99re这里只有精品视频首页| 久久久亚洲高清| 久久成人免费网| 欧美一区二区三区视频免费播放| 亚洲高清在线精品| 欧美性感一类影片在线播放| ㊣最新国产の精品bt伙计久久| 国产寡妇亲子伦一区二区| 精品福利一区二区三区免费视频| 日本中文字幕一区二区视频| 欧美偷拍一区二区| 亚洲国产一二三| 9191久久久久久久久久久| 午夜久久久久久久久| 91麻豆精品国产自产在线观看一区|