亚洲欧美第一页_禁久久精品乱码_粉嫩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.
	***************************************************************************
*/


/*
 *
 * vMain() is effectively the demo application entry point.  It is called by
 * the main() function generated by the Processor Expert application.  
 *
 * vMain() creates all the demo application tasks, then starts the scheduler.
 * The WEB	documentation provides more details of the demo application tasks.
 *
 * Main.c also creates a task called "Check".  This only executes every three 
 * 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.
 * Each task (other than the "flash" tasks) maintains a unique count that is 
 * incremented each time the task successfully completes its function.  Should 
 * any error occur within such a task the count is permanently halted.  The 
 * check task inspects the count of each task to ensure it has changed since
 * the last time the check task executed.  If all the count variables have 
 * changed all the tasks are still executing error free, and the check task
 * toggles the onboard LED.  Should any task contain an error at any time 
 * the LED toggle rate will change from 3 seconds to 500ms.
 *
 * This file also includes the functionality normally implemented within the 
 * standard demo application file integer.c.  Due to the limited memory 
 * available on the microcontroller the functionality has been included within
 * the idle task hook [vApplicationIdleHook()] - instead of within the usual
 * separate task.  See the documentation within integer.c for the rationale 
 * of the integer task functionality.
 *
 *
 * 
 * The demo applications included with other FreeRTOS ports make use of the
 * standard ComTest tasks.  These use a loopback connector to transmit and
 * receive RS232 characters between two tasks.  The test is important for two
 * reasons:
 *
 *	1) It tests the mechanism of context switching from within an application
 *	   ISR.
 *
 *	2) It generates some randomised timing.
 *
 * The demo board used to develop this port does not include an RS232 interface
 * so the ComTest tasks could not easily be included.  Instead these two tests
 * are created using a 'Button Push' task.  
 * 
 * The 'Button Push' task blocks on a queue, waiting for data to arrive.  A
 * simple interrupt routine connected to the PP0 input on the demo board places
 * data in the queue each time the PP0 button is pushed (this button is built 
 * onto the demo board).  As the 'Button Push' task is created with a 
 * relatively high priority it will unblock and want to execute as soon as data
 * arrives in the queue - resulting in a context switch within the PP0 input
 * ISR.  If the data retrieved from the queue is that expected the 'Button Push'
 * task toggles LED 5.  Therefore correct operation is indicated by the LED
 * toggling each time the PP0 button is pressed.
 *
 * This test is not as satisfactory as the ComTest method - but the simple 
 * nature of the port makes is just about adequate.
 * 
 */

/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"

/* Demo application includes. */
#include "flash.h"
#include "PollQ.h"
#include "dynamic.h"
#include "partest.h"

/* Processor expert includes. */
#include "ButtonInterrupt.h"

/*-----------------------------------------------------------
	Definitions.
-----------------------------------------------------------*/

/* Priorities assigned to demo application tasks. */
#define mainFLASH_PRIORITY			( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY		( tskIDLE_PRIORITY + 3 )
#define mainBUTTON_TASK_PRIORITY	( tskIDLE_PRIORITY + 3 )
#define mainQUEUE_POLL_PRIORITY		( tskIDLE_PRIORITY + 2 )

/* LED that is toggled by the check task.  The check task periodically checks
that all the other tasks are operating without error.  If no errors are found
the LED is toggled with mainCHECK_PERIOD frequency.  If an error is found 
then the toggle rate increases to mainERROR_CHECK_PERIOD. */
#define mainCHECK_TASK_LED			( 7 )
#define mainCHECK_PERIOD			( ( portTickType ) 3000 / portTICK_RATE_MS  )
#define mainERROR_CHECK_PERIOD		( ( portTickType ) 500 / portTICK_RATE_MS )

/* LED that is toggled by the button push interrupt. */
#define mainBUTTON_PUSH_LED			( 5 )

/* The constants used in the idle task calculation. */
#define intgCONST1				( ( portLONG ) 123 )
#define intgCONST2				( ( portLONG ) 234567 )
#define intgCONST3				( ( portLONG ) -3 )
#define intgCONST4				( ( portLONG ) 7 )
#define intgEXPECTED_ANSWER		( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )

/* The length of the queue between is button push ISR and the Button Push task
is greater than 1 to account for switch bounces generating multiple inputs. */
#define mainBUTTON_QUEUE_SIZE 6

/*-----------------------------------------------------------
	Local functions prototypes.
-----------------------------------------------------------*/

/*
 * The 'Check' task function.  See the explanation at the top of the file.
 */
static void vErrorChecks( void* pvParameters );

/*
 * The 'Button Push' task.  See the explanation at the top of the file.
 */
static void vButtonTask( void *pvParameters );

/*
 * The idle task hook - in which the integer task is implemented.  See the
 * explanation at the top of the file.
 */
void vApplicationIdleHook( void );

/*
 * Checks the unique counts of other tasks to ensure they are still operational.
 */
static portLONG prvCheckOtherTasksAreStillRunning( void );



/*-----------------------------------------------------------
	Local variables.
-----------------------------------------------------------*/

/* A few tasks are defined within this file.  This flag is used to indicate
their status.  If an error is detected in one of the locally defined tasks then
this flag is set to pdTRUE. */
portBASE_TYPE xLocalError = pdFALSE;

/* The queue used to send data from the button push ISR to the Button Push 
task. */
static xQueueHandle xButtonQueue;


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

/* 
 * This is called from the main() function generated by the Processor Expert.
 */
void vMain( void )
{
	/* Start some of the standard demo tasks. */
	vStartLEDFlashTasks( mainFLASH_PRIORITY );
	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
	vStartDynamicPriorityTasks();
	
	/* Start the locally defined tasks.  There is also a task implemented as
	the idle hook. */
	xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
	xTaskCreate( vButtonTask, "Button", configMINIMAL_STACK_SIZE, NULL, mainBUTTON_TASK_PRIORITY, NULL );
	
	/* All the tasks have been created - start the scheduler. */
	vTaskStartScheduler();
	
	/* Should not reach here! */
	for( ;; );
}
/*-----------------------------------------------------------*/

static void vErrorChecks( void *pvParameters )
{
portTickType xDelayPeriod = mainCHECK_PERIOD;
portTickType xLastWakeTime;

	/* Initialise xLastWakeTime to ensure the first call to vTaskDelayUntil()
	functions correctly. */
	xLastWakeTime = xTaskGetTickCount();

	for( ;; )
	{
		/* Delay until it is time to execute again.  The delay period is 
		shorter following an error. */
		vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );

		/* Check all the demo application tasks are executing without 
		error. If an error is found the delay period is shortened - this
		has the effect of increasing the flash rate of the 'check' task
		LED. */
		if( prvCheckOtherTasksAreStillRunning() == pdFAIL )
		{
			/* An error has been detected in one of the tasks - flash faster. */
			xDelayPeriod = mainERROR_CHECK_PERIOD;
		}

		/* Toggle the LED each cycle round. */
		vParTestToggleLED( mainCHECK_TASK_LED );
	}
}
/*-----------------------------------------------------------*/

static portLONG prvCheckOtherTasksAreStillRunning( void )
{
portBASE_TYPE xAllTasksPassed = pdPASS;

	if( xArePollingQueuesStillRunning() != pdTRUE )
	{
		xAllTasksPassed = pdFAIL;
	}

	if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
	{
		xAllTasksPassed = pdFAIL;
	}

	/* Also check the status flag for the tasks defined within this function. */
	if( xLocalError != pdFALSE )
	{
		xAllTasksPassed = pdFAIL;
	}

	return xAllTasksPassed;
}
/*-----------------------------------------------------------*/

void vApplicationIdleHook( void )
{
/* This variable is effectively set to a constant so it is made volatile to
ensure the compiler does not just get rid of it. */
volatile portLONG lValue;

	/* Keep performing a calculation and checking the result against a constant. */
	for( ;; )
	{
		/* Perform the calculation.  This will store partial value in
		registers, resulting in a good test of the context switch mechanism. */
		lValue = intgCONST1;
		lValue += intgCONST2;
		lValue *= intgCONST3;
		lValue /= intgCONST4;

		/* Did we perform the calculation correctly with no corruption? */
		if( lValue != intgEXPECTED_ANSWER )
		{
			/* Error! */
			portENTER_CRITICAL();
				xLocalError = pdTRUE;
			portEXIT_CRITICAL();
		}

		/* Yield in case cooperative scheduling is being used. */
		#if configUSE_PREEMPTION == 0
		{
			taskYIELD();
		}
		#endif		
	}
}
/*-----------------------------------------------------------*/

static void vButtonTask( void *pvParameters )
{
unsigned portBASE_TYPE uxExpected = 1, uxReceived;

	/* Create the queue used by the producer and consumer. */
	xButtonQueue = xQueueCreate( mainBUTTON_QUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned portBASE_TYPE ) );

	if( xButtonQueue )
	{
		/* Now the queue is created it is safe to enable the button interrupt. */
		ButtonInterrupt_Enable();
	
		for( ;; )
		{
			/* Simply wait for data to arrive from the button push interrupt. */
			if( xQueueReceive( xButtonQueue, &uxReceived, portMAX_DELAY ) == pdPASS )	
			{
				/* Was the data we received that expected? */
				if( uxReceived != uxExpected )
				{
					/* Error! */
					portENTER_CRITICAL();
						xLocalError = pdTRUE;
					portEXIT_CRITICAL();				
				}
				else
				{
					/* Toggle the LED for every successful push. */
					vParTestToggleLED( mainBUTTON_PUSH_LED );	
				}
				
				uxExpected++;
			}
		}
	}
	
	/* Will only get here if the queue could not be created. */
	for( ;; );		
}
/*-----------------------------------------------------------*/

#pragma CODE_SEG __NEAR_SEG NON_BANKED

	/* Button push ISR. */
	void interrupt vButtonPush( void )
	{
		static unsigned portBASE_TYPE uxValToSend = 0;
		
		/* Send an incrementing value to the button push task each run. */
		uxValToSend++;		

		/* Clear the interrupt flag. */
		PIFP = 1;

		/* Send the incremented value down the queue.  The button push task is
		blocked waiting for the data.  As the button push task is high priority
		it will wake and a context switch should be performed before leaving
		the ISR. */
		if( xQueueSendFromISR( xButtonQueue, &uxValToSend, pdFALSE ) )
		{
			/* NOTE: This macro can only be used if there are no local
			variables defined.  This function uses a static variable so it's
			use is permitted.  If the variable were not static portYIELD() 
			would have to be used in it's place. */
			portTASK_SWITCH_FROM_ISR();
		}		
	}

#pragma CODE_SEG DEFAULT


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
波多野结衣一区二区三区| 国产成人h网站| 久久久久久久久久久久久夜| 国内精品伊人久久久久av一坑| 欧美视频中文一区二区三区在线观看| 欧美日韩一区二区三区免费看| 久久一区二区三区四区| 亚洲午夜视频在线| 国产suv一区二区三区88区| 欧美亚洲国产一区在线观看网站| 精品动漫一区二区三区在线观看| 亚洲国产精品影院| 国产精品一区二区果冻传媒| 91精品国产欧美一区二区成人| 国产欧美一区二区精品性色超碰 | 亚洲成人在线免费| 国产99精品视频| 成人欧美一区二区三区1314| 久88久久88久久久| 精品视频一区二区三区免费| 捆绑变态av一区二区三区| 欧美色精品在线视频| 美脚の诱脚舐め脚责91| 欧美日韩一区中文字幕| 精品一区二区三区久久| 中文字幕一区二区三区av| 欧美日韩电影在线| 亚洲成人免费在线观看| 精品女同一区二区| 韩国三级中文字幕hd久久精品| 国产精品久久久久永久免费观看| 国产黑丝在线一区二区三区| 亚洲一区日韩精品中文字幕| 色综合久久天天| 中文字幕一区二区三区av| 欧美老肥妇做.爰bbww视频| 亚洲在线免费播放| 久久综合精品国产一区二区三区| 日本乱人伦一区| 亚洲精品国产第一综合99久久| 99热99精品| 美女一区二区三区在线观看| 亚洲欧美一区二区三区极速播放 | 94-欧美-setu| 日韩一区有码在线| 精品伦理精品一区| 欧美午夜精品免费| 高清视频一区二区| 久久精品国产第一区二区三区| 一区二区三区四区乱视频| 欧美在线不卡视频| 偷窥少妇高潮呻吟av久久免费| 欧美一区二区三区四区久久| 91一区二区三区在线观看| 一区二区国产视频| 国产精品的网站| 国产人成一区二区三区影院| 欧美一区二区成人6969| 欧美日韩免费电影| 在线视频综合导航| 成人h版在线观看| 亚洲国产日韩a在线播放性色| 中文一区二区在线观看| 在线欧美日韩精品| 懂色av中文字幕一区二区三区| 免费看日韩精品| 国产精品视频一区二区三区不卡| 欧洲一区在线观看| www.色精品| 成人一区二区三区视频| 亚洲成人av在线电影| 亚洲男人天堂av网| 1000精品久久久久久久久| 久久久国产午夜精品| 精品国产一区二区三区久久久蜜月 | 国产婷婷精品av在线| 99国产精品国产精品久久| 国产999精品久久久久久绿帽| 国产成人一区二区精品非洲| 激情综合网天天干| 国产宾馆实践打屁股91| 国产乱码一区二区三区| 国产盗摄精品一区二区三区在线| 国产福利91精品一区二区三区| 国产乱码精品1区2区3区| 国产精品一区二区三区乱码| 成人性生交大合| 成人免费观看视频| 91网站最新网址| 欧美影院一区二区| 7777精品伊人久久久大香线蕉最新版| 成人国产精品免费网站| 国产99久久久国产精品免费看| 成人综合婷婷国产精品久久| 成人h精品动漫一区二区三区| 99久久久无码国产精品| 91成人在线精品| 4438亚洲最大| 欧美精品一区男女天堂| 一区精品在线播放| 亚洲va国产va欧美va观看| 久久av资源站| 成人av网站免费| 欧美中文字幕一区二区三区| 欧美精品一卡二卡| 国产亚洲欧美色| 亚洲视频资源在线| 久久久久久一二三区| 国产精品美日韩| 亚洲成a人片在线不卡一二三区 | 99久久综合99久久综合网站| 91免费小视频| 91精品国产91久久综合桃花| 国产婷婷色一区二区三区四区 | 一二三四社区欧美黄| 日韩精品91亚洲二区在线观看| 亚洲免费观看在线视频| 日韩精品免费视频人成| 成人av综合一区| 欧美一区永久视频免费观看| 国产婷婷一区二区| 亚洲福利国产精品| 国产成人免费视频精品含羞草妖精 | 欧美日本在线视频| 日本一区二区三区国色天香 | 精品一区二区成人精品| 972aa.com艺术欧美| 日韩久久精品一区| 日韩一区二区电影在线| 精品剧情在线观看| 亚洲欧美一区二区在线观看| 美女视频黄频大全不卡视频在线播放| 99久久精品国产观看| 精品日韩在线观看| 夜夜嗨av一区二区三区| 粉嫩av一区二区三区在线播放 | 亚洲男同1069视频| 国内偷窥港台综合视频在线播放| 在线这里只有精品| 国产人妖乱国产精品人妖| 美国十次综合导航| 欧美亚洲动漫制服丝袜| 中文字幕日韩欧美一区二区三区| 精品一区二区三区在线观看国产| 91久久精品日日躁夜夜躁欧美| 国产欧美一区二区三区鸳鸯浴 | 国产午夜亚洲精品羞羞网站| 日韩和欧美一区二区| av不卡一区二区三区| 久久久久久久综合日本| 日韩成人伦理电影在线观看| 精品一区二区三区蜜桃| 欧美高清视频一二三区| 夜夜嗨av一区二区三区| 色综合 综合色| 国产精品美女久久久久久| 国产成人精品免费| 久久综合九色欧美综合狠狠| 蜜桃av噜噜一区| 欧美乱妇一区二区三区不卡视频| 亚洲一区二区高清| 91福利资源站| 亚洲在线一区二区三区| 在线亚洲一区观看| 亚洲欧美日韩在线播放| 色老汉av一区二区三区| 亚洲欧洲精品一区二区三区 | 亚洲一区二区三区国产| 色婷婷精品大视频在线蜜桃视频| 中文字幕一区二区三区精华液 | 中文字幕一区免费在线观看 | 亚洲国产成人va在线观看天堂| 国产亚洲欧美一区在线观看| 日韩一级视频免费观看在线| 亚洲成a人v欧美综合天堂下载| 欧美日韩在线播放一区| 午夜精品久久久久久久久久久 | 亚洲影视在线播放| 91久久人澡人人添人人爽欧美| 亚洲精品ww久久久久久p站| 日本国产一区二区| 亚洲一区二三区| 538在线一区二区精品国产| 天堂午夜影视日韩欧美一区二区| 91精品国产综合久久久久久久| 舔着乳尖日韩一区| 日韩欧美一区在线| 黑人精品欧美一区二区蜜桃| 国产午夜亚洲精品不卡| 成人av片在线观看| 自拍偷拍亚洲欧美日韩| 欧美日韩在线一区二区| 美女一区二区久久| 国产成人精品亚洲日本在线桃色| 国产一区二区在线免费观看| 国产精品盗摄一区二区三区| 99热国产精品| 亚洲电影你懂得| 精品国产一二三区| 99久久久免费精品国产一区二区|