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

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

?? blockq.c

?? This comntains project fro IAR and AT91SAM7X256 with Free RTOS and Uip ...
?? C
字號:
/*
	FreeRTOS.org V5.1.1 - 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.
*/

/*
 * Creates six tasks that operate on three queues as follows:
 *
 * The first two tasks send and receive an incrementing number to/from a queue.
 * One task acts as a producer and the other as the consumer.  The consumer is a
 * higher priority than the producer and is set to block on queue reads.  The queue
 * only has space for one item - as soon as the producer posts a message on the
 * queue the consumer will unblock, pre-empt the producer, and remove the item.
 *
 * The second two tasks work the other way around.  Again the queue used only has
 * enough space for one item.  This time the consumer has a lower priority than the
 * producer.  The producer will try to post on the queue blocking when the queue is
 * full.  When the consumer wakes it will remove the item from the queue, causing
 * the producer to unblock, pre-empt the consumer, and immediately re-fill the
 * queue.
 *
 * The last two tasks use the same queue producer and consumer functions.  This time the queue has
 * enough space for lots of items and the tasks operate at the same priority.  The
 * producer will execute, placing items into the queue.  The consumer will start
 * executing when either the queue becomes full (causing the producer to block) or
 * a context switch occurs (tasks of the same priority will time slice).
 *
 */

/* 

Changes from V4.1.1

	+ The second set of tasks were created the wrong way around.  This has been
	  corrected.
*/


#include <stdlib.h>

/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"

/* Demo program include files. */
#include "BlockQ.h"

#define blckqSTACK_SIZE		configMINIMAL_STACK_SIZE
#define blckqNUM_TASK_SETS	( 3 )

/* Structure used to pass parameters to the blocking queue tasks. */
typedef struct BLOCKING_QUEUE_PARAMETERS
{
	xQueueHandle xQueue;					/*< The queue to be used by the task. */
	portTickType xBlockTime;				/*< The block time to use on queue reads/writes. */
	volatile portSHORT *psCheckVariable;	/*< Incremented on each successful cycle to check the task is still running. */
} xBlockingQueueParameters;

/* Task function that creates an incrementing number and posts it on a queue. */
static portTASK_FUNCTION_PROTO( vBlockingQueueProducer, pvParameters );

/* Task function that removes the incrementing number from a queue and checks that
it is the expected number. */
static portTASK_FUNCTION_PROTO( vBlockingQueueConsumer, pvParameters );

/* Variables which are incremented each time an item is removed from a queue, and
found to be the expected value.
These are used to check that the tasks are still running. */
static volatile portSHORT sBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };

/* Variable which are incremented each time an item is posted on a queue.   These
are used to check that the tasks are still running. */
static volatile portSHORT sBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };

/*-----------------------------------------------------------*/

void vStartBlockingQueueTasks( unsigned portBASE_TYPE uxPriority )
{
xBlockingQueueParameters *pxQueueParameters1, *pxQueueParameters2;
xBlockingQueueParameters *pxQueueParameters3, *pxQueueParameters4;
xBlockingQueueParameters *pxQueueParameters5, *pxQueueParameters6;
const unsigned portBASE_TYPE uxQueueSize1 = 1, uxQueueSize5 = 5;
const portTickType xBlockTime = ( portTickType ) 1000 / portTICK_RATE_MS;
const portTickType xDontBlock = ( portTickType ) 0;

	/* Create the first two tasks as described at the top of the file. */
	
	/* First create the structure used to pass parameters to the consumer tasks. */
	pxQueueParameters1 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );

	/* Create the queue used by the first two tasks to pass the incrementing number.
	Pass a pointer to the queue in the parameter structure. */
	pxQueueParameters1->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );

	/* The consumer is created first so gets a block time as described above. */
	pxQueueParameters1->xBlockTime = xBlockTime;

	/* Pass in the variable that this task is going to increment so we can check it
	is still running. */
	pxQueueParameters1->psCheckVariable = &( sBlockingConsumerCount[ 0 ] );
		
	/* Create the structure used to pass parameters to the producer task. */
	pxQueueParameters2 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );

	/* Pass the queue to this task also, using the parameter structure. */
	pxQueueParameters2->xQueue = pxQueueParameters1->xQueue;

	/* The producer is not going to block - as soon as it posts the consumer will
	wake and remove the item so the producer should always have room to post. */
	pxQueueParameters2->xBlockTime = xDontBlock;

	/* Pass in the variable that this task is going to increment so we can check
	it is still running. */
	pxQueueParameters2->psCheckVariable = &( sBlockingProducerCount[ 0 ] );


	/* Note the producer has a lower priority than the consumer when the tasks are
	spawned. */
	xTaskCreate( vBlockingQueueConsumer, ( signed portCHAR * ) "QConsB1", blckqSTACK_SIZE, ( void * ) pxQueueParameters1, uxPriority, NULL );
	xTaskCreate( vBlockingQueueProducer, ( signed portCHAR * ) "QProdB2", blckqSTACK_SIZE, ( void * ) pxQueueParameters2, tskIDLE_PRIORITY, NULL );

	

	/* Create the second two tasks as described at the top of the file.   This uses
	the same mechanism but reverses the task priorities. */

	pxQueueParameters3 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
	pxQueueParameters3->xQueue = xQueueCreate( uxQueueSize1, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
	pxQueueParameters3->xBlockTime = xDontBlock;
	pxQueueParameters3->psCheckVariable = &( sBlockingProducerCount[ 1 ] );

	pxQueueParameters4 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
	pxQueueParameters4->xQueue = pxQueueParameters3->xQueue;
	pxQueueParameters4->xBlockTime = xBlockTime;
	pxQueueParameters4->psCheckVariable = &( sBlockingConsumerCount[ 1 ] );

	xTaskCreate( vBlockingQueueConsumer, ( signed portCHAR * ) "QProdB3", blckqSTACK_SIZE, ( void * ) pxQueueParameters3, tskIDLE_PRIORITY, NULL );
	xTaskCreate( vBlockingQueueProducer, ( signed portCHAR * ) "QConsB4", blckqSTACK_SIZE, ( void * ) pxQueueParameters4, uxPriority, NULL );



	/* Create the last two tasks as described above.  The mechanism is again just
	the same.  This time both parameter structures are given a block time. */
	pxQueueParameters5 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
	pxQueueParameters5->xQueue = xQueueCreate( uxQueueSize5, ( unsigned portBASE_TYPE ) sizeof( unsigned portSHORT ) );
	pxQueueParameters5->xBlockTime = xBlockTime;
	pxQueueParameters5->psCheckVariable = &( sBlockingProducerCount[ 2 ] );

	pxQueueParameters6 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );
	pxQueueParameters6->xQueue = pxQueueParameters5->xQueue;
	pxQueueParameters6->xBlockTime = xBlockTime;
	pxQueueParameters6->psCheckVariable = &( sBlockingConsumerCount[ 2 ] );	

	xTaskCreate( vBlockingQueueProducer, ( signed portCHAR * ) "QProdB5", blckqSTACK_SIZE, ( void * ) pxQueueParameters5, tskIDLE_PRIORITY, NULL );
	xTaskCreate( vBlockingQueueConsumer, ( signed portCHAR * ) "QConsB6", blckqSTACK_SIZE, ( void * ) pxQueueParameters6, tskIDLE_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/

static portTASK_FUNCTION( vBlockingQueueProducer, pvParameters )
{
unsigned portSHORT usValue = 0;
xBlockingQueueParameters *pxQueueParameters;
portSHORT sErrorEverOccurred = pdFALSE;

	pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;

	for( ;; )
	{		
		if( xQueueSend( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS )
		{
			sErrorEverOccurred = pdTRUE;
		}
		else
		{
			/* We have successfully posted a message, so increment the variable
			used to check we are still running. */
			if( sErrorEverOccurred == pdFALSE )
			{
				( *pxQueueParameters->psCheckVariable )++;
			}

			/* Increment the variable we are going to post next time round.  The
			consumer will expect the numbers to	follow in numerical order. */
			++usValue;
		}
	}
}
/*-----------------------------------------------------------*/

static portTASK_FUNCTION( vBlockingQueueConsumer, pvParameters )
{
unsigned portSHORT usData, usExpectedValue = 0;
xBlockingQueueParameters *pxQueueParameters;
portSHORT sErrorEverOccurred = pdFALSE;

	pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;

	for( ;; )
	{	
		if( xQueueReceive( pxQueueParameters->xQueue, &usData, pxQueueParameters->xBlockTime ) == pdPASS )
		{
			if( usData != usExpectedValue )
			{
				/* Catch-up. */
				usExpectedValue = usData;

				sErrorEverOccurred = pdTRUE;
			}
			else
			{
				/* We have successfully received a message, so increment the
				variable used to check we are still running. */	
				if( sErrorEverOccurred == pdFALSE )
				{
					( *pxQueueParameters->psCheckVariable )++;
				}
							
				/* Increment the value we expect to remove from the queue next time
				round. */
				++usExpectedValue;
			}			
		}		
	}
}
/*-----------------------------------------------------------*/

/* This is called to check that all the created tasks are still running. */
portBASE_TYPE xAreBlockingQueuesStillRunning( void )
{
static portSHORT sLastBlockingConsumerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
static portSHORT sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0, ( unsigned portSHORT ) 0 };
portBASE_TYPE xReturn = pdPASS, xTasks;

	/* Not too worried about mutual exclusion on these variables as they are 16
	bits and we are only reading them. We also only care to see if they have
	changed or not.
	
	Loop through each check variable to and return pdFALSE if any are found not
	to have changed since the last call. */

	for( xTasks = 0; xTasks < blckqNUM_TASK_SETS; xTasks++ )
	{
		if( sBlockingConsumerCount[ xTasks ] == sLastBlockingConsumerCount[ xTasks ]  )
		{
			xReturn = pdFALSE;
		}
		sLastBlockingConsumerCount[ xTasks ] = sBlockingConsumerCount[ xTasks ];


		if( sBlockingProducerCount[ xTasks ] == sLastBlockingProducerCount[ xTasks ]  )
		{
			xReturn = pdFALSE;
		}
		sLastBlockingProducerCount[ xTasks ] = sBlockingProducerCount[ xTasks ];
	}

	return xReturn;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产伦理网| 成人精品免费看| 国产精品一区二区不卡| 成人性视频免费网站| 欧美亚洲高清一区二区三区不卡| 91.xcao| 久久久久成人黄色影片| 亚洲婷婷综合久久一本伊一区| 亚洲丶国产丶欧美一区二区三区| 麻豆精品国产传媒mv男同| 成人性视频网站| 欧美精品777| 国产精品私人自拍| 午夜视频一区二区| 国产 日韩 欧美大片| 欧美日韩中文字幕一区| 久久综合九色综合97婷婷女人| 国产精品久久久久久福利一牛影视| 亚洲午夜国产一区99re久久| 韩国一区二区在线观看| 99视频一区二区| 欧美一区二区黄| 最近中文字幕一区二区三区| 免费视频最近日韩| 色一情一伦一子一伦一区| 欧美xxxxx裸体时装秀| 亚洲视频免费观看| 极品尤物av久久免费看| 欧美性猛片aaaaaaa做受| 久久久影视传媒| 午夜精品影院在线观看| 成人丝袜高跟foot| 欧美日韩你懂得| 亚洲国产高清在线| 久久精品国产99久久6| 91国在线观看| 国产精品情趣视频| 麻豆一区二区99久久久久| 色琪琪一区二区三区亚洲区| 久久久久久久久久电影| 日韩电影在线观看电影| 91视频在线观看免费| 久久九九久久九九| kk眼镜猥琐国模调教系列一区二区 | 韩国成人在线视频| 欧美日韩在线观看一区二区| 日本一区二区三区久久久久久久久不 | 免费观看成人av| 欧洲人成人精品| 国产精品国产三级国产普通话99| 久久66热re国产| 91精品国产综合久久香蕉的特点 | 国产99一区视频免费| 欧美一区二区观看视频| 午夜精品一区二区三区免费视频| 91理论电影在线观看| 中文字幕第一区第二区| 国产精品一区二区免费不卡| 日韩精品一区二区在线观看| 丝袜美腿亚洲一区| 欧美日韩国产经典色站一区二区三区 | 日本aⅴ精品一区二区三区| 欧美性色黄大片| 夜夜精品视频一区二区| 91国偷自产一区二区使用方法| 国产无人区一区二区三区| 国产最新精品免费| 久久人人爽人人爽| 国产麻豆精品久久一二三| 精品伦理精品一区| 精品一区二区在线看| 欧美成人免费网站| 久久99精品国产麻豆不卡| 日韩午夜小视频| 久久国产麻豆精品| 精品久久久久久综合日本欧美| 另类小说图片综合网| 日韩三级电影网址| 狠狠色综合日日| 久久久天堂av| 国产成人av福利| 日韩激情在线观看| 欧美一级片在线观看| 全部av―极品视觉盛宴亚洲| 欧美一二三区在线| 极品少妇xxxx精品少妇| 久久久久久久久久久久电影 | 欧美成人高清电影在线| 国内不卡的二区三区中文字幕 | 国产美女视频91| 国产精品热久久久久夜色精品三区| 成人综合在线观看| 亚洲猫色日本管| 欧美色欧美亚洲另类二区| 丝袜美腿一区二区三区| 精品电影一区二区三区| 国产成人a级片| 一区二区三区在线视频免费观看| 欧美特级限制片免费在线观看| 日本中文字幕一区二区有限公司| 欧美成人vr18sexvr| 丰满少妇久久久久久久| 一区二区三区鲁丝不卡| 欧美一区永久视频免费观看| 国产一区在线不卡| 亚洲欧美在线视频| 欧美婷婷六月丁香综合色| 麻豆精品视频在线观看视频| 国产日韩亚洲欧美综合| 色婷婷av一区| 麻豆精品视频在线| 国产精品色婷婷| 欧美日韩卡一卡二| 国产一区二区免费视频| 亚洲欧美乱综合| 日韩一级片网址| 99在线精品一区二区三区| 丝袜美腿高跟呻吟高潮一区| 久久久综合九色合综国产精品| 91一区二区在线| 蜜臀a∨国产成人精品| 国产欧美一二三区| 欧美体内she精高潮| 国产麻豆视频一区| 亚洲大片精品永久免费| 国产亚洲美州欧州综合国| 91久久久免费一区二区| 狠狠色丁香婷综合久久| 玉足女爽爽91| 久久久亚洲高清| 91久久一区二区| 国产一区日韩二区欧美三区| 亚洲综合色视频| 国产日韩精品一区二区三区 | 老司机一区二区| 亚洲精品福利视频网站| 久久久久亚洲蜜桃| 欧美福利视频一区| 99re在线视频这里只有精品| 老鸭窝一区二区久久精品| 亚洲综合免费观看高清在线观看| 国产情人综合久久777777| 777午夜精品视频在线播放| 99综合电影在线视频| 狠狠色丁香久久婷婷综合丁香| 亚洲国产精品影院| 国产精品国产三级国产aⅴ入口| 欧美一区二区不卡视频| 色婷婷国产精品久久包臀| 国产精选一区二区三区| 日韩黄色小视频| 亚洲影视在线观看| 中文字幕中文字幕一区| 久久综合九色综合97_久久久| 欧美精品99久久久**| 一本大道久久精品懂色aⅴ| 国产精品1区二区.| 久久精品国产亚洲aⅴ | 日韩欧美在线网站| 欧美三级日韩在线| 色呦呦网站一区| 99久久综合色| 成人高清视频免费观看| 国产乱子伦视频一区二区三区| 久久精品噜噜噜成人88aⅴ | 日韩免费电影一区| 欧美精品777| 欧美日韩国产美| 欧美综合亚洲图片综合区| 91色porny在线视频| 不卡的av在线| 成人精品小蝌蚪| 成人免费毛片片v| 国产91精品露脸国语对白| 国产在线不卡一区| 韩国三级电影一区二区| 日本aⅴ精品一区二区三区| 日韩成人dvd| 日本亚洲欧美天堂免费| 三级欧美在线一区| 日韩不卡手机在线v区| 日韩精品亚洲一区二区三区免费| 亚洲成人动漫av| 水野朝阳av一区二区三区| 亚洲大型综合色站| 天堂一区二区在线| 日本亚洲免费观看| 久久国产日韩欧美精品| 狠狠色狠狠色合久久伊人| 激情偷乱视频一区二区三区| 久久精品99久久久| 加勒比av一区二区| 国产成人综合亚洲91猫咪| 成人午夜视频福利| 不卡的av在线播放| 91黄色免费看| 欧美精品xxxxbbbb| 久久中文字幕电影| 中文字幕第一区综合| 亚洲免费在线电影|