mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-26 23:36:32 -04:00
Fix formatting in kernel demo application files (#1148)
* Fix formatting in kernel demo application files * Fix header check fail in the demo files * Add ignored patterns in core header check file * Fix formatting * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationMallocFailedHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Fix formatting AVR32_UC3 --------- Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
This commit is contained in:
parent
85ed21bcfb
commit
121fbe295b
169 changed files with 22211 additions and 21557 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeRTOS V202212.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
|
@ -66,41 +66,41 @@
|
|||
#include "dynamic.h"
|
||||
|
||||
/* Demo application task priorities. */
|
||||
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 )
|
||||
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
#define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
|
||||
/* How often should we check the other tasks? */
|
||||
#define mainCHECK_TASK_CYCLE_TIME ( 3000 )
|
||||
#define mainCHECK_TASK_CYCLE_TIME ( 3000 )
|
||||
|
||||
/* The maximum offset into the pass and fail strings sent to the LCD. An
|
||||
offset is used a simple method of using a different column each time a message
|
||||
is written to the LCD. */
|
||||
#define mainMAX_WRITE_COLUMN ( 14 )
|
||||
* offset is used a simple method of using a different column each time a message
|
||||
* is written to the LCD. */
|
||||
#define mainMAX_WRITE_COLUMN ( 14 )
|
||||
|
||||
/* Baud rate used by the comtest tasks. */
|
||||
#define mainCOM_TEST_BAUD_RATE ( 19200 )
|
||||
#define mainCOM_TEST_BAUD_RATE ( 19200 )
|
||||
|
||||
/* The LED used by the comtest tasks. See the comtest.c file for more
|
||||
information. */
|
||||
#define mainCOM_TEST_LED ( 3 )
|
||||
* information. */
|
||||
#define mainCOM_TEST_LED ( 3 )
|
||||
|
||||
/* The number of messages that can be queued for display on the LCD at any one
|
||||
time. */
|
||||
#define mainLCD_QUEUE_LENGTH ( 2 )
|
||||
* time. */
|
||||
#define mainLCD_QUEUE_LENGTH ( 2 )
|
||||
|
||||
/* The time to wait when sending to mainLCD_QUEUE_LENGTH. */
|
||||
#define mainNO_DELAY ( 0 )
|
||||
#define mainNO_DELAY ( 0 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The type that is posted to the LCD queue. */
|
||||
typedef struct LCD_MESSAGE
|
||||
{
|
||||
unsigned char *pucString; /* Points to the string to be displayed. */
|
||||
unsigned char ucLine; /* The line of the LCD that should be used. */
|
||||
unsigned char * pucString; /* Points to the string to be displayed. */
|
||||
unsigned char ucLine; /* The line of the LCD that should be used. */
|
||||
} LCDMessage;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
@ -110,12 +110,12 @@ typedef struct LCD_MESSAGE
|
|||
* all the other tasks in the system. See the description at the top of the
|
||||
* file.
|
||||
*/
|
||||
static void vCheckTask( void *pvParameters );
|
||||
static void vCheckTask( void * pvParameters );
|
||||
|
||||
/*
|
||||
* ST provided routine to configure the processor.
|
||||
*/
|
||||
static void prvSetupHardware(void);
|
||||
static void prvSetupHardware( void );
|
||||
|
||||
/*
|
||||
* The only task that should access the LCD. Other tasks wanting to write
|
||||
|
|
@ -124,7 +124,7 @@ static void prvSetupHardware(void);
|
|||
* waiting for the arrival of such messages, displays the message, then blocks
|
||||
* again.
|
||||
*/
|
||||
static void vPrintTask( void *pvParameters );
|
||||
static void vPrintTask( void * pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -136,174 +136,177 @@ static QueueHandle_t xLCDQueue;
|
|||
/* Create all the demo application tasks, then start the scheduler. */
|
||||
void main( void )
|
||||
{
|
||||
/* Perform any hardware setup necessary. */
|
||||
prvSetupHardware();
|
||||
vParTestInitialise();
|
||||
/* Perform any hardware setup necessary. */
|
||||
prvSetupHardware();
|
||||
vParTestInitialise();
|
||||
|
||||
/* Create the queue used to communicate with the LCD print task. */
|
||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
||||
/* Create the queue used to communicate with the LCD print task. */
|
||||
xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );
|
||||
|
||||
/* Create the standard demo application tasks. See the WEB documentation
|
||||
for more information on these tasks. */
|
||||
vCreateBlockTimeTasks();
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||
/* Create the standard demo application tasks. See the WEB documentation
|
||||
* for more information on these tasks. */
|
||||
vCreateBlockTimeTasks();
|
||||
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
|
||||
vStartIntegerMathTasks( tskIDLE_PRIORITY );
|
||||
|
||||
/* Create the tasks defined within this file. */
|
||||
xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
/* Create the tasks defined within this file. */
|
||||
xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );
|
||||
xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||
|
||||
vTaskStartScheduler();
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* Execution will only reach here if there was insufficient heap to
|
||||
start the scheduler. */
|
||||
/* Execution will only reach here if there was insufficient heap to
|
||||
* start the scheduler. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vCheckTask( void *pvParameters )
|
||||
static void vCheckTask( void * pvParameters )
|
||||
{
|
||||
static unsigned long ulErrorDetected = pdFALSE;
|
||||
TickType_t xLastExecutionTime;
|
||||
unsigned char *cErrorMessage = " FAIL";
|
||||
unsigned char *cSuccessMessage = " PASS";
|
||||
unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN;
|
||||
LCDMessage xMessage;
|
||||
static unsigned long ulErrorDetected = pdFALSE;
|
||||
TickType_t xLastExecutionTime;
|
||||
unsigned char * cErrorMessage = " FAIL";
|
||||
unsigned char * cSuccessMessage = " PASS";
|
||||
unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN;
|
||||
LCDMessage xMessage;
|
||||
|
||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||
works correctly. */
|
||||
xLastExecutionTime = xTaskGetTickCount();
|
||||
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||
* works correctly. */
|
||||
xLastExecutionTime = xTaskGetTickCount();
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until it is time for the next cycle. */
|
||||
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Wait until it is time for the next cycle. */
|
||||
vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );
|
||||
|
||||
/* Has an error been found in any of the standard demo tasks? */
|
||||
/* Has an error been found in any of the standard demo tasks? */
|
||||
|
||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
if( xAreComTestTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
|
||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||
{
|
||||
ulErrorDetected = pdTRUE;
|
||||
}
|
||||
|
||||
/* Calculate the LCD line on which we would like the message to
|
||||
be displayed. The column variable is used for convenience as
|
||||
it is incremented each cycle anyway. */
|
||||
xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 );
|
||||
/* Calculate the LCD line on which we would like the message to
|
||||
* be displayed. The column variable is used for convenience as
|
||||
* it is incremented each cycle anyway. */
|
||||
xMessage.ucLine = ( unsigned char ) ( uxColumn & 0x01 );
|
||||
|
||||
/* The message displayed depends on whether an error was found or
|
||||
not. Any discovered error is latched. Here the column variable
|
||||
is used as an index into the text string as a simple way of moving
|
||||
the text from column to column. */
|
||||
if( ulErrorDetected == pdFALSE )
|
||||
{
|
||||
xMessage.pucString = cSuccessMessage + uxColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
xMessage.pucString = cErrorMessage + uxColumn;
|
||||
}
|
||||
/* The message displayed depends on whether an error was found or
|
||||
* not. Any discovered error is latched. Here the column variable
|
||||
* is used as an index into the text string as a simple way of moving
|
||||
* the text from column to column. */
|
||||
if( ulErrorDetected == pdFALSE )
|
||||
{
|
||||
xMessage.pucString = cSuccessMessage + uxColumn;
|
||||
}
|
||||
else
|
||||
{
|
||||
xMessage.pucString = cErrorMessage + uxColumn;
|
||||
}
|
||||
|
||||
/* Send the message to the print task for display. */
|
||||
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
||||
/* Send the message to the print task for display. */
|
||||
xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );
|
||||
|
||||
/* Make sure the message is printed in a different column the next
|
||||
time around. */
|
||||
uxColumn--;
|
||||
if( uxColumn == 0 )
|
||||
{
|
||||
uxColumn = mainMAX_WRITE_COLUMN;
|
||||
}
|
||||
}
|
||||
/* Make sure the message is printed in a different column the next
|
||||
* time around. */
|
||||
uxColumn--;
|
||||
|
||||
if( uxColumn == 0 )
|
||||
{
|
||||
uxColumn = mainMAX_WRITE_COLUMN;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vPrintTask( void *pvParameters )
|
||||
static void vPrintTask( void * pvParameters )
|
||||
{
|
||||
LCDMessage xMessage;
|
||||
LCDMessage xMessage;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Wait until a message arrives. */
|
||||
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Wait until a message arrives. */
|
||||
while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS )
|
||||
{
|
||||
}
|
||||
|
||||
/* The message contains the text to display, and the line on which the
|
||||
text should be displayed. */
|
||||
LCD_Clear();
|
||||
LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText );
|
||||
}
|
||||
/* The message contains the text to display, and the line on which the
|
||||
* text should be displayed. */
|
||||
LCD_Clear();
|
||||
LCD_DisplayString( xMessage.ucLine, xMessage.pucString, BlackText );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware(void)
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
ErrorStatus OSC4MStartUpStatus01;
|
||||
ErrorStatus OSC4MStartUpStatus01;
|
||||
|
||||
/* ST provided routine. */
|
||||
/* ST provided routine. */
|
||||
|
||||
/* MRCC system reset */
|
||||
MRCC_DeInit();
|
||||
/* MRCC system reset */
|
||||
MRCC_DeInit();
|
||||
|
||||
/* Wait for OSC4M start-up */
|
||||
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
||||
/* Wait for OSC4M start-up */
|
||||
OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();
|
||||
|
||||
if(OSC4MStartUpStatus01 == SUCCESS)
|
||||
{
|
||||
/* Set HCLK to 60MHz */
|
||||
MRCC_HCLKConfig(MRCC_CKSYS_Div1);
|
||||
if( OSC4MStartUpStatus01 == SUCCESS )
|
||||
{
|
||||
/* Set HCLK to 60MHz */
|
||||
MRCC_HCLKConfig( MRCC_CKSYS_Div1 );
|
||||
|
||||
/* Set CKTIM to 60MHz */
|
||||
MRCC_CKTIMConfig(MRCC_HCLK_Div1);
|
||||
/* Set CKTIM to 60MHz */
|
||||
MRCC_CKTIMConfig( MRCC_HCLK_Div1 );
|
||||
|
||||
/* Set PCLK to 30MHz */
|
||||
MRCC_PCLKConfig(MRCC_CKTIM_Div2);
|
||||
/* Set PCLK to 30MHz */
|
||||
MRCC_PCLKConfig( MRCC_CKTIM_Div2 );
|
||||
|
||||
/* Enable Flash Burst mode */
|
||||
CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);
|
||||
/* Enable Flash Burst mode */
|
||||
CFG_FLASHBurstConfig( CFG_FLASHBurst_Enable );
|
||||
|
||||
/* Set CK_SYS to 60 MHz */
|
||||
MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);
|
||||
}
|
||||
/* Set CK_SYS to 60 MHz */
|
||||
MRCC_CKSYSConfig( MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15 );
|
||||
}
|
||||
|
||||
/* GPIO pins optimized for 3V3 operation */
|
||||
MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);
|
||||
/* GPIO pins optimized for 3V3 operation */
|
||||
MRCC_IOVoltageRangeConfig( MRCC_IOVoltageRange_3V3 );
|
||||
|
||||
/* GPIO clock source enable */
|
||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
|
||||
/* GPIO clock source enable */
|
||||
MRCC_PeripheralClockConfig( MRCC_Peripheral_GPIO, ENABLE );
|
||||
|
||||
/* EXTIT clock source enable */
|
||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);
|
||||
/* TB clock source enable */
|
||||
MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);
|
||||
/* EXTIT clock source enable */
|
||||
MRCC_PeripheralClockConfig( MRCC_Peripheral_EXTIT, ENABLE );
|
||||
/* TB clock source enable */
|
||||
MRCC_PeripheralClockConfig( MRCC_Peripheral_TB, ENABLE );
|
||||
|
||||
/* Initialize the demonstration menu */
|
||||
LCD_Init();
|
||||
/* Initialize the demonstration menu */
|
||||
LCD_Init();
|
||||
|
||||
LCD_DisplayString(Line1, "www.FreeRTOS.org", BlackText);
|
||||
LCD_DisplayString(Line2, " STR750 Demo ", BlackText);
|
||||
LCD_DisplayString( Line1, "www.FreeRTOS.org", BlackText );
|
||||
LCD_DisplayString( Line2, " STR750 Demo ", BlackText );
|
||||
|
||||
EIC_IRQCmd(ENABLE);
|
||||
EIC_IRQCmd( ENABLE );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue