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

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

?? main.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.
	***************************************************************************
*/

/*
 * Creates all the demo application tasks, then starts the scheduler.
 *
 * Main. c also creates a task called "Print".  This only executes every five 
 * seconds but has the highest priority so is guaranteed to get processor time.  
 * Its main function is to check that all the other tasks are still operational.  
 * Nearly all the tasks in the demo application maintain a unique count that is 
 * incremented each time the task successfully completes its function.  Should any 
 * error occur within the task the count is permanently halted.  The print task 
 * checks the count of each task to ensure it has changed since the last time the 
 * print task executed.  If any count is found not to have changed the print task
 * displays an appropriate message, halts, and flashes the on board LED rapidly.
 * If all the tasks are still incrementing their unique counts the print task
 * displays an "OK" message.
 *
 * The LED flash tasks do not maintain a count as they already provide visual
 * feedback of their status.
 *
 * The print task blocks on the queue into which messages that require displaying
 * are posted.  It will therefore only block for the full 5 seconds if no messages
 * are posted onto the queue.
 *
 * Main. c also provides a demonstration of how the trace visualisation utility can
 * be used, and how the scheduler can be stopped.
 *
 * On the Flashlite it is preferable not to try to write to the console during
 * real time operation.  The built in LED is toggled every cycle of the print task
 * that does not encounter any errors, so the console IO may be removed if required.
 * The build in LED will start flashing rapidly if any task reports an error.
 */

/*
Changes from V1.01:

	+ Previously, if an error occurred in a task the on board LED was stopped from
	  toggling.  Now if an error occurs the check task enters an infinite loop,
	  toggling the LED rapidly.

Changes from V1.2.3

	+ The integer and comtest tasks are now used when the cooperative scheduler 
	  is being used.  Previously they were only used with the preemptive
	  scheduler.

Changes from V1.2.5

	+ Made the communications RX task a higher priority.

Changes from V2.0.0

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

#include <stdlib.h>
#include <conio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "partest.h"
#include "serial.h"

/* Demo file headers. */
#include "BlockQ.h"
#include "PollQ.h"
#include "death.h"
#include "flash.h"
#include "integer.h"
#include "print.h"
#include "comtest.h"
#include "fileio.h"
#include "semtest.h"

/* Priority definitions for all the tasks in the demo application. */
#define mainLED_TASK_PRIORITY			( tskIDLE_PRIORITY + 1 )
#define mainCREATOR_TASK_PRIORITY		( tskIDLE_PRIORITY + 3 )
#define mainPRINT_TASK_PRIORITY			( tskIDLE_PRIORITY + 5 )
#define mainQUEUE_POLL_PRIORITY			( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_BLOCK_PRIORITY		( tskIDLE_PRIORITY + 3 )
#define mainCOM_TEST_PRIORITY			( tskIDLE_PRIORITY + 3 )
#define mainSEMAPHORE_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )

#define mainPRINT_STACK_SIZE		( ( unsigned portSHORT ) 256 )
#define mainDEBUG_LOG_BUFFER_SIZE	( ( unsigned portSHORT ) 20480 )

/* Constant definitions for accessing the build in LED on the Flashlite 186. */
#define mainLED_REG_DIR 			( ( unsigned portSHORT ) 0xff78 )
#define mainLED_REG 				( ( unsigned portSHORT ) 0xff7a )

/* If an error is detected in a task then the vErrorChecks() task will enter
an infinite loop flashing the LED at this rate. */
#define mainERROR_FLASH_RATE		( ( portTickType ) 100 / portTICK_RATE_MS )

/* Task function for the "Print" task as described at the top of the file. */
static void vErrorChecks( void *pvParameters );

/* Function that checks the unique count of all the other tasks as described at
the top of the file. */
static void prvCheckOtherTasksAreStillRunning( void );

/* Functions to setup and use the built in LED on the Flashlite 186 board. */
static void prvToggleLED( void );
static void prvInitLED( void );

/* Key presses can be used to start/stop the trace visualisation utility or stop
the scheduler. */
static void	prvCheckForKeyPresses( void );

/* Buffer used by the trace visualisation utility. */
static portCHAR pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ];

/*-----------------------------------------------------------*/
portSHORT main( void )
{
	/* Initialise hardware and utilities. */
	vParTestInitialise();
	vPrintInitialise();
	prvInitLED();

	/* CREATE ALL THE DEMO APPLICATION TASKS. */

	vStartComTestTasks( mainCOM_TEST_PRIORITY, serCOM2, ser38400 );
	vStartIntegerMathTasks( tskIDLE_PRIORITY );
	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
	vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );
	vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
	vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY );

	/* Create the "Print" task as described at the top of the file. */
	xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );

	/* This task has to be created last as it keeps account of the number of tasks
	it expects to see running. */
	vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );

	/* Set the scheduler running.  This function will not return unless a task
	calls vTaskEndScheduler(). */
	vTaskStartScheduler();

	return 1;
}
/*-----------------------------------------------------------*/

static void vErrorChecks( void *pvParameters )
{
portTickType xExpectedWakeTime;
const portTickType xPrintRate = ( portTickType ) 5000 / portTICK_RATE_MS;
const portLONG lMaxAllowableTimeDifference = ( portLONG ) 0;
portTickType xWakeTime;
portLONG lTimeDifference;
const portCHAR *pcReceivedMessage;
const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n";

	/* Stop warnings. */
    ( void ) pvParameters;

	/* Loop continuously, blocking, then checking all the other tasks are still
	running, before blocking once again.  This task blocks on the queue of messages
	that require displaying so will wake either by its time out expiring, or a
	message becoming available. */
	for( ;; )
	{
		/* Calculate the time we will unblock if no messages are received
		on the queue.  This is used to check that we have not blocked for too long. */
		xExpectedWakeTime = xTaskGetTickCount();
		xExpectedWakeTime += xPrintRate;

		/* Block waiting for either a time out or a message to be posted that
		required displaying. */
		pcReceivedMessage = pcPrintGetNextMessage( xPrintRate );

		/* Was a message received? */
		if( pcReceivedMessage == NULL )
		{
			/* A message was not received so we timed out, did we unblock at the
			expected time? */
			xWakeTime = xTaskGetTickCount();

			/* Calculate the difference between the time we unblocked and the
			time we should have unblocked. */
			if( xWakeTime > xExpectedWakeTime )
			{
				lTimeDifference = ( portLONG ) ( xWakeTime - xExpectedWakeTime );
			}
			else
			{
				lTimeDifference = ( portLONG ) ( xExpectedWakeTime - xWakeTime );
			}

			if( lTimeDifference > lMaxAllowableTimeDifference )
			{
				/* We blocked too long - create a message that will get
				printed out the next time around. */
				vPrintDisplayMessage( &pcTaskBlockedTooLongMsg );
			}

			/* Check the other tasks are still running, just in case. */
			prvCheckOtherTasksAreStillRunning();
		}
		else
		{
			/* We unblocked due to a message becoming available.  Send the message
			for printing. */
			vDisplayMessage( pcReceivedMessage );
		}

		/* Key presses are used to invoke the trace visualisation utility, or
		end the program. */
		prvCheckForKeyPresses();
	}
} /*lint !e715 !e818 pvParameters is not used but all task functions must take this form. */
/*-----------------------------------------------------------*/

static void	 prvCheckForKeyPresses( void )
{
	#ifdef USE_STDIO

	portSHORT sIn;

	
		taskENTER_CRITICAL();
			sIn = kbhit();
		taskEXIT_CRITICAL();

		if( sIn )
		{
			unsigned portLONG ulBufferLength;

			/* Key presses can be used to start/stop the trace utility, or end the
			program. */
			sIn = getch();
			switch( sIn )
			{
				/* Only define keys for turning on and off the trace if the trace
				is being used. */
				#if configUSE_TRACE_FACILITY == 1
					case 't' :	vTaskList( pcWriteBuffer );
								vWriteMessageToDisk( pcWriteBuffer );
								break;

					case 's' :	vTaskStartTrace( pcWriteBuffer, mainDEBUG_LOG_BUFFER_SIZE );
								break;

					case 'e' :	ulBufferLength = ulTaskEndTrace();
								vWriteBufferToDisk( pcWriteBuffer, ulBufferLength );
								break;
				#endif

				default  :	vTaskEndScheduler();
							break;
			}
		}

	#else
		( void ) pcWriteBuffer;
	#endif
}
/*-----------------------------------------------------------*/

static void prvCheckOtherTasksAreStillRunning( void )
{
portSHORT sErrorHasOccurred = pdFALSE;

	if( xAreComTestTasksStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Com test count unchanged!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Integer maths task count unchanged!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( xAreBlockingQueuesStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Blocking queues count unchanged!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( xArePollingQueuesStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Polling queue count unchanged!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( xIsCreateTaskStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Incorrect number of tasks running!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( xAreSemaphoreTasksStillRunning() != pdTRUE )
	{
		vDisplayMessage( "Semaphore take count unchanged!\r\n" );
		sErrorHasOccurred = pdTRUE;
	}

	if( sErrorHasOccurred == pdFALSE )
	{
		vDisplayMessage( "OK " );
		/* Toggle the LED if everything is okay so we know if an error occurs even if not
		using console IO. */
		prvToggleLED();
	}
	else
	{
		for( ;; )
		{
			/* An error has occurred in one of the tasks.  Don't go any further and
			flash the LED rapidly in case console IO is not being used. */
			prvToggleLED();
			vTaskDelay( mainERROR_FLASH_RATE );
		}
	}
}
/*-----------------------------------------------------------*/

static void prvInitLED( void )
{
unsigned portSHORT usPortDirection;
const unsigned portSHORT usLEDOut = 0x400;

	/* Set the LED bit to an output. */

	usPortDirection = inpw( mainLED_REG_DIR );
	usPortDirection &= ~usLEDOut;
	outpw( mainLED_REG_DIR, usPortDirection );
}
/*-----------------------------------------------------------*/

static void prvToggleLED( void )
{
static portSHORT sLED = pdTRUE;
unsigned portSHORT usLEDState;
const unsigned portSHORT usLEDBit = 0x400;

	/* Flip the state of the LED. */
	usLEDState = inpw( mainLED_REG );
	if( sLED )
	{
		usLEDState &= ~usLEDBit;
	}
	else
	{
		usLEDState |= usLEDBit;
	}
	outpw( mainLED_REG, usLEDState );

	sLED = !sLED;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
婷婷综合在线观看| 欧美亚洲一区二区在线| 91老师片黄在线观看| 4438成人网| 亚洲日本免费电影| 国产麻豆精品视频| 欧美精品九九99久久| 综合av第一页| 国产不卡在线一区| 91精品在线麻豆| 亚洲一区二区三区爽爽爽爽爽| 国产福利电影一区二区三区| 日韩一区二区三区免费观看| 亚洲午夜在线电影| 色综合天天狠狠| 欧美国产精品劲爆| 国产一区在线精品| 精品久久久久久最新网址| 午夜精品福利视频网站| 欧美三级电影精品| 亚洲免费观看在线视频| 99热国产精品| 最新国产精品久久精品| 高清免费成人av| 精品va天堂亚洲国产| 国产中文字幕精品| 精品捆绑美女sm三区| 麻豆成人久久精品二区三区红 | 久久99国产精品久久| 欧美在线观看视频一区二区三区| 国产精品久久久久久户外露出| 国产成人亚洲综合a∨婷婷图片 | 91精品婷婷国产综合久久性色| 最新国产成人在线观看| 成人avav在线| 亚洲欧美色一区| 色噜噜狠狠成人中文综合| 亚洲精品第1页| 欧美亚州韩日在线看免费版国语版| 依依成人综合视频| 欧美日韩久久一区二区| 午夜电影久久久| 日韩午夜激情免费电影| 久久 天天综合| 国产人成亚洲第一网站在线播放| 成人午夜电影网站| 亚洲欧美另类小说| 欧美又粗又大又爽| 日本美女视频一区二区| 精品久久人人做人人爰| 成人av影视在线观看| 亚洲精品老司机| 欧美日韩夫妻久久| 国产中文字幕精品| 日韩美女视频一区二区| 欧美日韩国产欧美日美国产精品| 日本少妇一区二区| 久久久.com| 在线亚洲高清视频| 老鸭窝一区二区久久精品| 久久久国产午夜精品 | 粉嫩高潮美女一区二区三区| 中文字幕一区av| 欧美日韩另类国产亚洲欧美一级| 久久99国产精品久久| 综合色天天鬼久久鬼色| 日韩一区二区精品| 不卡免费追剧大全电视剧网站| 亚洲丶国产丶欧美一区二区三区| 欧美v日韩v国产v| 91丝袜高跟美女视频| 日韩高清国产一区在线| 欧美顶级少妇做爰| 国产精品主播直播| 亚洲午夜在线电影| 欧美激情中文不卡| 欧美男女性生活在线直播观看| 精品影院一区二区久久久| 日韩毛片视频在线看| 26uuu色噜噜精品一区二区| 在线精品国精品国产尤物884a| 久久99精品久久久久久国产越南| 一区二区三区日本| 国产午夜精品在线观看| 91精品国产色综合久久ai换脸| 99麻豆久久久国产精品免费 | 在线观看网站黄不卡| 国内精品久久久久影院色| 亚洲一区二区在线视频| 欧美国产成人在线| 精品人伦一区二区色婷婷| 欧美最新大片在线看| 成人app软件下载大全免费| 久久精品国产久精国产爱| 亚洲国产精品久久久男人的天堂 | 色丁香久综合在线久综合在线观看| 韩日精品视频一区| 日韩av一区二区三区四区| 洋洋成人永久网站入口| 国产精品免费av| 国产欧美精品一区二区三区四区| 日韩天堂在线观看| 欧美精品黑人性xxxx| 欧美日韩精品一区二区三区| 99精品国产热久久91蜜凸| 成人午夜视频福利| 风间由美性色一区二区三区| 精品一二三四在线| 麻豆成人综合网| 蓝色福利精品导航| 另类小说视频一区二区| 蜜臀99久久精品久久久久久软件| 午夜av一区二区| 石原莉奈在线亚洲二区| 日韩在线观看一区二区| 日日夜夜一区二区| 人人精品人人爱| 激情综合亚洲精品| 国产在线不卡一区| 粉嫩一区二区三区性色av| 国产91丝袜在线播放| av亚洲精华国产精华精华| 成人av手机在线观看| 99久久99久久精品国产片果冻 | 亚洲午夜久久久久久久久电影网| 亚洲理论在线观看| 亚洲国产精品一区二区久久| 婷婷综合久久一区二区三区| 免费高清在线一区| 韩国女主播一区二区三区| 国产伦精品一区二区三区视频青涩| 国产一区二区三区四| 不卡视频一二三| 欧美色图在线观看| 91麻豆精品国产91久久久久久久久| 欧美一个色资源| 欧美激情综合五月色丁香| 亚洲欧美综合在线精品| 亚洲成人动漫av| 狠狠色丁香久久婷婷综| 91丨porny丨首页| 欧美日韩国产免费一区二区| 欧美变态口味重另类| 国产精品久久久久久久午夜片 | 亚洲欧美激情一区二区| 亚洲国产精品自拍| 国产精品一区免费视频| 成人一区二区三区在线观看 | 一本色道久久加勒比精品 | 欧美性猛交xxxxxxxx| 欧美一级专区免费大片| 国产精品无人区| 性感美女久久精品| 国产69精品久久久久777| 日本乱人伦一区| 久久综合久久综合亚洲| 亚洲精选视频在线| 精品一区二区三区免费| 91同城在线观看| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲少妇屁股交4| 精品综合久久久久久8888| 色综合久久久网| 精品国产免费视频| 亚洲h在线观看| 成人午夜在线视频| 日韩一级精品视频在线观看| 专区另类欧美日韩| 国产精品一线二线三线| 欧美高清视频www夜色资源网| 中文字幕+乱码+中文字幕一区| 天天免费综合色| 色又黄又爽网站www久久| 日韩三级视频中文字幕| 亚洲最色的网站| 成人激情免费电影网址| 精品国内片67194| 午夜亚洲国产au精品一区二区| 99视频一区二区| 国产欧美一区二区精品性色超碰| 日韩电影免费在线| 在线观看日韩国产| 中文字幕字幕中文在线中不卡视频| 精品综合久久久久久8888| 欧美一级片免费看| 五月天精品一区二区三区| 99国产精品99久久久久久| 国产亚洲成年网址在线观看| 美女看a上一区| 91精品一区二区三区在线观看| 亚洲高清视频的网址| 色婷婷亚洲精品| 国产精品国产三级国产aⅴ入口 | 欧美午夜电影一区| 亚洲精品国产品国语在线app| 99久久99久久精品免费观看| 国产精品久久久久久久久免费丝袜 | 国产精品资源网站| 国产天堂亚洲国产碰碰| 国产大陆a不卡|