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

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

?? crhook.c

?? 最新版FreeRTOS, 包擴(kuò)多種開發(fā)平臺的移植
?? C
字號:
/*
	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.
	***************************************************************************
*/

/*
 * This demo file demonstrates how to send data between an ISR and a 
 * co-routine.  A tick hook function is used to periodically pass data between
 * the RTOS tick and a set of 'hook' co-routines.
 *
 * hookNUM_HOOK_CO_ROUTINES co-routines are created.  Each co-routine blocks
 * to wait for a character to be received on a queue from the tick ISR, checks
 * to ensure the character received was that expected, then sends the number
 * back to the tick ISR on a different queue.
 * 
 * The tick ISR checks the numbers received back from the 'hook' co-routines 
 * matches the number previously sent.
 *
 * If at any time a queue function returns unexpectedly, or an incorrect value
 * is received either by the tick hook or a co-routine then an error is 
 * latched.
 *
 * This demo relies on each 'hook' co-routine to execute between each 
 * hookTICK_CALLS_BEFORE_POST tick interrupts.  This and the heavy use of 
 * queues from within an interrupt may result in an error being detected on 
 * slower targets simply due to timing.
 */

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "croutine.h"
#include "queue.h"

/* Demo application includes. */
#include "crhook.h"

/* The number of 'hook' co-routines that are to be created. */
#define hookNUM_HOOK_CO_ROUTINES        ( 4 )

/* The number of times the tick hook should be called before a character is 
posted to the 'hook' co-routines. */
#define hookTICK_CALLS_BEFORE_POST      ( 250 )

/* There should never be more than one item in any queue at any time. */
#define hookHOOK_QUEUE_LENGTH           ( 1 )

/* Don't block when initially posting to the queue. */
#define hookNO_BLOCK_TIME               ( 0 )

/* The priority relative to other co-routines (rather than tasks) that the
'hook' co-routines should take. */
#define mainHOOK_CR_PRIORITY			( 1 )
/*-----------------------------------------------------------*/

/*
 * The co-routine function itself.
 */
static void prvHookCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );


/*
 * The tick hook function.  This receives a number from each 'hook' co-routine
 * then sends a number to each co-routine.  An error is flagged if a send or 
 * receive fails, or an unexpected number is received.
 */
void vApplicationTickHook( void );

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

/* Queues used to send data FROM a co-routine TO the tick hook function.
The hook functions received (Rx's) on these queues.  One queue per
'hook' co-routine. */
static xQueueHandle xHookRxQueues[ hookNUM_HOOK_CO_ROUTINES ];

/* Queues used to send data FROM the tick hook TO a co-routine function.
The hood function transmits (Tx's) on these queues.  One queue per
'hook' co-routine. */
static xQueueHandle xHookTxQueues[ hookNUM_HOOK_CO_ROUTINES ];

/* Set to true if an error is detected at any time. */
static portBASE_TYPE xCoRoutineErrorDetected = pdFALSE;

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

void vStartHookCoRoutines( void )
{
unsigned portBASE_TYPE uxIndex, uxValueToPost = 0;

	for( uxIndex = 0; uxIndex < hookNUM_HOOK_CO_ROUTINES; uxIndex++ )
	{
		/* Create a queue to transmit to and receive from each 'hook' 
		co-routine. */
		xHookRxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( unsigned portBASE_TYPE ) );
		xHookTxQueues[ uxIndex ] = xQueueCreate( hookHOOK_QUEUE_LENGTH, sizeof( unsigned portBASE_TYPE ) );

		/* To start things off the tick hook function expects the queue it 
		uses to receive data to contain a value.  */
		xQueueSend( xHookRxQueues[ uxIndex ], &uxValueToPost, hookNO_BLOCK_TIME );

		/* Create the 'hook' co-routine itself. */
		xCoRoutineCreate( prvHookCoRoutine, mainHOOK_CR_PRIORITY, uxIndex );
	}
}
/*-----------------------------------------------------------*/

