📄 main.c
字号:
/****************************************Copyright (c)**************************************************
nuaa tedden 导航研究中心 2008-12-9
FreeRTOS多任务调度测试
********************************************************************************************************/
#include "config.h"
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
#define mainNO_ERROR_FLASH_PERIOD ( ( portTickType ) 1000 / portTICK_RATE_MS )
static void Task1( void *pvParameters );
static void Task2( void *pvParameters );
static void Task3( void *pvParameters );
static void Task4( void *pvParameters );
static void Task5( void *pvParameters );
int main (void)
{// add user source code
TargetInit();
xTaskCreate( Task1, "Task1", configMINIMAL_STACK_SIZE, NULL, 1, NULL );
xTaskCreate( Task2, "Task2", configMINIMAL_STACK_SIZE, NULL, 2, NULL );
xTaskCreate( Task3, "Task3", configMINIMAL_STACK_SIZE, NULL, 3, NULL );
xTaskCreate( Task4, "Task4", configMINIMAL_STACK_SIZE, NULL, 4, NULL );
xTaskCreate( Task5, "Task5", configMINIMAL_STACK_SIZE, NULL, 5, NULL );
vTaskStartScheduler();
return 0;
}
static void Task1( void *pvParameters )
{
portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;
/* Parameters are not used. */
pvParameters = pvParameters;
for( ;; )
{
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
UART0_SendStr("Task1 Running!!");
UART0_SendByte('\n');
}
}
static void Task2( void *pvParameters )
{
portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD*2;
/* Parameters are not used. */
pvParameters = pvParameters;
for( ;; )
{
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
UART0_SendStr("Task2 Running!!");
UART0_SendByte('\n');
}
}
static void Task3( void *pvParameters )
{
portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD*3;
/* Parameters are not used. */
pvParameters = pvParameters;
for( ;; )
{
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
UART0_SendStr("Task3 Running!!");
UART0_SendByte('\n');
}
}
static void Task4( void *pvParameters )
{
portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD*4;
/* Parameters are not used. */
pvParameters = pvParameters;
for( ;; )
{
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
UART0_SendStr("Task4 Running!!");
UART0_SendByte('\n');
}
}
static void Task5( void *pvParameters )
{
portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD*5;
/* Parameters are not used. */
pvParameters = pvParameters;
for( ;; )
{
/* The period of the delay depends on whether an error has been
detected or not. If an error has been detected then the period
is reduced to increase the LED flash rate. */
vTaskDelay( xDelayPeriod );
UART0_SendStr("Task5 Running!!");
UART0_SendByte('\n');
}
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -