mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 00:37:44 -04:00
Add uncrustify github workflow (#659)
* Add uncrustify github workflow * Fix exclusion pattern * fix find expression * exclude uncrustify files * Uncrustify common demo and test files * exlude white space checking files * Fix EOL whitespace checker * Remove whitespaces from EOL * Fix space at EOL * Fix find spaces at EOL Co-authored-by: Archit Aggarwal <architag@amazon.com>
This commit is contained in:
parent
dd80d615b5
commit
ae92d8c6ee
191 changed files with 17540 additions and 17102 deletions
|
@ -54,150 +54,148 @@
|
|||
/* Demo program include files. */
|
||||
#include "death.h"
|
||||
|
||||
#define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 60 )
|
||||
#define deathSTACK_SIZE ( configMINIMAL_STACK_SIZE + 60 )
|
||||
|
||||
/* The task originally created which is responsible for periodically dynamically
|
||||
creating another four tasks. */
|
||||
* creating another four tasks. */
|
||||
static portTASK_FUNCTION_PROTO( vCreateTasks, pvParameters );
|
||||
|
||||
/* The task function of the dynamically created tasks. */
|
||||
static portTASK_FUNCTION_PROTO( vSuicidalTask, pvParameters );
|
||||
|
||||
/* A variable which is incremented every time the dynamic tasks are created. This
|
||||
is used to check that the task is still running. */
|
||||
* is used to check that the task is still running. */
|
||||
static volatile uint16_t usCreationCount = 0;
|
||||
|
||||
/* Used to store the number of tasks that were originally running so the creator
|
||||
task can tell if any of the suicidal tasks have failed to die.
|
||||
*/
|
||||
* task can tell if any of the suicidal tasks have failed to die.
|
||||
*/
|
||||
static volatile UBaseType_t uxTasksRunningAtStart = 0;
|
||||
|
||||
/* When a task deletes itself, it stack and TCB are cleaned up by the Idle task.
|
||||
Under heavy load the idle task might not get much processing time, so it would
|
||||
be legitimate for several tasks to remain undeleted for a short period. There
|
||||
may also be a few other unexpected tasks if, for example, the tasks that test
|
||||
static allocation are also being used. */
|
||||
* Under heavy load the idle task might not get much processing time, so it would
|
||||
* be legitimate for several tasks to remain undeleted for a short period. There
|
||||
* may also be a few other unexpected tasks if, for example, the tasks that test
|
||||
* static allocation are also being used. */
|
||||
static const UBaseType_t uxMaxNumberOfExtraTasksRunning = 3;
|
||||
|
||||
/* Used to store a handle to the task that should be killed by a suicidal task,
|
||||
before it kills itself. */
|
||||
* before it kills itself. */
|
||||
TaskHandle_t xCreatedTask;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vCreateSuicidalTasks( UBaseType_t uxPriority )
|
||||
{
|
||||
xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) NULL, uxPriority, NULL );
|
||||
xTaskCreate( vCreateTasks, "CREATOR", deathSTACK_SIZE, ( void * ) NULL, uxPriority, NULL );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portTASK_FUNCTION( vSuicidalTask, pvParameters )
|
||||
{
|
||||
volatile long l1, l2;
|
||||
TaskHandle_t xTaskToKill;
|
||||
const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 200 );
|
||||
volatile long l1, l2;
|
||||
TaskHandle_t xTaskToKill;
|
||||
const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 200 );
|
||||
|
||||
/* Test deletion of a task's secure context, if any. */
|
||||
portALLOCATE_SECURE_CONTEXT( configMINIMAL_SECURE_STACK_SIZE );
|
||||
/* Test deletion of a task's secure context, if any. */
|
||||
portALLOCATE_SECURE_CONTEXT( configMINIMAL_SECURE_STACK_SIZE );
|
||||
|
||||
if( pvParameters != NULL )
|
||||
{
|
||||
/* This task is periodically created four times. Two created tasks are
|
||||
passed a handle to the other task so it can kill it before killing itself.
|
||||
The other task is passed in null. */
|
||||
xTaskToKill = *( TaskHandle_t* )pvParameters;
|
||||
}
|
||||
else
|
||||
{
|
||||
xTaskToKill = NULL;
|
||||
}
|
||||
if( pvParameters != NULL )
|
||||
{
|
||||
/* This task is periodically created four times. Two created tasks are
|
||||
* passed a handle to the other task so it can kill it before killing itself.
|
||||
* The other task is passed in null. */
|
||||
xTaskToKill = *( TaskHandle_t * ) pvParameters;
|
||||
}
|
||||
else
|
||||
{
|
||||
xTaskToKill = NULL;
|
||||
}
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Do something random just to use some stack and registers. */
|
||||
l1 = 2;
|
||||
l2 = 89;
|
||||
l2 *= l1;
|
||||
vTaskDelay( xDelay );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Do something random just to use some stack and registers. */
|
||||
l1 = 2;
|
||||
l2 = 89;
|
||||
l2 *= l1;
|
||||
vTaskDelay( xDelay );
|
||||
|
||||
if( xTaskToKill != NULL )
|
||||
{
|
||||
/* Make sure the other task has a go before we delete it. */
|
||||
vTaskDelay( ( TickType_t ) 0 );
|
||||
if( xTaskToKill != NULL )
|
||||
{
|
||||
/* Make sure the other task has a go before we delete it. */
|
||||
vTaskDelay( ( TickType_t ) 0 );
|
||||
|
||||
/* Kill the other task that was created by vCreateTasks(). */
|
||||
vTaskDelete( xTaskToKill );
|
||||
/* Kill the other task that was created by vCreateTasks(). */
|
||||
vTaskDelete( xTaskToKill );
|
||||
|
||||
/* Kill ourselves. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
}/*lint !e818 !e550 Function prototype must be as per standard for task functions. */
|
||||
/* Kill ourselves. */
|
||||
vTaskDelete( NULL );
|
||||
}
|
||||
}
|
||||
} /*lint !e818 !e550 Function prototype must be as per standard for task functions. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portTASK_FUNCTION( vCreateTasks, pvParameters )
|
||||
{
|
||||
const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 1000 );
|
||||
UBaseType_t uxPriority;
|
||||
const TickType_t xDelay = pdMS_TO_TICKS( ( TickType_t ) 1000 );
|
||||
UBaseType_t uxPriority;
|
||||
|
||||
/* Remove compiler warning about unused parameter. */
|
||||
( void ) pvParameters;
|
||||
/* Remove compiler warning about unused parameter. */
|
||||
( void ) pvParameters;
|
||||
|
||||
/* Delay at the start to ensure tasks created by other demos have been
|
||||
created before storing the current number of tasks. */
|
||||
vTaskDelay( xDelay );
|
||||
uxTasksRunningAtStart = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
/* Delay at the start to ensure tasks created by other demos have been
|
||||
* created before storing the current number of tasks. */
|
||||
vTaskDelay( xDelay );
|
||||
uxTasksRunningAtStart = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
|
||||
uxPriority = uxTaskPriorityGet( NULL );
|
||||
uxPriority = uxTaskPriorityGet( NULL );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Just loop round, delaying then creating the four suicidal tasks. */
|
||||
vTaskDelay( xDelay );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Just loop round, delaying then creating the four suicidal tasks. */
|
||||
vTaskDelay( xDelay );
|
||||
|
||||
xCreatedTask = NULL;
|
||||
xCreatedTask = NULL;
|
||||
|
||||
xTaskCreate( vSuicidalTask, "SUICID1", configMINIMAL_STACK_SIZE, NULL, uxPriority, &xCreatedTask );
|
||||
xTaskCreate( vSuicidalTask, "SUICID2", configMINIMAL_STACK_SIZE, &xCreatedTask, uxPriority, NULL );
|
||||
xTaskCreate( vSuicidalTask, "SUICID1", configMINIMAL_STACK_SIZE, NULL, uxPriority, &xCreatedTask );
|
||||
xTaskCreate( vSuicidalTask, "SUICID2", configMINIMAL_STACK_SIZE, &xCreatedTask, uxPriority, NULL );
|
||||
|
||||
++usCreationCount;
|
||||
}
|
||||
++usCreationCount;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* This is called to check that the creator task is still running and that there
|
||||
are not any more than four extra tasks. */
|
||||
* are not any more than four extra tasks. */
|
||||
BaseType_t xIsCreateTaskStillRunning( void )
|
||||
{
|
||||
static uint16_t usLastCreationCount = 0xfff;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
static UBaseType_t uxTasksRunningNow;
|
||||
static uint16_t usLastCreationCount = 0xfff;
|
||||
BaseType_t xReturn = pdTRUE;
|
||||
static UBaseType_t uxTasksRunningNow;
|
||||
|
||||
if( usLastCreationCount == usCreationCount )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
usLastCreationCount = usCreationCount;
|
||||
}
|
||||
if( usLastCreationCount == usCreationCount )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
usLastCreationCount = usCreationCount;
|
||||
}
|
||||
|
||||
uxTasksRunningNow = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
uxTasksRunningNow = ( UBaseType_t ) uxTaskGetNumberOfTasks();
|
||||
|
||||
if( uxTasksRunningNow < uxTasksRunningAtStart )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else if( ( uxTasksRunningNow - uxTasksRunningAtStart ) > uxMaxNumberOfExtraTasksRunning )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Everything is okay. */
|
||||
}
|
||||
if( uxTasksRunningNow < uxTasksRunningAtStart )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else if( ( uxTasksRunningNow - uxTasksRunningAtStart ) > uxMaxNumberOfExtraTasksRunning )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Everything is okay. */
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue