Skip to content

Commit bcef9d0

Browse files
authored
Demo code: add static modifiers (FreeRTOS#1373)
Add "static" modifier to demo code to reduce global vars. Signed-off-by: Florian La Roche <[email protected]>
1 parent 6219513 commit bcef9d0

File tree

9 files changed

+10
-13
lines changed

9 files changed

+10
-13
lines changed

FreeRTOS/Demo/Common/Full/dynamic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
168168
static portBASE_TYPE xPriorityRaiseWhenSuspendedError = pdFALSE;
169169

170170
/* Queue used by the second test. */
171-
QueueHandle_t xSuspendedTestQueue;
171+
static QueueHandle_t xSuspendedTestQueue;
172172

173173
/*-----------------------------------------------------------*/
174174

FreeRTOS/Demo/Common/Minimal/AbortDelay.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@
124124
static const char * pcControllingTaskName = "AbtCtrl", * pcBlockingTaskName = "AbtBlk";
125125

126126
/* The maximum amount of time a task will block for. */
127-
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 );
128-
const TickType_t xHalfMaxBlockTime = pdMS_TO_TICKS( 50 );
127+
static const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 100 );
128+
static const TickType_t xHalfMaxBlockTime = pdMS_TO_TICKS( 50 );
129129

130130
/* The actual block time is dependent on the priority of other tasks in the
131131
* system so the actual block time might be greater than that expected, but it
132132
* should be within an acceptable upper bound. */
133-
const TickType_t xAllowableMargin = pdMS_TO_TICKS( 7 );
133+
static const TickType_t xAllowableMargin = pdMS_TO_TICKS( 7 );
134134

135135
/*-----------------------------------------------------------*/
136136

FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
/* A block time of zero simply means "don't block". */
7979
#define ebDONT_BLOCK ( 0 )
8080

81-
/* A 5ms delay. */
82-
#define ebSHORT_DELAY pdMS_TO_TICKS( ( TickType_t ) 5 )
83-
8481
/* Used in the selective bits test which checks no, one or both tasks blocked on
8582
* event bits in a group are unblocked as appropriate as different bits get set. */
8683
#define ebSELECTIVE_BITS_1 0x03

FreeRTOS/Demo/Common/Minimal/IntSemTest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ static SemaphoreHandle_t xMasterSlaveMutex = NULL;
123123
static BaseType_t xOkToGiveMutex = pdFALSE, xOkToGiveCountingSemaphore = pdFALSE;
124124

125125
/* Used to coordinate timing between tasks and the interrupt. */
126-
const TickType_t xInterruptGivePeriod = pdMS_TO_TICKS( intsemINTERRUPT_MUTEX_GIVE_PERIOD_MS );
126+
static const TickType_t xInterruptGivePeriod = pdMS_TO_TICKS( intsemINTERRUPT_MUTEX_GIVE_PERIOD_MS );
127127

128128
/*-----------------------------------------------------------*/
129129

FreeRTOS/Demo/Common/Minimal/MessageBufferAMP.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static uint32_t ulCycleCounters[ mbaNUMBER_OF_CORE_B_TASKS ];
121121

122122
/* Set to pdFALSE if any errors are detected. Used to inform the check task
123123
* that something might be wrong. */
124-
BaseType_t xDemoStatus = pdPASS;
124+
static BaseType_t xDemoStatus = pdPASS;
125125

126126
/*-----------------------------------------------------------*/
127127

FreeRTOS/Demo/Common/Minimal/QPeek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static volatile BaseType_t xErrorDetected = pdFALSE;
7474
static volatile uint32_t ulLoopCounter = 0;
7575

7676
/* Handles to the test tasks. */
77-
TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
77+
static TaskHandle_t xMediumPriorityTask, xHighPriorityTask, xHighestPriorityTask;
7878
/*-----------------------------------------------------------*/
7979

8080
void vStartQueuePeekTasks( void )

FreeRTOS/Demo/Common/Minimal/QueueSet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
static size_t uxNextRand = 0;
204204

205205
/* The task handles are stored so their priorities can be changed. */
206-
TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;
206+
static TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;
207207

208208
/*-----------------------------------------------------------*/
209209

FreeRTOS/Demo/Common/Minimal/death.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static const UBaseType_t uxMaxNumberOfExtraTasksRunning = 3;
8080

8181
/* Used to store a handle to the task that should be killed by a suicidal task,
8282
* before it kills itself. */
83-
TaskHandle_t xCreatedTask;
83+
static TaskHandle_t xCreatedTask;
8484

8585
/*-----------------------------------------------------------*/
8686

FreeRTOS/Demo/Common/Minimal/dynamic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static volatile BaseType_t xSuspendedQueueSendError = pdFALSE;
133133
static volatile BaseType_t xSuspendedQueueReceiveError = pdFALSE;
134134

135135
/* Queue used by the second test. */
136-
QueueHandle_t xSuspendedTestQueue;
136+
static QueueHandle_t xSuspendedTestQueue;
137137

138138
/* The value the queue receive task expects to receive next. This is file
139139
* scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still

0 commit comments

Comments
 (0)