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

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

?? blockq.c

?? 最新版FreeRTOS, 包擴(kuò)多種開(kāi)發(fā)平臺(tái)的移植
?? C
字號(hào):
/*
	FreeRTOS.org V4.1.1 - Copyright (C) 2003-2006 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.

	***************************************************************************
	See http://www.FreeRTOS.org for documentation, latest information, license 
	and contact details.  Please ensure to read the configuration and relevant 
	port sections of the online documentation.
	***************************************************************************
*/

/**
 * 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).
 *
 * \page BlockQC blockQ.c
 * \ingroup DemoFiles
 * <HR>
 */

/*
Changes from V1.00:
	
	+ Reversed the priority and block times of the second two demo tasks so
	  they operate as per the description above.

Changes from V2.0.0

	+ Delay periods are now specified using variables and constants of
	  portTickType rather than unsigned portLONG.

Changes from V4.0.2

	+ 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"
#include "print.h"

#define blckqSTACK_SIZE		( ( unsigned portSHORT ) 128 )
#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 void vBlockingQueueProducer( void *pvParameters );

/* Task function that removes the incrementing number from a queue and checks that 
it is the expected number. */
static void vBlockingQueueConsumer( void *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 ] = { ( portSHORT ) 0, ( portSHORT ) 0, ( 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 ] = { ( portSHORT ) 0, ( portSHORT ) 0, ( 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, "QConsB1", blckqSTACK_SIZE, ( void * ) pxQueueParameters1, uxPriority, NULL );
	xTaskCreate( vBlockingQueueProducer, "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( vBlockingQueueProducer, "QProdB3", blckqSTACK_SIZE, ( void * ) pxQueueParameters3, tskIDLE_PRIORITY, NULL );
	xTaskCreate( vBlockingQueueConsumer, "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, "QProdB5", blckqSTACK_SIZE, ( void * ) pxQueueParameters5, tskIDLE_PRIORITY, NULL );
	xTaskCreate( vBlockingQueueConsumer, "QConsB6", blckqSTACK_SIZE, ( void * ) pxQueueParameters6, tskIDLE_PRIORITY, NULL );
}
/*-----------------------------------------------------------*/

static void vBlockingQueueProducer( void *pvParameters )
{
unsigned portSHORT usValue = 0;
xBlockingQueueParameters *pxQueueParameters;
const portCHAR * const pcTaskStartMsg = "Blocking queue producer started.\r\n";
const portCHAR * const pcTaskErrorMsg = "Could not post on blocking queue\r\n";
portSHORT sErrorEverOccurred = pdFALSE;

	pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;

	/* Queue a message for printing to say the task has started. */
	vPrintDisplayMessage( &pcTaskStartMsg );

	for( ;; )
	{		
		if( xQueueSend( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS )
		{
			vPrintDisplayMessage( &pcTaskErrorMsg );
			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 void vBlockingQueueConsumer( void *pvParameters )
{
unsigned portSHORT usData, usExpectedValue = 0;
xBlockingQueueParameters *pxQueueParameters;
const portCHAR * const pcTaskStartMsg = "Blocking queue consumer started.\r\n";
const portCHAR * const pcTaskErrorMsg = "Incorrect value received on blocking queue.\r\n";
portSHORT sErrorEverOccurred = pdFALSE;

	/* Queue a message for printing to say the task has started. */
	vPrintDisplayMessage( &pcTaskStartMsg );

	pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;

	for( ;; )
	{	
		if( xQueueReceive( pxQueueParameters->xQueue, &usData, pxQueueParameters->xBlockTime ) == pdPASS )
		{
			if( usData != usExpectedValue )
			{
				vPrintDisplayMessage( &pcTaskErrorMsg );

				/* 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 ] = { ( portSHORT ) 0, ( portSHORT ) 0, ( portSHORT ) 0 };
static portSHORT sLastBlockingProducerCount[ blckqNUM_TASK_SETS ] = { ( portSHORT ) 0, ( portSHORT ) 0, ( 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 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;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品视频在线免费观看| 久久亚区不卡日本| 久久99精品国产麻豆婷婷洗澡| 一区二区三区国产精品| 在线综合+亚洲+欧美中文字幕| 国产主播一区二区| 亚洲欧美日韩国产综合在线| 6080国产精品一区二区| 高清国产一区二区三区| 亚洲丶国产丶欧美一区二区三区| 久久伊人中文字幕| 欧美性生活久久| 国产一区二区三区免费看| 一区二区三区中文在线观看| 日本电影欧美片| 国产一区二区调教| 一色桃子久久精品亚洲| 91精品国产综合久久精品麻豆| 成人av网站在线观看| 美女免费视频一区二区| 亚洲精品中文在线| 久久久久久久国产精品影院| 欧美精品777| 99久久综合国产精品| 美女久久久精品| 亚洲一区二区三区自拍| 欧美国产日本韩| 日韩午夜激情电影| 欧美性极品少妇| 99在线热播精品免费| 国模大尺度一区二区三区| 亚洲成a人v欧美综合天堂下载| 亚洲国产电影在线观看| 欧美日韩激情一区二区| 91免费在线视频观看| 国产成人免费视频| 亚洲r级在线视频| 亚洲人成伊人成综合网小说| 国产日本一区二区| 欧美福利视频一区| 欧洲亚洲精品在线| 色婷婷久久久亚洲一区二区三区| 国产风韵犹存在线视精品| 麻豆精品久久久| 日本中文在线一区| 亚洲国产视频在线| 一区二区日韩av| 亚洲男人的天堂网| 国产精品电影院| 国产精品美女久久久久久久久久久| 欧美精品 国产精品| 欧美午夜在线观看| 欧美性一二三区| 欧美性受极品xxxx喷水| 欧美性色黄大片| 欧美日本精品一区二区三区| 欧美日韩在线观看一区二区| 在线一区二区三区做爰视频网站| 成人在线视频首页| 粉嫩高潮美女一区二区三区| 国产白丝网站精品污在线入口| 国产麻豆视频一区二区| 国产一区二区三区精品欧美日韩一区二区三区 | 最新热久久免费视频| 久久久久久久久伊人| 久久久精品中文字幕麻豆发布| 欧美一区二区三区视频在线| 欧美午夜理伦三级在线观看| 色综合久久99| 欧美亚男人的天堂| 欧美一区二区三区思思人| 精品久久久久一区二区国产| 337p日本欧洲亚洲大胆色噜噜| 2019国产精品| 国产精品电影一区二区三区| 亚洲黄色尤物视频| 日韩高清在线观看| 免费亚洲电影在线| 国模少妇一区二区三区| 成人高清在线视频| 在线免费观看不卡av| 91精品国模一区二区三区| 久久一日本道色综合| 国产精品伦一区| 亚洲小说欧美激情另类| 久久精品av麻豆的观看方式| 国产xxx精品视频大全| 色综合久久88色综合天天免费| 91色.com| 欧美日韩精品一区二区天天拍小说 | 亚洲中国最大av网站| 亚洲卡通欧美制服中文| 午夜精品一区二区三区三上悠亚| 五月激情综合色| 精品综合久久久久久8888| 丁香桃色午夜亚洲一区二区三区| 色哟哟国产精品免费观看| 欧美高清视频www夜色资源网| www激情久久| 国产精品久久久久婷婷| 亚洲免费观看高清完整版在线观看熊| 亚洲自拍偷拍网站| 久久99国产精品久久| 99久久精品99国产精品| 日韩欧美电影一二三| 国产精品美女久久久久aⅴ| 午夜视频在线观看一区二区| 国产精品一区三区| 欧美性猛交xxxxxx富婆| 国产午夜精品一区二区三区视频 | 免费观看日韩电影| 91香蕉视频mp4| 精品久久人人做人人爽| 亚洲精品高清视频在线观看| 老司机精品视频导航| 成人h精品动漫一区二区三区| 欧美一二区视频| 亚洲综合在线观看视频| 国产一区二区美女| 欧美性一级生活| 国产精品进线69影院| 极品少妇xxxx精品少妇| 精品视频一区 二区 三区| 国产目拍亚洲精品99久久精品| 蜜桃精品视频在线| 欧美日韩欧美一区二区| 国产精品青草综合久久久久99| 视频在线观看国产精品| 成人免费av在线| 国产夜色精品一区二区av| 日本不卡免费在线视频| 国产精品77777竹菊影视小说| 7777精品伊人久久久大香线蕉经典版下载 | 免费在线观看不卡| 欧美日韩在线播放| 久久精品在线观看| 亚洲成av人片在线观看| 国产尤物一区二区在线| 91麻豆精品国产自产在线观看一区 | 日本成人在线看| 欧美日韩国产首页| 一区二区在线观看av| 成人一级片在线观看| 久久只精品国产| 精品中文字幕一区二区| 日韩无一区二区| 一区二区欧美视频| 成人美女视频在线观看18| 久久久久久久综合日本| 国产一区二区剧情av在线| 欧美成人a在线| 日本中文字幕不卡| 日韩美女在线视频| 久久国产综合精品| 日韩免费一区二区| 国产精品69久久久久水密桃| 久久这里只有精品6| 国产精品一区二区无线| 久久综合99re88久久爱| 国产精品一区在线观看乱码| 国产欧美一区二区精品忘忧草| 国产麻豆一精品一av一免费| 综合亚洲深深色噜噜狠狠网站| 色成人在线视频| 捆绑调教美女网站视频一区| 日本一区二区三区电影| 91福利在线看| 美女任你摸久久| 中文字幕一区二区5566日韩| 欧美亚洲高清一区二区三区不卡| 精品一区二区影视| 国产精品成人在线观看| 欧美精品三级日韩久久| 国产乱子轮精品视频| 亚洲免费色视频| 精品久久久久99| 一本色道a无线码一区v| 青青草97国产精品免费观看 | 亚洲人成精品久久久久| 日韩一卡二卡三卡四卡| av高清久久久| 蜜臀av性久久久久蜜臀av麻豆| 国产精品久久久久久久蜜臀| 在线成人av影院| 99视频超级精品| 狠狠色丁香婷婷综合| 亚洲国产精品自拍| 国产日韩精品一区| 777奇米四色成人影色区| av一本久道久久综合久久鬼色| 日韩电影在线一区二区三区| 成人欧美一区二区三区在线播放| 欧美α欧美αv大片| 色婷婷狠狠综合| 国产成人av一区二区三区在线观看| 亚洲一区二区三区精品在线| 国产免费久久精品| 欧美一级免费观看| 欧美专区日韩专区| av在线不卡免费看|