mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-22 01:30:31 -05: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
|
||||
|
|
@ -52,9 +52,9 @@
|
|||
#include "task.h"
|
||||
|
||||
/* Hardware register addresses. */
|
||||
#define mainVTOR ( * ( uint32_t * ) 0xE000ED08 )
|
||||
#define mainNVIC_AUX_ACTLR ( * ( uint32_t * ) 0xE000E008 )
|
||||
#define mainEC_INTERRUPT_CONTROL ( * ( volatile uint32_t * ) 0x4000FC18 )
|
||||
#define mainVTOR ( *( uint32_t * ) 0xE000ED08 )
|
||||
#define mainNVIC_AUX_ACTLR ( *( uint32_t * ) 0xE000E008 )
|
||||
#define mainEC_INTERRUPT_CONTROL ( *( volatile uint32_t * ) 0x4000FC18 )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -67,193 +67,197 @@ static void prvSetupHardware( void );
|
|||
* main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1.
|
||||
* main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0.
|
||||
*/
|
||||
#if( configCREATE_LOW_POWER_DEMO == 1 )
|
||||
#if ( configCREATE_LOW_POWER_DEMO == 1 )
|
||||
|
||||
extern void main_low_power( void );
|
||||
extern void main_low_power( void );
|
||||
|
||||
#else
|
||||
|
||||
extern void main_full( void );
|
||||
extern void main_full( void );
|
||||
|
||||
/* Some of the tests and examples executed as part of the full demo make use
|
||||
of the tick hook to call API functions from an interrupt context. */
|
||||
extern void vFullDemoTickHook( void );
|
||||
/* Some of the tests and examples executed as part of the full demo make use
|
||||
* of the tick hook to call API functions from an interrupt context. */
|
||||
extern void vFullDemoTickHook( void );
|
||||
|
||||
#endif /* #if configCREATE_LOW_POWER_DEMO == 1 */
|
||||
|
||||
/* Prototypes for the standard FreeRTOS callback/hook functions implemented
|
||||
within this file. */
|
||||
* within this file. */
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char * pcTaskName );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The variable that is incremented to represent each LED toggle. On the
|
||||
clicker hardware the LED state is set to the value of the least significant bit
|
||||
of this variable. On other hardware, where an LED is not used, the LED just
|
||||
keeps a count of the number of times the LED would otherwise have been toggled.
|
||||
See the comments in main_low_power.c and main_full.c for information on the
|
||||
expected LED toggle rate). */
|
||||
* clicker hardware the LED state is set to the value of the least significant bit
|
||||
* of this variable. On other hardware, where an LED is not used, the LED just
|
||||
* keeps a count of the number of times the LED would otherwise have been toggled.
|
||||
* See the comments in main_low_power.c and main_full.c for information on the
|
||||
* expected LED toggle rate). */
|
||||
volatile uint32_t ulLED = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main( void )
|
||||
{
|
||||
/* See http://www.freertos.org/Microchip_CEC1302_ARM_Cortex-M4F_Low_Power_Demo.html */
|
||||
/* See http://www.freertos.org/Microchip_CEC1302_ARM_Cortex-M4F_Low_Power_Demo.html */
|
||||
|
||||
/* Configure the hardware ready to run the demo. */
|
||||
prvSetupHardware();
|
||||
/* Configure the hardware ready to run the demo. */
|
||||
prvSetupHardware();
|
||||
|
||||
/* The configCREATE_LOW_POWER_DEMO setting is described at the top
|
||||
of this file. */
|
||||
#if( configCREATE_LOW_POWER_DEMO == 1 )
|
||||
{
|
||||
/* The low power demo also demonstrated aggregated interrupts, so clear
|
||||
the interrupt control register to disable the alternative NVIC vectors. */
|
||||
mainEC_INTERRUPT_CONTROL = pdFALSE;
|
||||
/* The configCREATE_LOW_POWER_DEMO setting is described at the top
|
||||
* of this file. */
|
||||
#if ( configCREATE_LOW_POWER_DEMO == 1 )
|
||||
{
|
||||
/* The low power demo also demonstrated aggregated interrupts, so clear
|
||||
* the interrupt control register to disable the alternative NVIC vectors. */
|
||||
mainEC_INTERRUPT_CONTROL = pdFALSE;
|
||||
|
||||
main_low_power();
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* The full demo also demonstrated disaggregated interrupts, so set the
|
||||
interrupt control register to enable the alternative NVIC vectors. */
|
||||
mainEC_INTERRUPT_CONTROL = pdTRUE;
|
||||
main_low_power();
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* The full demo also demonstrated disaggregated interrupts, so set the
|
||||
* interrupt control register to enable the alternative NVIC vectors. */
|
||||
mainEC_INTERRUPT_CONTROL = pdTRUE;
|
||||
|
||||
main_full();
|
||||
}
|
||||
#endif
|
||||
main_full();
|
||||
}
|
||||
#endif /* if ( configCREATE_LOW_POWER_DEMO == 1 ) */
|
||||
|
||||
/* Should not get here. */
|
||||
return 0;
|
||||
/* Should not get here. */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
extern void system_set_ec_clock( void );
|
||||
extern unsigned long __Vectors[];
|
||||
extern void system_set_ec_clock( void );
|
||||
extern unsigned long __Vectors[];
|
||||
|
||||
/* Disable M4 write buffer: fix CEC1302 hardware bug. */
|
||||
mainNVIC_AUX_ACTLR |= 0x07;
|
||||
/* Disable M4 write buffer: fix CEC1302 hardware bug. */
|
||||
mainNVIC_AUX_ACTLR |= 0x07;
|
||||
|
||||
system_set_ec_clock();
|
||||
system_set_ec_clock();
|
||||
|
||||
/* Assuming downloading code via the debugger - so ensure the hardware
|
||||
is using the vector table downloaded with the application. */
|
||||
mainVTOR = ( uint32_t ) __Vectors;
|
||||
/* Assuming downloading code via the debugger - so ensure the hardware
|
||||
* is using the vector table downloaded with the application. */
|
||||
mainVTOR = ( uint32_t ) __Vectors;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
internally by FreeRTOS API functions that create tasks, queues, software
|
||||
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
||||
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||
* free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||
* internally by FreeRTOS API functions that create tasks, queues, software
|
||||
* timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||
* configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
||||
|
||||
/* Force an assert. */
|
||||
configASSERT( ( volatile void * ) NULL );
|
||||
/* Force an assert. */
|
||||
configASSERT( ( volatile void * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char * pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. */
|
||||
/* Run time stack overflow checking is performed if
|
||||
* configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
* function is called if a stack overflow is detected. */
|
||||
|
||||
/* Force an assert. */
|
||||
configASSERT( ( volatile void * ) NULL );
|
||||
/* Force an assert. */
|
||||
configASSERT( ( volatile void * ) NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
volatile size_t xFreeHeapSpace;
|
||||
volatile size_t xFreeHeapSpace;
|
||||
|
||||
/* This is just a trivial example of an idle hook. It is called on each
|
||||
cycle of the idle task. It must *NOT* attempt to block. In this case the
|
||||
idle task just queries the amount of FreeRTOS heap that remains. See the
|
||||
memory management section on the http://www.FreeRTOS.org web site for memory
|
||||
management options. If there is a lot of heap memory free then the
|
||||
configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
|
||||
RAM. */
|
||||
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||
/* This is just a trivial example of an idle hook. It is called on each
|
||||
* cycle of the idle task. It must *NOT* attempt to block. In this case the
|
||||
* idle task just queries the amount of FreeRTOS heap that remains. See the
|
||||
* memory management section on the http://www.FreeRTOS.org web site for memory
|
||||
* management options. If there is a lot of heap memory free then the
|
||||
* configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
|
||||
* RAM. */
|
||||
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||
|
||||
/* Remove compiler warning about xFreeHeapSpace being set but never used. */
|
||||
( void ) xFreeHeapSpace;
|
||||
/* Remove compiler warning about xFreeHeapSpace being set but never used. */
|
||||
( void ) xFreeHeapSpace;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* The full demo includes tests that run from the tick hook. */
|
||||
#if( configCREATE_LOW_POWER_DEMO == 0 )
|
||||
{
|
||||
/* Some of the tests and demo tasks executed by the full demo include
|
||||
interaction from an interrupt - for which the tick interrupt is used
|
||||
via the tick hook function. */
|
||||
vFullDemoTickHook();
|
||||
}
|
||||
#endif
|
||||
/* The full demo includes tests that run from the tick hook. */
|
||||
#if ( configCREATE_LOW_POWER_DEMO == 0 )
|
||||
{
|
||||
/* Some of the tests and demo tasks executed by the full demo include
|
||||
* interaction from an interrupt - for which the tick interrupt is used
|
||||
* via the tick hook function. */
|
||||
vFullDemoTickHook();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
|
||||
* implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
* used by the Idle task. */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
|
||||
StackType_t ** ppxIdleTaskStackBuffer,
|
||||
uint32_t * pulIdleTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Idle task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xIdleTaskTCB;
|
||||
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Idle task's
|
||||
* state will be stored. */
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
/* Pass out the array that will be used as the Idle task's stack. */
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
|
||||
application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )
|
||||
* application must provide an implementation of vApplicationGetTimerTaskMemory()
|
||||
* to provide the memory that is used by the Timer service task. */
|
||||
void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
|
||||
StackType_t ** ppxTimerTaskStackBuffer,
|
||||
uint32_t * pulTimerTaskStackSize )
|
||||
{
|
||||
/* If the buffers to be provided to the Timer task are declared inside this
|
||||
function then they must be declared static - otherwise they will be allocated on
|
||||
the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
* function then they must be declared static - otherwise they will be allocated on
|
||||
* the stack and so not exists after this function exits. */
|
||||
static StaticTask_t xTimerTaskTCB;
|
||||
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
|
||||
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
/* Pass out a pointer to the StaticTask_t structure in which the Timer
|
||||
* task's state will be stored. */
|
||||
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
|
||||
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
/* Pass out the array that will be used as the Timer task's stack. */
|
||||
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
|
||||
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
Note that, as the array is necessarily of type StackType_t,
|
||||
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
|
||||
* Note that, as the array is necessarily of type StackType_t,
|
||||
* configMINIMAL_STACK_SIZE is specified in words, not bytes. */
|
||||
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue