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

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

?? comtest.c

?? Este é um rtos free para a familia arm7
?? C
字號:
/*
	FreeRTOS V4.0.0 - Copyright (C) 2003-2006 Richard Barry.

	This file is part of the FreeRTOS distribution.

	FreeRTOS 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 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; 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, 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一区二区三区免费野_久草精品视频
欧美激情资源网| www.爱久久.com| 国产精品毛片高清在线完整版 | 免费成人结看片| 国产三级久久久| 91精品国产高清一区二区三区蜜臀| 成人午夜激情视频| 蜜臀av性久久久久av蜜臀妖精 | 日韩国产欧美在线视频| 1000精品久久久久久久久| 精品区一区二区| 欧美嫩在线观看| 欧美视频在线观看一区| youjizz久久| 国产自产v一区二区三区c| 视频一区二区不卡| 性感美女极品91精品| 夜夜操天天操亚洲| 自拍偷拍亚洲激情| 成人免费一区二区三区视频 | 麻豆免费精品视频| 日韩在线播放一区二区| 亚洲成人在线网站| 亚洲国产日韩精品| 一个色妞综合视频在线观看| 亚洲欧美另类小说| 亚洲日韩欧美一区二区在线| 中文幕一区二区三区久久蜜桃| 久久久亚洲午夜电影| 久久亚洲二区三区| 26uuu亚洲| 久久九九全国免费| 精品伦理精品一区| 久久综合给合久久狠狠狠97色69| 精品久久免费看| 精品99999| 国产亚洲综合av| 国产精品理论片在线观看| 国产精品久久毛片| 国产精品丝袜91| 综合av第一页| 在线精品视频免费观看| 极品少妇xxxx精品少妇| 国产乱人伦精品一区二区在线观看| 老司机精品视频线观看86| 久久机这里只有精品| 国产精品综合在线视频| 高清beeg欧美| 色婷婷av一区二区三区大白胸| 色婷婷激情综合| 5月丁香婷婷综合| 精品成人在线观看| 国产精品免费视频一区| 伊人婷婷欧美激情| 日本aⅴ免费视频一区二区三区| 麻豆精品在线视频| 东方aⅴ免费观看久久av| 99久久er热在这里只有精品15| 91原创在线视频| 欧美日韩一区三区| 欧美精品一区二区三区很污很色的 | 国产成人亚洲综合a∨猫咪| 成人综合激情网| 91九色最新地址| 欧美大片一区二区三区| 国产精品久久久久久妇女6080| 一区二区不卡在线播放| 精品一区二区三区在线播放 | 日本韩国欧美在线| 正在播放亚洲一区| 中文一区一区三区高中清不卡| 伊人开心综合网| 久久众筹精品私拍模特| 日韩免费视频一区| 国产精品免费免费| 日韩精品一级中文字幕精品视频免费观看 | 欧美亚洲一区二区在线观看| 91精品婷婷国产综合久久性色| 久久这里只精品最新地址| 亚洲色图欧美在线| 久久99国产精品尤物| 一本色道久久综合精品竹菊| 日韩欧美一级二级三级久久久| 国产精品免费免费| 麻豆成人久久精品二区三区小说| 不卡一区二区中文字幕| 91麻豆精品国产91| 综合久久一区二区三区| 麻豆国产欧美一区二区三区| 91麻豆高清视频| 2020国产精品自拍| 亚洲高清中文字幕| 成人三级伦理片| 欧美不卡激情三级在线观看| 亚洲精品欧美综合四区| 国产伦精品一区二区三区免费迷| 欧美性生活久久| 中文字幕第一区二区| 男女男精品视频| 欧美日韩久久久久久| 中文一区一区三区高中清不卡| 欧美mv和日韩mv国产网站| 国产人妖乱国产精品人妖| 日韩成人精品在线观看| 日本精品一区二区三区高清| 中文字幕 久热精品 视频在线| 蓝色福利精品导航| 欧美日韩一卡二卡三卡 | 日韩欧美中文字幕制服| 亚洲欧美日韩国产综合在线| 国产一区二区主播在线| 日韩三级在线观看| 亚洲午夜激情网站| 91黄视频在线观看| 日韩一区在线看| 成人av先锋影音| 中文字幕av资源一区| 国产成人综合精品三级| 日韩精品一区二区三区swag | 99久久综合狠狠综合久久| 精品欧美一区二区久久| 美女网站色91| 91精品黄色片免费大全| 午夜视频在线观看一区| 欧美日韩一级片网站| 亚洲影院理伦片| 91国产精品成人| 亚洲人成影院在线观看| 91免费观看在线| 日韩一区在线播放| 色激情天天射综合网| 亚洲色图一区二区| 在线观看免费亚洲| 亚洲一区二区三区中文字幕| 色老汉一区二区三区| 亚洲伦理在线免费看| 欧美亚洲愉拍一区二区| 午夜精品久久久久久久久| 91麻豆精品久久久久蜜臀| 免费成人av在线| 精品国产免费视频| 国产丶欧美丶日本不卡视频| 国产嫩草影院久久久久| 不卡欧美aaaaa| 亚洲一区二区三区四区中文字幕| 欧美日韩在线一区二区| 婷婷久久综合九色综合绿巨人| 4438x成人网最大色成网站| 美国欧美日韩国产在线播放| 精品久久久久久无| 风间由美一区二区av101| 亚洲嫩草精品久久| 欧美一区二区福利视频| 国产精品影视天天线| 1区2区3区精品视频| 欧美伊人久久久久久久久影院 | 国产成人av电影在线| 国产精品久久午夜夜伦鲁鲁| 99久久综合国产精品| 亚洲一区二区三区四区五区黄| 欧美日韩精品欧美日韩精品一| 久久精品噜噜噜成人88aⅴ| 中文字幕欧美国产| 91福利区一区二区三区| 麻豆91在线播放| 国产精品每日更新| 欧美欧美午夜aⅴ在线观看| 国产一区999| 一区二区三区精品在线| 日韩精品一区二区三区四区 | 日韩视频一区二区| 成人动漫一区二区三区| 亚洲成年人网站在线观看| 欧美不卡一二三| 色综合久久久网| 久久精品噜噜噜成人88aⅴ| 国产精品每日更新| 欧美一级日韩免费不卡| 成人av在线一区二区| 喷水一区二区三区| 国产精品的网站| 日韩欧美在线1卡| 91免费小视频| 国产一区二区三区在线观看免费视频| 亚洲日本电影在线| 久久亚洲精华国产精华液| 欧美无人高清视频在线观看| 国产一区在线不卡| 亚洲成人av一区| 《视频一区视频二区| 日韩欧美123| 欧美在线免费观看亚洲| 国产精品白丝jk白祙喷水网站| 亚洲国产cao| 亚洲精品视频自拍| 国产欧美一区二区三区在线老狼| 欧美乱妇23p| 在线免费亚洲电影| 丁香另类激情小说| 国产剧情一区二区|