static unsigned portBASE_TYPE uxCallCounter = 0, uxNumberToPost = 0;
void vApplicationTickHook( void )
{
unsigned portBASE_TYPE uxReceivedNumber;
signed portBASE_TYPE xIndex, xCoRoutineWoken;

	/* Is it time to talk to the 'hook' co-routines again? */
	uxCallCounter++;
	if( uxCallCounter >= hookTICK_CALLS_BEFORE_POST )
	{
		uxCallCounter = 0;

		for( xIndex = 0; xIndex < hookNUM_HOOK_CO_ROUTINES; xIndex++ )
		{
			xCoRoutineWoken = pdFALSE;
			if( crQUEUE_RECEIVE_FROM_ISR( xHookRxQueues[ xIndex ], &uxReceivedNumber, &xCoRoutineWoken ) != pdPASS )
			{
				/* There is no reason why we would not expect the queue to 
				contain a value. */
				xCoRoutineErrorDetected = pdTRUE;
			}
			else
			{
				/* Each queue used to receive data from the 'hook' co-routines 
				should contain the number we last posted to the same co-routine. */
				if( uxReceivedNumber != uxNumberToPost )
				{
					xCoRoutineErrorDetected = pdTRUE;
				}

				/* Nothing should be blocked waiting to post to the queue. */
				if( xCoRoutineWoken != pdFALSE )
				{
					xCoRoutineErrorDetected = pdTRUE;
				}
			}
		}

		/* Start the next cycle by posting the next number onto each Tx queue. */
		uxNumberToPost++;

		for( xIndex = 0; xIndex < hookNUM_HOOK_CO_ROUTINES; xIndex++ )
		{
			if( crQUEUE_SEND_FROM_ISR( xHookTxQueues[ xIndex ], &uxNumberToPost, pdFALSE ) != pdTRUE )
			{
				/* Posting to the queue should have woken the co-routine that 
				was blocked on the queue. */
				xCoRoutineErrorDetected = pdTRUE;
			}
		}
	}
}
/*-----------------------------------------------------------*/

static void prvHookCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
{
static unsigned portBASE_TYPE uxReceivedValue[ hookNUM_HOOK_CO_ROUTINES ];
portBASE_TYPE xResult;

	/* Each co-routine MUST start with a call to crSTART(); */
	crSTART( xHandle );

	for( ;; )
	{
		/* Wait to receive a value from the tick hook. */
		xResult = pdFAIL;
		crQUEUE_RECEIVE( xHandle, xHookTxQueues[ uxIndex ], &( uxReceivedValue[ uxIndex ] ), portMAX_DELAY, &xResult );

		/* There is no reason why we should not have received something on
		the queue. */
		if( xResult != pdPASS )
		{
			xCoRoutineErrorDetected = pdTRUE;
		}

		/* Send the same number back to the idle hook so it can verify it. */
		xResult = pdFAIL;
		crQUEUE_SEND( xHandle, xHookRxQueues[ uxIndex ], &( uxReceivedValue[ uxIndex ] ), hookNO_BLOCK_TIME, &xResult );
		if( xResult != pdPASS )
		{
			/* There is no reason why we should not have been able to post to 
			the queue. */
			xCoRoutineErrorDetected = pdTRUE;
		}
	}

	/* Each co-routine MUST end with a call to crEND(). */
	crEND();
}
/*-----------------------------------------------------------*/

portBASE_TYPE xAreHookCoRoutinesStillRunning( void )
{
	if( xCoRoutineErrorDetected )
	{
		return pdFALSE;
	}
	else
	{
		return pdTRUE;
	}
}



?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区不卡| 99久久精品国产导航| 欧美色网一区二区| 一区二区三区高清在线| 春色校园综合激情亚洲| 国产亚洲精品aa| 国产精品一品二品| 日韩视频免费直播| 婷婷久久综合九色综合绿巨人 | 精品三级av在线| 蜜臀av一区二区在线观看| 91精品国产入口在线| 无码av免费一区二区三区试看| 欧美性猛交一区二区三区精品| 亚洲免费资源在线播放| 一本大道久久a久久综合婷婷| 国产精品高清亚洲| 一本大道av一区二区在线播放| 有坂深雪av一区二区精品| 色妹子一区二区| 亚洲电影在线播放| 欧美日韩在线一区二区| 亚洲日本欧美天堂| 成人一级视频在线观看| 亚洲欧美激情插| 欧美日韩国产美女| 久久不见久久见免费视频1| 久久久久久久久99精品| 99精品黄色片免费大全| 亚洲午夜免费电影| 5月丁香婷婷综合| 国产乱一区二区| 亚洲美女免费在线| 91精品一区二区三区久久久久久| 精品在线免费观看| 亚洲欧洲精品一区二区三区| 欧美主播一区二区三区美女| 美女视频黄久久| 国产精品久久久久久久蜜臀| 精品精品国产高清a毛片牛牛 | 日日欢夜夜爽一区| 欧美精品aⅴ在线视频| 国产精品综合二区| 一区二区三区在线观看欧美 | 色综合中文字幕国产| 亚洲免费观看高清完整版在线观看| 91小视频免费看| 奇米777欧美一区二区| 中文一区在线播放| 欧美一区二区三区在线观看| 成人美女在线视频| 青青草91视频| 亚洲欧洲成人精品av97| 日韩欧美成人午夜| 一本久道久久综合中文字幕| 久久99国产乱子伦精品免费| 亚洲欧美色一区| 久久只精品国产| 91国产精品成人| 懂色av一区二区三区蜜臀| 亚洲黄色尤物视频| 欧美成人vps| 99久久婷婷国产| 婷婷综合在线观看| 亚洲精品高清在线| 欧美极品另类videosde| 日韩一区二区三区av| 欧美中文字幕不卡| 成人福利视频网站| 国产剧情一区二区三区| 日韩av电影免费观看高清完整版| 日韩美女视频19| 久久精品亚洲乱码伦伦中文 | 亚洲福利一区二区三区| 国产精品高潮呻吟| 国产视频一区不卡| 日韩欧美一二三四区| 欧美久久久久免费| 欧日韩精品视频| 99久久99精品久久久久久| 国产一区久久久| 久久国产三级精品| 日韩专区欧美专区| 亚洲在线成人精品| 日韩伦理av电影| 亚洲人午夜精品天堂一二香蕉| 欧美激情一区二区三区不卡 | 国产亚洲精品bt天堂精选| 日韩精品一区二区三区视频播放| 欧美巨大另类极品videosbest| 欧美丝袜丝交足nylons| 在线亚洲高清视频| 色激情天天射综合网| 色老汉一区二区三区| 一本大道av伊人久久综合| 99这里都是精品| 91社区在线播放| 在线观看日产精品| 欧美在线播放高清精品| 欧美性猛交xxxx黑人交| 欧美日韩亚洲另类| 欧美一区二区精品| 日韩视频一区二区| 日韩一级二级三级精品视频| 欧美一级高清大全免费观看| 日韩视频在线一区二区| 欧美本精品男人aⅴ天堂| 久久综合久久综合久久综合| wwww国产精品欧美| 国产精品婷婷午夜在线观看| 日韩一区在线免费观看| 亚洲精品伦理在线| 午夜国产不卡在线观看视频| 免费一级欧美片在线观看| 国产一区啦啦啦在线观看| 福利一区在线观看| 色悠悠亚洲一区二区| 欧美区视频在线观看| 欧美大片在线观看一区| 国产午夜精品久久| 一区二区三区欧美日| 亚洲综合色噜噜狠狠| 午夜视频一区二区| 韩国欧美一区二区| av不卡免费在线观看| 欧美日韩亚洲综合在线| 精品国产百合女同互慰| 国产精品网站在线| 亚洲无线码一区二区三区| 激情av综合网| 91久久精品网| 欧美精品一区二区三区蜜臀| 国产精品国产三级国产三级人妇| 午夜亚洲福利老司机| 国产成都精品91一区二区三| 色激情天天射综合网| 精品国产三级电影在线观看| 亚洲欧美aⅴ...| 美女一区二区久久| 91美女在线观看| 久久久久久久久久久久电影| 亚洲国产成人av好男人在线观看| 国内不卡的二区三区中文字幕| 色老综合老女人久久久| 久久一夜天堂av一区二区三区| 一区二区三区在线播| 韩国av一区二区三区在线观看| 色偷偷一区二区三区| 精品国产成人在线影院| 亚洲国产成人av网| 成人福利视频在线| 亚洲精品一区二区三区香蕉| 亚洲午夜一区二区| 94色蜜桃网一区二区三区| 2021中文字幕一区亚洲| 成人欧美一区二区三区视频网页| 亚洲乱码国产乱码精品精98午夜 | 国产日产欧美一区| 男人的j进女人的j一区| 色综合天天综合狠狠| 国产日产精品一区| 精品综合免费视频观看| 欧美高清激情brazzers| 成人欧美一区二区三区白人| 国产一区日韩二区欧美三区| 6080yy午夜一二三区久久| 洋洋av久久久久久久一区| 成人一二三区视频| 久久先锋影音av鲁色资源| 午夜电影网亚洲视频| 91日韩精品一区| 中文字幕免费观看一区| 国产最新精品免费| 精品日韩一区二区三区| 美女视频黄免费的久久| 91精品欧美综合在线观看最新| 一区二区三区在线看| 色天使色偷偷av一区二区| 国产精品久久国产精麻豆99网站| 国产成人精品免费一区二区| 精品处破学生在线二十三| 久久er精品视频| 日韩欧美不卡在线观看视频| 国产精品99久久久久久久女警 | 午夜在线成人av| 91麻豆精品国产自产在线观看一区 | 中文字幕巨乱亚洲| av中文字幕亚洲| 亚洲国产色一区| 欧美精品一区二区三区视频| 成人avav影音| 偷拍一区二区三区四区| 精品国产亚洲在线| 99国产精品99久久久久久| 亚洲一级电影视频| 精品国产一区久久| 99re8在线精品视频免费播放| 香港成人在线视频| 国产亚洲va综合人人澡精品 | 日韩和欧美一区二区|