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

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

?? main.c

?? 最新版FreeRTOS, 包擴多種開發平臺的移植
?? C
字號:
/*
	FreeRTOS.org V4.1.1 - 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.
	***************************************************************************
*/

/*
	NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
	The processor MUST be in supervisor mode when vTaskStartScheduler is
	called.  The demo applications included in the FreeRTOS.org download switch
	to supervisor mode prior to main being called.  If you are not using one of
	these demo application projects then ensure Supervisor mode is used.
*/

/*
 * Creates all the demo application tasks, then starts the scheduler.  The WEB
 * documentation provides more details of the demo application tasks.
 *
 * A few tasks are created that are not part of the standard demo.  These are
 * the 'LCD' task, the 'LCD Message' task, a WEB server task and the 'Check' 
 * task.
 *
 * The LCD task is the only task that accesses the LCD directly, so mutual
 * exclusion is ensured.  Any task wishing to display text sends the LCD task
 * a message containing a pointer to the string that should be displayed.
 * The LCD task itself just blocks on a queue waiting for such a message to 
 * arrive - processing each in turn.
 *
 * The LCD Message task does nothing other than periodically send messages to
 * the LCD task.  The messages originating from the LCD Message task are 
 * displayed on the top row of the LCD.
 *
 * The Check task 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. Most tasks maintain 
 * a unique count that is incremented each time the task successfully completes 
 * a cycle of its function.  Should any error occur within such a task the 
 * count is permanently halted.  The check task sets a bit in an error status
 * flag should it find any counter variable at a value that indicates an
 * error has occurred.  The error flag value is converted to a string and sent 
 * to the LCD task for display on the bottom row on the LCD.
 */

/* Standard includes. */
#include <stdio.h>

/* Library includes. */
#include "91x_lib.h"

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

/* Demo application includes. */
#include "lcd.h"
#include "flash.h"
#include "integer.h"
#include "PollQ.h"
#include "BlockQ.h"
#include "semtest.h"
#include "dynamic.h"
#include "partest.h"
#include "flop.h"
#include "comtest2.h"
#include "serial.h"

/* Priorities for the demo application tasks. */
#define mainLED_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )
#define mainQUEUE_POLL_PRIORITY		( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY		( tskIDLE_PRIORITY + 4 )
#define mainSEM_TEST_PRIORITY		( tskIDLE_PRIORITY + 1 )
#define mainBLOCK_Q_PRIORITY		( tskIDLE_PRIORITY + 2 )
#define mainCOM_TEST_PRIORITY		( tskIDLE_PRIORITY + 3 )
#define mainLCD_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )
#define mainMSG_TASK_PRIORITY		( tskIDLE_PRIORITY + 1 )

/* Delays used by the various tasks defined in this file. */
#define mainCHECK_PERIOD			( ( portTickType ) 3000 / portTICK_RATE_MS  )
#define mainSTRING_WRITE_DELAY		( 500 / portTICK_RATE_MS )
#define mainLCD_DELAY				( 20 / portTICK_RATE_MS )

/* Constants for the ComTest tasks. */
#define mainCOM_TEST_BAUD_RATE		( ( unsigned portLONG ) 115200 )
#define mainCOM_TEST_LED			( 3 )

/* The maximum number of messages that can be pending to be written to the LCD. */
#define mainLCD_QUEUE_LEN			( 6 )

/* Dimension the buffer used to write the error flag string. */
#define mainMAX_FLAG_STRING_LEN		( 32 )

/* The structure that is passed on the LCD message queue. */
typedef struct
{
	portCHAR **ppcMessageToDisplay; /*<< Points to a char* pointing to the message to display. */
	portBASE_TYPE xRow;				/*<< The row on which the message should be displayed. */
} xLCDMessage;
/*-----------------------------------------------------------*/

/*
 * The task that executes at the highest priority and calls
 * prvCheckOtherTasksAreStillRunning().  See the description at the top
 * of the file.
 */
static void vErrorChecks( void *pvParameters );

/*
 * Configure the processor clock and ports.
 */
static void prvSetupHardware( void );

/*
 * Checks that all the demo application tasks are still executing without error
 * - as described at the top of the file.  Called by vErrorChecks().
 */
static void prvCheckOtherTasksAreStillRunning( void );

/*
 * The WEB server task prototype.  The task is created in this file but defined
 * elsewhere. 
 */
extern void vuIP_Task(void *pvParameters);

/*
 * The task that displays text on the LCD.
 */
static void prvLCDTask( void * pvParameters );

/*
 * The task that sends messages to be displayed on the top row of the LCD.
 */
static void prvLCDMessageTask( void * pvParameters );

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

/* The queue used to pass messages to the LCD task. */
static xQueueHandle xLCDQueue;

/* Error status flag. */
static unsigned portLONG ulErrorFlags = 0;

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

/*
 * Starts all the other tasks, then starts the scheduler.
 */
void main( void )
{
	#ifdef DEBUG
		debug();
	#endif
	
	/* Setup any hardware that has not already been configured by the low
	level init routines. */
	prvSetupHardware();

	/* Create the queue used to send data to the LCD task. */
	xLCDQueue = xQueueCreate( mainLCD_QUEUE_LEN, sizeof( xLCDMessage ) );

	/* Start all the standard demo application tasks. */
	vStartIntegerMathTasks( tskIDLE_PRIORITY );
	vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
	vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
	vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
	vStartDynamicPriorityTasks();
	vStartMathTasks( tskIDLE_PRIORITY );
	vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );

	/* Start the tasks which are defined in this file. */
	xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
	xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainLCD_TASK_PRIORITY, NULL );
	xTaskCreate( prvLCDMessageTask, "MSG", configMINIMAL_STACK_SIZE, ( void * ) &xLCDQueue, mainMSG_TASK_PRIORITY, NULL );

	/* Finally, create the WEB server task. */
	xTaskCreate( vuIP_Task, "uIP", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY - 1, NULL );
	

	/* Start the scheduler.

	NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
	The processor MUST be in supervisor mode when vTaskStartScheduler is
	called.  The demo applications included in the FreeRTOS.org download switch
	to supervisor mode prior to main being called.  If you are not using one of
	these demo application projects then ensure Supervisor mode is used here. */

	vTaskStartScheduler();

	/* We should never get here as control is now taken by the scheduler. */
	for( ;; );
}
/*-----------------------------------------------------------*/

static void prvSetupHardware( void )
{
	/* Configuration taken from the ST code.

	Set Flash banks size & address */
	FMI_BankRemapConfig( 4, 2, 0, 0x80000 ); 

	/* FMI Waite States */
	FMI_Config( FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH ); 

	/* Configure the FPLL = 96MHz, and APB to 48MHz. */
	SCU_PCLKDivisorConfig( SCU_PCLK_Div2 );
	SCU_PLLFactorsConfig( 192, 25, 2 ); 
	SCU_PLLCmd( ENABLE );
	SCU_MCLKSourceConfig( SCU_MCLK_PLL );

	WDG_Cmd( DISABLE );
	VIC_DeInit();

	/* GPIO8 clock source enable, used by the LCD. */
	SCU_APBPeriphClockConfig(__GPIO8, ENABLE);
	GPIO_DeInit(GPIO8);

	/* GPIO 9 clock source enable, used by the LCD. */
	SCU_APBPeriphClockConfig(__GPIO9, ENABLE);
	GPIO_DeInit(GPIO9);

	/* Enable VIC clock */
	SCU_AHBPeriphClockConfig(__VIC, ENABLE);
	SCU_AHBPeriphReset(__VIC, DISABLE);

	/* Peripheral initialisation. */
	LCD_Init();
	vParTestInitialise();
}
/*-----------------------------------------------------------*/

static void vErrorChecks( void *pvParameters )
{
static portCHAR cCheckVal[ mainMAX_FLAG_STRING_LEN ];
portCHAR *pcFlagString;
xLCDMessage xMessageToSend;
portTickType xLastWakeTime;
portCHAR *pcStringsToDisplay[] = {										
									"Check status flag"
								 };

	/* The parameters are not used in this task. */
	( void ) pvParameters;
	pcFlagString = &cCheckVal[ 0 ];	


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

	/* Cycle for ever, delaying then checking all the other tasks are still
	operating without error. */

	for( ;; )
	{
		/* Delay until it is time to execute again. */
		vTaskDelayUntil( &xLastWakeTime, mainCHECK_PERIOD );
	
		/* Check all the other tasks to see if the error flag needs updating. */
		prvCheckOtherTasksAreStillRunning();
		
		/* Create a string indicating the error flag status. */
		sprintf( cCheckVal, "equals 0x%x       ", ulErrorFlags );
		xMessageToSend.xRow = Line2;

		/* Send the first part of the message to the LCD task. */
		xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ 0 ];
		xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 );
		vTaskDelay( mainSTRING_WRITE_DELAY );

		/* Send the second part of the message to the LCD task. */
		xMessageToSend.ppcMessageToDisplay = &pcFlagString;
		xQueueSend( xLCDQueue, ( void * ) &xMessageToSend, 0 );
	}
}
/*-----------------------------------------------------------*/

static void prvCheckOtherTasksAreStillRunning( void )
{
	if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x01;
	}

	if( xArePollingQueuesStillRunning() != pdTRUE )
	{
		ulErrorFlags |=  0x02;
	}

	if( xAreSemaphoreTasksStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x04;
	}

	if( xAreBlockingQueuesStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x08;
	}

	if( xAreComTestTasksStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x10;
	}

	if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x20;
	}

	if( xAreMathsTaskStillRunning() != pdTRUE )
	{
		ulErrorFlags |= 0x40;
	}
}
/*-----------------------------------------------------------*/

static void prvLCDMessageTask( void * pvParameters )
{
xQueueHandle *pxLCDQueue;	
xLCDMessage xMessageToSend;
portBASE_TYPE xIndex = 0;

/* The strings that are written to the LCD. */
portCHAR *pcStringsToDisplay[] = {										
									"IAR             ",
									"STR912          ",
									"Demo            ",
									"www.FreeRTOS.org",
									""
								};


	/* To test the parameter passing mechanism, the queue on which messages are
	posted is passed in as a parameter even though it is available as a file
	scope variable anyway. */
	pxLCDQueue = ( xQueueHandle * ) pvParameters;

	for( ;; )
	{
		/* Wait until it is time to move onto the next string. */
		vTaskDelay( mainSTRING_WRITE_DELAY );		
		
		/* Configure the message object to send to the LCD task. */
		xMessageToSend.ppcMessageToDisplay = &pcStringsToDisplay[ xIndex ];
		xMessageToSend.xRow = Line1;
		
		/* Post the message to be displayed. */
		xQueueSend( *pxLCDQueue, ( void * ) &xMessageToSend, 0 );
		
		/* Move onto the next message, wrapping when necessary. */
		xIndex++;		
		if( *( pcStringsToDisplay[ xIndex ] ) == 0x00 )
		{
			xIndex = 0;

			/* Delay longer before going back to the start of the messages. */
			vTaskDelay( mainSTRING_WRITE_DELAY * 2 );
		}
	}
}
/*-----------------------------------------------------------*/

void prvLCDTask( void * pvParameters )
{
xQueueHandle *pxLCDQueue;
xLCDMessage xReceivedMessage;
portCHAR *pcString;

	/* To test the parameter passing mechanism, the queue on which messages are
	received is passed in as a parameter even though it is available as a file
	scope variable anyway. */
	pxLCDQueue = ( xQueueHandle * ) pvParameters;

	for( ;; )    
	{
		/* Wait for a message to arrive. */
		if( xQueueReceive( *pxLCDQueue, &xReceivedMessage, portMAX_DELAY ) )
		{
			/* Where is the string we are going to display? */
			pcString = *xReceivedMessage.ppcMessageToDisplay;
  			LCD_DisplayString(xReceivedMessage.xRow, pcString, BlackText);

			/* The delay here is just to ensure the LCD task does not starve
			out lower priority tasks as writhing to the LCD can take a long
			time. */
			vTaskDelay( mainLCD_DELAY );
		}
	}
}
/*-----------------------------------------------------------*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美高清在线一区| 国产欧美一区二区三区在线看蜜臀| 国产一区二区久久| 美女一区二区视频| 麻豆成人久久精品二区三区红| 天涯成人国产亚洲精品一区av| 午夜欧美2019年伦理| 亚洲成人一区在线| 日韩精品一级二级| 韩国三级在线一区| 高清不卡一区二区在线| 成人性生交大片免费看视频在线| 国产一区不卡视频| 成人丝袜18视频在线观看| 91影院在线观看| 欧美三级日韩在线| 日韩美女在线视频| 国产精品久久久爽爽爽麻豆色哟哟| 国产精品丝袜黑色高跟| 亚洲另类在线制服丝袜| 亚欧色一区w666天堂| 国产又黄又大久久| 一本久久a久久精品亚洲| 在线播放视频一区| 久久久精品欧美丰满| 亚洲免费观看高清完整版在线观看熊| 亚洲伦理在线免费看| 日本最新不卡在线| 国产精品亚洲午夜一区二区三区| 成人免费毛片高清视频| 在线观看免费成人| 精品国产乱码久久久久久闺蜜| 国产欧美日韩在线视频| 亚洲黄色片在线观看| 久久激情五月激情| av资源网一区| 日韩三级免费观看| 亚洲裸体在线观看| 麻豆中文一区二区| 色先锋aa成人| 国产日产亚洲精品系列| 亚洲图片欧美视频| 成人黄色在线网站| 欧美一激情一区二区三区| 中文字幕一区二区三区色视频| 亚洲成a人在线观看| 懂色av一区二区三区蜜臀 | 精品国产免费久久| 亚洲另类在线制服丝袜| 国产一区二区日韩精品| 欧美日韩成人在线| 亚洲人成伊人成综合网小说| 免费高清在线一区| 在线看国产日韩| 日本一区免费视频| 精品影视av免费| 欧美午夜精品理论片a级按摩| 久久久久久综合| 麻豆国产欧美日韩综合精品二区| 91视频.com| 国产精品蜜臀在线观看| 国产精品综合在线视频| 欧美一区午夜视频在线观看 | 欧美性大战久久久久久久| 欧美激情一区二区三区全黄| 老司机午夜精品| 91精品国产综合久久精品图片| 亚洲欧美日韩在线不卡| hitomi一区二区三区精品| 国产午夜亚洲精品理论片色戒| 麻豆精品久久精品色综合| 欧美一区二区三区在线电影 | 亚洲精品一区二区三区福利| 视频一区在线播放| 欧美日本一区二区| 亚洲成av人片观看| 欧美日韩成人高清| 日韩vs国产vs欧美| 日韩精品一区二区三区中文不卡 | 国产日产欧美精品一区二区三区| 欧美a一区二区| 精品欧美乱码久久久久久1区2区| 石原莉奈在线亚洲二区| 日韩午夜激情av| 狠狠狠色丁香婷婷综合激情| 337p粉嫩大胆色噜噜噜噜亚洲 | 日韩激情一区二区| 欧美一区二区国产| 精品一二三四区| 国产欧美一区二区三区沐欲 | 一区二区三区四区激情| 欧美在线观看视频在线| 日韩二区在线观看| 久久久天堂av| 91无套直看片红桃| 亚洲成av人片在线观看无码| 欧美福利一区二区| 狠狠色狠狠色综合系列| 国产欧美一区二区精品性色超碰 | 麻豆免费精品视频| 2023国产精品| 色先锋久久av资源部| 五月激情六月综合| 久久久精品免费免费| 色婷婷国产精品| 麻豆国产欧美日韩综合精品二区| 欧美高清在线一区二区| 在线观看成人免费视频| 久久不见久久见中文字幕免费| 久久久噜噜噜久噜久久综合| 色婷婷久久一区二区三区麻豆| 五月天激情综合网| 国产精品欧美一级免费| 欧美日韩精品电影| 成年人国产精品| 男女视频一区二区| 亚洲美女屁股眼交| 久久精品一区二区| 欧美一区二区视频在线观看 | 国产精品99久久久久久似苏梦涵| 国产精品日韩成人| 在线不卡欧美精品一区二区三区| 国产aⅴ精品一区二区三区色成熟| 亚洲国产欧美在线| 国产精品天干天干在观线| 欧美久久婷婷综合色| 国产成人午夜视频| 日本不卡免费在线视频| 综合色中文字幕| 久久久精品天堂| 欧美一级艳片视频免费观看| 91成人免费电影| 成人性色生活片| 国产中文字幕一区| 久久97超碰色| 另类专区欧美蜜桃臀第一页| 日韩精品一区第一页| 亚洲精品国产a久久久久久| 国产精品美女久久福利网站 | 韩国三级电影一区二区| 亚洲超碰精品一区二区| 国产精品电影一区二区三区| 久久欧美一区二区| 日韩精品一区二区三区蜜臀 | 99视频超级精品| 国产成人一级电影| 国产一区二区三区黄视频 | 亚洲人xxxx| 国产精品毛片久久久久久| 久久久久久久综合狠狠综合| 在线综合亚洲欧美在线视频| 欧美性色综合网| 在线视频中文字幕一区二区| 94色蜜桃网一区二区三区| 国产成人av网站| 成人h精品动漫一区二区三区| 国产精品资源在线观看| 国产成人高清在线| 成人福利视频在线| 99久久婷婷国产综合精品电影 | 亚洲一区二区三区四区在线观看| 国产精品久久久久久亚洲毛片| 国产精品私人自拍| 亚洲欧美另类小说| 亚洲成人午夜电影| 美国一区二区三区在线播放| 精品一区二区三区在线播放视频| 乱一区二区av| 高潮精品一区videoshd| 91丨porny丨首页| 欧美日韩国产美女| 精品蜜桃在线看| 国产精品久久久久久久久免费丝袜| 国产精品久久久久桃色tv| 亚洲精品欧美综合四区| 日韩福利电影在线观看| 国产成人亚洲综合a∨婷婷| 91在线视频官网| 欧美人狂配大交3d怪物一区| 精品久久久三级丝袜| 国产精品污www在线观看| 亚洲国产精品尤物yw在线观看| 蜜桃精品视频在线观看| 成人综合婷婷国产精品久久 | 国产一区二区视频在线| eeuss鲁片一区二区三区| 91精品视频网| 国产精品精品国产色婷婷| 天天av天天翘天天综合网| 国产福利精品一区二区| 欧美影院精品一区| 国产色91在线| 日产国产高清一区二区三区| 不卡的av中国片| 日韩一区二区精品在线观看| 中文字幕综合网| 国产一区二区不卡| 欧美精品1区2区3区| 亚洲欧洲av在线| 国产一区二区影院|