mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-14 08:47:45 -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
|
@ -51,131 +51,132 @@
|
|||
/* Demo includes. */
|
||||
#include "QueueSetPolling.h"
|
||||
|
||||
#if( configUSE_QUEUE_SETS == 1 ) /* Remove tests if queue sets are not defined. */
|
||||
#if ( configUSE_QUEUE_SETS == 1 ) /* Remove tests if queue sets are not defined. */
|
||||
|
||||
/* The length of each created queue. */
|
||||
#define setpollQUEUE_LENGTH 10
|
||||
#define setpollQUEUE_LENGTH 10
|
||||
|
||||
/* Block times used in this demo. A block time or 0 means "don't block". */
|
||||
#define setpollDONT_BLOCK 0
|
||||
#define setpollDONT_BLOCK 0
|
||||
|
||||
/* The ISR sends to the queue every setpollISR_TX_PERIOD ticks. */
|
||||
#define queuesetISR_TX_PERIOD ( 50UL )
|
||||
#define queuesetISR_TX_PERIOD ( 50UL )
|
||||
|
||||
/*
|
||||
* The task that reads from the queue set.
|
||||
*/
|
||||
static void prvQueueSetReceivingTask( void *pvParameters );
|
||||
static void prvQueueSetReceivingTask( void * pvParameters );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queue that is added to the set. */
|
||||
static QueueHandle_t xQueue = NULL;
|
||||
static QueueHandle_t xQueue = NULL;
|
||||
|
||||
/* The handle of the queue set to which the queue is added. */
|
||||
static QueueSetHandle_t xQueueSet = NULL;
|
||||
static QueueSetHandle_t xQueueSet = NULL;
|
||||
|
||||
/* Set to pdFAIL if an error is detected by any queue set task.
|
||||
ulCycleCounter will only be incremented if xQueueSetTasksSatus equals pdPASS. */
|
||||
static volatile BaseType_t xQueueSetPollStatus = pdPASS;
|
||||
* ulCycleCounter will only be incremented if xQueueSetTasksSatus equals pdPASS. */
|
||||
static volatile BaseType_t xQueueSetPollStatus = pdPASS;
|
||||
|
||||
/* Counter used to ensure the task is still running. */
|
||||
static uint32_t ulCycleCounter = 0;
|
||||
static uint32_t ulCycleCounter = 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vStartQueueSetPollingTask( void )
|
||||
{
|
||||
/* Create the queue that is added to the set, the set, and add the queue to
|
||||
the set. */
|
||||
xQueue = xQueueCreate( setpollQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
xQueueSet = xQueueCreateSet( setpollQUEUE_LENGTH );
|
||||
void vStartQueueSetPollingTask( void )
|
||||
{
|
||||
/* Create the queue that is added to the set, the set, and add the queue to
|
||||
* the set. */
|
||||
xQueue = xQueueCreate( setpollQUEUE_LENGTH, sizeof( uint32_t ) );
|
||||
xQueueSet = xQueueCreateSet( setpollQUEUE_LENGTH );
|
||||
|
||||
if( ( xQueue != NULL ) && ( xQueueSet != NULL ) )
|
||||
{
|
||||
xQueueAddToSet( xQueue, xQueueSet );
|
||||
if( ( xQueue != NULL ) && ( xQueueSet != NULL ) )
|
||||
{
|
||||
xQueueAddToSet( xQueue, xQueueSet );
|
||||
|
||||
/* Create the task. */
|
||||
xTaskCreate( prvQueueSetReceivingTask, "SetPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
}
|
||||
}
|
||||
/* Create the task. */
|
||||
xTaskCreate( prvQueueSetReceivingTask, "SetPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvQueueSetReceivingTask( void *pvParameters )
|
||||
{
|
||||
uint32_t ulReceived, ulExpected = 0;
|
||||
QueueHandle_t xActivatedQueue;
|
||||
static void prvQueueSetReceivingTask( void * pvParameters )
|
||||
{
|
||||
uint32_t ulReceived, ulExpected = 0;
|
||||
QueueHandle_t xActivatedQueue;
|
||||
|
||||
/* Remove compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
/* Remove compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Is a message waiting? A block time is not used to ensure the queue
|
||||
set is polled while it is being written to from an interrupt. */
|
||||
xActivatedQueue = xQueueSelectFromSet( xQueueSet, setpollDONT_BLOCK );
|
||||
for( ; ; )
|
||||
{
|
||||
/* Is a message waiting? A block time is not used to ensure the queue
|
||||
* set is polled while it is being written to from an interrupt. */
|
||||
xActivatedQueue = xQueueSelectFromSet( xQueueSet, setpollDONT_BLOCK );
|
||||
|
||||
if( xActivatedQueue != NULL )
|
||||
{
|
||||
/* Reading from the queue should pass with a zero block time as
|
||||
this task will only run when something has been posted to a task
|
||||
in the queue set. */
|
||||
if( xQueueReceive( xActivatedQueue, &ulReceived, setpollDONT_BLOCK ) != pdPASS )
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
if( xActivatedQueue != NULL )
|
||||
{
|
||||
/* Reading from the queue should pass with a zero block time as
|
||||
* this task will only run when something has been posted to a task
|
||||
* in the queue set. */
|
||||
if( xQueueReceive( xActivatedQueue, &ulReceived, setpollDONT_BLOCK ) != pdPASS )
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
|
||||
if( ulReceived == ulExpected )
|
||||
{
|
||||
ulExpected++;
|
||||
}
|
||||
else
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
if( ulReceived == ulExpected )
|
||||
{
|
||||
ulExpected++;
|
||||
}
|
||||
else
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
|
||||
if( xQueueSetPollStatus == pdPASS )
|
||||
{
|
||||
ulCycleCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( xQueueSetPollStatus == pdPASS )
|
||||
{
|
||||
ulCycleCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vQueueSetPollingInterruptAccess( void )
|
||||
{
|
||||
static uint32_t ulCallCount = 0, ulValueToSend = 0;
|
||||
void vQueueSetPollingInterruptAccess( void )
|
||||
{
|
||||
static uint32_t ulCallCount = 0, ulValueToSend = 0;
|
||||
|
||||
/* It is intended that this function is called from the tick hook
|
||||
function, so each call is one tick period apart. */
|
||||
ulCallCount++;
|
||||
if( ulCallCount > queuesetISR_TX_PERIOD )
|
||||
{
|
||||
ulCallCount = 0;
|
||||
/* It is intended that this function is called from the tick hook
|
||||
* function, so each call is one tick period apart. */
|
||||
ulCallCount++;
|
||||
|
||||
if( xQueueSendFromISR( xQueue, ( void * ) &ulValueToSend, NULL ) == pdPASS )
|
||||
{
|
||||
/* Send the next value next time. */
|
||||
ulValueToSend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( ulCallCount > queuesetISR_TX_PERIOD )
|
||||
{
|
||||
ulCallCount = 0;
|
||||
|
||||
if( xQueueSendFromISR( xQueue, ( void * ) &ulValueToSend, NULL ) == pdPASS )
|
||||
{
|
||||
/* Send the next value next time. */
|
||||
ulValueToSend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xAreQueueSetPollTasksStillRunning( void )
|
||||
{
|
||||
static uint32_t ulLastCycleCounter = 0;
|
||||
BaseType_t xAreQueueSetPollTasksStillRunning( void )
|
||||
{
|
||||
static uint32_t ulLastCycleCounter = 0;
|
||||
|
||||
if( ulLastCycleCounter == ulCycleCounter )
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
if( ulLastCycleCounter == ulCycleCounter )
|
||||
{
|
||||
xQueueSetPollStatus = pdFAIL;
|
||||
}
|
||||
|
||||
ulLastCycleCounter = ulCycleCounter;
|
||||
ulLastCycleCounter = ulCycleCounter;
|
||||
|
||||
return xQueueSetPollStatus;
|
||||
}
|
||||
return xQueueSetPollStatus;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue