Demo code: add static modifiers (#1373)

Add "static" modifier to demo code to reduce global vars.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
This commit is contained in:
Florian La Roche 2025-09-17 07:27:53 +02:00 committed by GitHub
parent 62195136d1
commit bcef9d066a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 10 additions and 13 deletions

View file

@ -168,7 +168,7 @@ static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
static portBASE_TYPE xPriorityRaiseWhenSuspendedError = pdFALSE; static portBASE_TYPE xPriorityRaiseWhenSuspendedError = pdFALSE;
/* Queue used by the second test. */ /* Queue used by the second test. */
QueueHandle_t xSuspendedTestQueue; static QueueHandle_t xSuspendedTestQueue;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -124,13 +124,13 @@
static const char * pcControllingTaskName = "AbtCtrl", * pcBlockingTaskName = "AbtBlk"; static const char * pcControllingTaskName = "AbtCtrl", * pcBlockingTaskName = "AbtBlk";
/* The maximum amount of time a task will block for. */ /* The maximum amount of time a task will block for. */
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 ); static const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 );
const TickType_t xHalfMaxBlockTime = pdMS_TO_TICKS( 50 ); static const TickType_t xHalfMaxBlockTime = pdMS_TO_TICKS( 50 );
/* The actual block time is dependent on the priority of other tasks in the /* The actual block time is dependent on the priority of other tasks in the
* system so the actual block time might be greater than that expected, but it * system so the actual block time might be greater than that expected, but it
* should be within an acceptable upper bound. */ * should be within an acceptable upper bound. */
const TickType_t xAllowableMargin = pdMS_TO_TICKS( 7 ); static const TickType_t xAllowableMargin = pdMS_TO_TICKS( 7 );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -78,9 +78,6 @@
/* A block time of zero simply means "don't block". */ /* A block time of zero simply means "don't block". */
#define ebDONT_BLOCK ( 0 ) #define ebDONT_BLOCK ( 0 )
/* A 5ms delay. */
#define ebSHORT_DELAY pdMS_TO_TICKS( ( TickType_t ) 5 )
/* Used in the selective bits test which checks no, one or both tasks blocked on /* Used in the selective bits test which checks no, one or both tasks blocked on
* event bits in a group are unblocked as appropriate as different bits get set. */ * event bits in a group are unblocked as appropriate as different bits get set. */
#define ebSELECTIVE_BITS_1 0x03 #define ebSELECTIVE_BITS_1 0x03

View file

@ -123,7 +123,7 @@ static SemaphoreHandle_t xMasterSlaveMutex = NULL;
static BaseType_t xOkToGiveMutex = pdFALSE, xOkToGiveCountingSemaphore = pdFALSE; static BaseType_t xOkToGiveMutex = pdFALSE, xOkToGiveCountingSemaphore = pdFALSE;
/* Used to coordinate timing between tasks and the interrupt. */ /* Used to coordinate timing between tasks and the interrupt. */
const TickType_t xInterruptGivePeriod = pdMS_TO_TICKS( intsemINTERRUPT_MUTEX_GIVE_PERIOD_MS ); static const TickType_t xInterruptGivePeriod = pdMS_TO_TICKS( intsemINTERRUPT_MUTEX_GIVE_PERIOD_MS );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -121,7 +121,7 @@ static uint32_t ulCycleCounters[ mbaNUMBER_OF_CORE_B_TASKS ];
/* Set to pdFALSE if any errors are detected. Used to inform the check task /* Set to pdFALSE if any errors are detected. Used to inform the check task
* that something might be wrong. */ * that something might be wrong. */
BaseType_t xDemoStatus = pdPASS; static BaseType_t xDemoStatus = pdPASS;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -74,7 +74,7 @@ static volatile BaseType_t xErrorDetected = pdFALSE;
static volatile uint32_t ulLoopCounter = 0; static volatile uint32_t ulLoopCounter = 0;
/* Handles to the test tasks. */ /* Handles to the test tasks. */
TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask; static TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vStartQueuePeekTasks( void ) void vStartQueuePeekTasks( void )

View file

@ -203,7 +203,7 @@
static size_t uxNextRand = 0; static size_t uxNextRand = 0;
/* The task handles are stored so their priorities can be changed. */ /* The task handles are stored so their priorities can be changed. */
TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask; static TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -80,7 +80,7 @@ static const UBaseType_t uxMaxNumberOfExtraTasksRunning = 3;
/* Used to store a handle to the task that should be killed by a suicidal task, /* 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; static TaskHandle_t xCreatedTask;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -133,7 +133,7 @@ static volatile BaseType_t xSuspendedQueueSendError = pdFALSE;
static volatile BaseType_t xSuspendedQueueReceiveError = pdFALSE; static volatile BaseType_t xSuspendedQueueReceiveError = pdFALSE;
/* Queue used by the second test. */ /* Queue used by the second test. */
QueueHandle_t xSuspendedTestQueue; static QueueHandle_t xSuspendedTestQueue;
/* The value the queue receive task expects to receive next. This is file /* The value the queue receive task expects to receive next. This is file
* scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still * scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still