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

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

?? comtest.c

?? 最新版FreeRTOS, 包擴多種開發平臺的移植
?? 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 version of comtest. c is for use on systems that have limited stack
 * space and no display facilities.  The complete version can be found in
 * the Demo/Common/Full directory.
 *
 * Creates two tasks that operate on an interrupt driven serial port.  A
 * loopback connector should be used so that everything that is transmitted is
 * also received.  The serial port does not use any flow control.  On a
 * standard 9way 'D' connector pins two and three should be connected together.
 *
 * The first task posts a sequence of characters to the Tx queue, toggling an
 * LED on each successful post.  At the end of the sequence it sleeps for a
 * pseudo-random period before resending the same sequence.
 *
 * The UART Tx end interrupt is enabled whenever data is available in the Tx
 * queue.  The Tx end ISR removes a single character from the Tx queue and
 * passes it to the UART for transmission.
 *
 * The second task blocks on the Rx queue waiting for a character to become
 * available.  When the UART Rx end interrupt receives a character it places
 * it in the Rx queue, waking the second task.  The second task checks that the
 * characters removed from the Rx queue form the same sequence as those posted
 * to the Tx queue, and toggles an LED for each correct character.
 *
 * The receiving task is spawned with a higher priority than the transmitting
 * task.  The receiver will therefore wake every time a character is
 * transmitted so neither the Tx or Rx queue should ever hold more than a few
 * characters.
 *
 */

/*
Changes from V1.2.0:

	+ Reduced the maximum time between successive transmissions.  This provides
	  for a more rigorous test.

Changes from V2.0.0

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

Changes from V2.5.1

	+ The constant comOFFSET_TIME added to the delay period to ensure a more
	  random delay period is used.
*/

/* Scheduler include files. */
#include <stdlib.h>
#include "FreeRTOS.h"
#include "task.h"

/* Demo program include files. */
#include "serial.h"
#include "comtest.h"
#include "partest.h"

#define comSTACK_SIZE				configMINIMAL_STACK_SIZE
#define comTX_LED_OFFSET			( 0 )
#define comRX_LED_OFFSET			( 1 )
#define comTOTAL_PERMISSIBLE_ERRORS ( 2 )

/* The Tx task will transmit the sequence of characters at a pseudo random
interval.  This is the maximum and minimum block time between sends. */
#define comTX_MAX_BLOCK_TIME		( ( portTickType ) 0x96 )
#define comTX_MIN_BLOCK_TIME		( ( portTickType ) 0x32 )
#define comOFFSET_TIME				( ( portTickType ) 3 )

/* We should find that each character can be queued for Tx immediately and we
don't have to block to send. */
#define comNO_BLOCK					( ( portTickType ) 0 )

/* The Rx task will block on the Rx queue for a long period. */
#define comRX_BLOCK_TIME			( ( portTickType ) 0xffff )

/* The sequence transmitted is from comFIRST_BYTE to and including comLAST_BYTE. */
#define comFIRST_BYTE				( 'A' )
#define comLAST_BYTE				( 'X' )

#define comBUFFER_LEN				( ( unsigned portBASE_TYPE ) ( comLAST_BYTE - comFIRST_BYTE ) + ( unsigned portBASE_TYPE ) 1 )
#define comINITIAL_RX_COUNT_VALUE	( 0 )

/* Handle to the com port used by both tasks. */
static xComPortHandle xPort = NULL;

/* The transmit task as described at the top of the file. */
static portTASK_FUNCTION_PROTO( vComTxTask, pvParameters );

/* The receive task as described at the top of the file. */
static portTASK_FUNCTION_PROTO( vComRxTask, pvParameters );

/* The LED that should be toggled by the Rx and Tx tasks.  The Rx task will
toggle LED ( uxBaseLED + comRX_LED_OFFSET).  The Tx task will toggle LED
( uxBaseLED + comTX_LED_OFFSET ). */
static unsigned portBASE_TYPE uxBaseLED = 0;

/* Check variable used to ensure no error have occurred.  The Rx task will
increment this variable after every successfully received sequence.  If at any
time the sequence is incorrect the the variable will stop being incremented. */
static volatile unsigned portBASE_TYPE uxRxLoops = comINITIAL_RX_COUNT_VALUE;

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

void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned portLONG ulBaudRate, unsigned portBASE_TYPE uxLED )
{
	/* Initialise the com port then spawn the Rx and Tx tasks. */
	uxBaseLED = uxLED;
	xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );

	/* The Tx task is spawned with a lower priority than the Rx task. */
	xTaskCreate( vComTxTask, ( const signed portCHAR * const ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
	xTaskCreate( vComRxTask, ( const signed portCHAR * const ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
}
/*-----------------------------------------------------------*/

static portTASK_FUNCTION( vComTxTask, pvParameters )
{
signed portCHAR cByteToSend;
portTickType xTimeToWait;

	/* Just to stop compiler warnings. */
	( void ) pvParameters;

	for( ;; )
	{
		/* Simply transmit a sequence of characters from comFIRST_BYTE to
		comLAST_BYTE. */
		for( cByteToSend = comFIRST_BYTE; cByteToSend <= comLAST_BYTE; cByteToSend++ )
		{
			if( xSerialPutChar( xPort, cByteToSend, comNO_BLOCK ) == pdPASS )
			{
				vParTestToggleLED( uxBaseLED + comTX_LED_OFFSET );
			}
		}

		/* Turn the LED off while we are not doing anything. */
		vParTestSetLED( uxBaseLED + comTX_LED_OFFSET, pdFALSE );

		/* We have posted all the characters in the string - wait before
		re-sending.  Wait a pseudo-random time as this will provide a better
		test. */
		xTimeToWait = xTaskGetTickCount() + comOFFSET_TIME;

		/* Make sure we don't wait too long... */
		xTimeToWait %= comTX_MAX_BLOCK_TIME;

		/* ...but we do want to wait. */
		if( xTimeToWait < comTX_MIN_BLOCK_TIME )
		{
			xTimeToWait = comTX_MIN_BLOCK_TIME;
		}

		vTaskDelay( xTimeToWait );
	}
} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */
/*-----------------------------------------------------------*/

static portTASK_FUNCTION( vComRxTask, pvParameters )
{
signed portCHAR cExpectedByte, cByteRxed;
portBASE_TYPE xResyncRequired = pdFALSE, xErrorOccurred = pdFALSE;

	/* Just to stop compiler warnings. */
	( void ) pvParameters;

	for( ;; )
	{
		/* We expect to receive the characters from comFIRST_BYTE to
		comLAST_BYTE in an incrementing order.  Loop to receive each byte. */
		for( cExpectedByte = comFIRST_BYTE; cExpectedByte <= comLAST_BYTE; cExpectedByte++ )
		{
			/* Block on the queue that contains received bytes until a byte is
			available. */
			if( xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME ) )
			{
				/* Was this the byte we were expecting?  If so, toggle the LED,
				otherwise we are out on sync and should break out of the loop
				until the expected character sequence is about to restart. */
				if( cByteRxed == cExpectedByte )
				{
					vParTestToggleLED( uxBaseLED + comRX_LED_OFFSET );
				}
				else
				{
					xResyncRequired = pdTRUE;
					break; /*lint !e960 Non-switch break allowed. */
				}
			}
		}

		/* Turn the LED off while we are not doing anything. */
		vParTestSetLED( uxBaseLED + comRX_LED_OFFSET, pdFALSE );

		/* Did we break out of the loop because the characters were received in
		an unexpected order?  If so wait here until the character sequence is
		about to restart. */
		if( xResyncRequired == pdTRUE )
		{
			while( cByteRxed != comLAST_BYTE )
			{
				/* Block until the next char is available. */
				xSerialGetChar( xPort, &cByteRxed, comRX_BLOCK_TIME );
			}

			/* Note that an error occurred which caused us to have to resync.
			We use this to stop incrementing the loop counter so
			sAreComTestTasksStillRunning() will return false - indicating an
			error. */
			xErrorOccurred++;

			/* We have now resynced with the Tx task and can continue. */
			xResyncRequired = pdFALSE;
		}
		else
		{
			if( xErrorOccurred < comTOTAL_PERMISSIBLE_ERRORS )
			{
				/* Increment the count of successful loops.  As error
				occurring (i.e. an unexpected character being received) will
				prevent this counter being incremented for the rest of the
				execution.   Don't worry about mutual exclusion on this
				variable - it doesn't really matter as we just want it
				to change. */
				uxRxLoops++;
			}
		}
	}
} /*lint !e715 !e818 pvParameters is required for a task function even if it is not referenced. */
/*-----------------------------------------------------------*/

portBASE_TYPE xAreComTestTasksStillRunning( void )
{
portBASE_TYPE xReturn;

	/* If the count of successful reception loops has not changed than at
	some time an error occurred (i.e. a character was received out of sequence)
	and we will return false. */
	if( uxRxLoops == comINITIAL_RX_COUNT_VALUE )
	{
		xReturn = pdFALSE;
	}
	else
	{
		xReturn = pdTRUE;
	}

	/* Reset the count of successful Rx loops.  When this function is called
	again we expect this to have been incremented. */
	uxRxLoops = comINITIAL_RX_COUNT_VALUE;

	return xReturn;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久九九全国免费| 一区二区视频在线| 日韩欧美亚洲国产另类 | 欧美日韩亚洲综合| 欧美在线一二三四区| 91美女视频网站| av在线这里只有精品| av一区二区三区四区| 成人的网站免费观看| 成人性生交大片| heyzo一本久久综合| 99久久综合狠狠综合久久| 日韩美女天天操| 欧美一级一区二区| 精品国产欧美一区二区| 久久久www免费人成精品| 国产蜜臀av在线一区二区三区| www日韩大片| 国产精品视频在线看| 成人免费视频在线观看| 一区二区三区在线免费播放| 一区二区日韩电影| 丝袜亚洲另类欧美| 久久超级碰视频| 国产成人日日夜夜| 99v久久综合狠狠综合久久| 在线亚洲人成电影网站色www| 欧美三级资源在线| 91精品免费观看| 精品999在线播放| 国产精品久久久久久久久久久免费看| 国产精品白丝在线| 一区二区欧美国产| 麻豆专区一区二区三区四区五区| 黄页视频在线91| 不卡电影免费在线播放一区| 日本丶国产丶欧美色综合| 欧美日韩亚洲丝袜制服| 2020国产精品自拍| 亚洲欧美另类小说视频| 日本少妇一区二区| 成人在线视频一区| 欧洲另类一二三四区| 欧美本精品男人aⅴ天堂| 国产精品卡一卡二| 奇米四色…亚洲| 成人黄色一级视频| 91麻豆精品国产91久久久使用方法| 精品国产91亚洲一区二区三区婷婷| 国产精品家庭影院| 裸体健美xxxx欧美裸体表演| 成人激情免费视频| 欧美一区二区三区免费在线看 | 国产精品美女视频| 丝袜亚洲精品中文字幕一区| 国产成人8x视频一区二区| 欧美日韩一区二区三区在线| 久久亚洲精品国产精品紫薇| 最新国产の精品合集bt伙计| 中文字幕亚洲一区二区av在线| 日韩电影在线看| 成人av网站在线| 91精品国产全国免费观看 | 日本不卡中文字幕| 国产凹凸在线观看一区二区| 99re6这里只有精品视频在线观看| 欧美一区二区三区人| 精品中文字幕一区二区| 成人免费的视频| 欧美日韩卡一卡二| 久久精品在线免费观看| 亚洲大片精品永久免费| 国产精品1区二区.| 欧美日韩国产小视频| 国产日韩v精品一区二区| 亚洲国产成人tv| 国产麻豆一精品一av一免费| 色综合久久久久综合体| 精品久久久久久亚洲综合网| 一区二区在线观看视频| 国产老女人精品毛片久久| 欧美日韩国产123区| 国产精品久久久久影院| 九一九一国产精品| 欧美亚洲高清一区| 中文字幕精品在线不卡| 秋霞午夜鲁丝一区二区老狼| 欧美日韩卡一卡二| 亚洲色图欧美在线| 夫妻av一区二区| 欧美电影免费观看高清完整版 | 国产一区二区视频在线| 欧美日韩中字一区| 一区二区三区在线观看动漫| av中文字幕不卡| 久久精子c满五个校花| 男男视频亚洲欧美| 欧美色欧美亚洲另类二区| 国产精品国产三级国产a| 黑人巨大精品欧美一区| 91精品国产91久久久久久一区二区| 亚洲欧美成aⅴ人在线观看| 黄色资源网久久资源365| 日韩一级大片在线观看| 亚洲电影视频在线| 91日韩一区二区三区| 国产精品毛片a∨一区二区三区| 国产在线看一区| 精品女同一区二区| 麻豆成人免费电影| 91 com成人网| 1区2区3区欧美| 色婷婷av一区二区三区gif| 亚洲欧美在线高清| 成人一区在线观看| 欧美国产国产综合| 成人丝袜视频网| 国产欧美一区视频| 国产成人免费视频网站| 久久精品一区二区三区av| 香蕉成人伊视频在线观看| 欧美精品免费视频| 午夜精品久久久久影视| 欧美三级三级三级爽爽爽| 亚洲国产综合人成综合网站| 国产欧美精品在线观看| 国产激情精品久久久第一区二区| 久久久久久久久久看片| 国产一区二区日韩精品| 精品乱人伦小说| 韩国欧美国产一区| 久久亚洲私人国产精品va媚药| 国产在线乱码一区二区三区| 欧美激情在线一区二区| 91在线精品一区二区三区| 亚洲欧美成aⅴ人在线观看| 欧美性猛交xxxx乱大交退制版| 亚洲电影中文字幕在线观看| 欧美午夜一区二区三区免费大片| 免费久久精品视频| 国产亚洲欧洲997久久综合| 国产福利精品一区二区| 亚洲视频1区2区| 欧美性视频一区二区三区| 青青青伊人色综合久久| 2021国产精品久久精品| 成人精品国产一区二区4080| 亚洲国产精品黑人久久久| 欧美午夜精品免费| 激情成人午夜视频| 中文字幕视频一区| 欧美日韩高清在线| 激情久久五月天| 亚洲欧美激情小说另类| 欧美精品18+| 韩国欧美一区二区| 亚洲综合另类小说| 欧美大片拔萝卜| 成人免费毛片嘿嘿连载视频| 亚洲一区二区三区在线看| 日韩欧美黄色影院| www.激情成人| 日韩精品一级二级| 国产精品网站在线| 91精选在线观看| 成人av网站免费| 免费在线观看一区| 中文字幕在线一区免费| 欧美日韩欧美一区二区| 捆绑调教一区二区三区| 国产精品理论在线观看| 91精品在线观看入口| 国产999精品久久久久久绿帽| 国产精品久久久久一区二区三区| 色94色欧美sute亚洲13| 免费成人你懂的| 亚洲精品亚洲人成人网 | 日韩欧美中文字幕一区| 99国产精品久久久久| 久久99精品国产91久久来源| 一区二区三区欧美日| 精品国精品国产| 欧美婷婷六月丁香综合色| 国产一区二区h| 亚洲精品国产精品乱码不99| 3atv在线一区二区三区| 国产精一区二区三区| 亚洲美女视频在线观看| 国产亚洲一区二区三区四区| 欧美区在线观看| 99re热视频这里只精品| 国模套图日韩精品一区二区 | 国内外成人在线视频| 亚洲va国产va欧美va观看| 国产精品国产三级国产aⅴ入口 | 在线播放中文一区| 91丝袜美女网| www.欧美亚洲| 国产.欧美.日韩| 精品无码三级在线观看视频|