Skip to content

Commit 0d54d1c

Browse files
committed
Correct an err in queue.c introduced when previously updating behaviour when queue sets are used in combination with queue overwrites.
1 parent f5b5b2d commit 0d54d1c

File tree

4 files changed

+68
-41
lines changed

4 files changed

+68
-41
lines changed

FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/.project

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
</matcher>
220220
</filter>
221221
<filter>
222-
<id>1528755597221</id>
222+
<id>1580324678127</id>
223223
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
224224
<type>5</type>
225225
<matcher>
@@ -228,7 +228,7 @@
228228
</matcher>
229229
</filter>
230230
<filter>
231-
<id>1528755597236</id>
231+
<id>1580324678132</id>
232232
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
233233
<type>5</type>
234234
<matcher>
@@ -237,7 +237,7 @@
237237
</matcher>
238238
</filter>
239239
<filter>
240-
<id>1528755597244</id>
240+
<id>1580324678137</id>
241241
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
242242
<type>5</type>
243243
<matcher>
@@ -246,7 +246,7 @@
246246
</matcher>
247247
</filter>
248248
<filter>
249-
<id>1528755597250</id>
249+
<id>1580324678144</id>
250250
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
251251
<type>5</type>
252252
<matcher>
@@ -255,7 +255,7 @@
255255
</matcher>
256256
</filter>
257257
<filter>
258-
<id>1528755597254</id>
258+
<id>1580324678149</id>
259259
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
260260
<type>5</type>
261261
<matcher>
@@ -264,7 +264,7 @@
264264
</matcher>
265265
</filter>
266266
<filter>
267-
<id>1528755597258</id>
267+
<id>1580324678155</id>
268268
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
269269
<type>5</type>
270270
<matcher>
@@ -273,7 +273,7 @@
273273
</matcher>
274274
</filter>
275275
<filter>
276-
<id>1528755597263</id>
276+
<id>1580324678160</id>
277277
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
278278
<type>5</type>
279279
<matcher>
@@ -282,7 +282,7 @@
282282
</matcher>
283283
</filter>
284284
<filter>
285-
<id>1528755597267</id>
285+
<id>1580324678165</id>
286286
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
287287
<type>5</type>
288288
<matcher>
@@ -291,7 +291,7 @@
291291
</matcher>
292292
</filter>
293293
<filter>
294-
<id>1528755597271</id>
294+
<id>1580324678171</id>
295295
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
296296
<type>5</type>
297297
<matcher>
@@ -300,7 +300,7 @@
300300
</matcher>
301301
</filter>
302302
<filter>
303-
<id>1528755597278</id>
303+
<id>1580324678176</id>
304304
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
305305
<type>5</type>
306306
<matcher>
@@ -309,7 +309,7 @@
309309
</matcher>
310310
</filter>
311311
<filter>
312-
<id>1528755597282</id>
312+
<id>1580324678196</id>
313313
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
314314
<type>5</type>
315315
<matcher>
@@ -318,7 +318,7 @@
318318
</matcher>
319319
</filter>
320320
<filter>
321-
<id>1528755597288</id>
321+
<id>1580324678207</id>
322322
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
323323
<type>5</type>
324324
<matcher>
@@ -327,7 +327,7 @@
327327
</matcher>
328328
</filter>
329329
<filter>
330-
<id>1528755597292</id>
330+
<id>1580324678218</id>
331331
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
332332
<type>5</type>
333333
<matcher>
@@ -336,7 +336,7 @@
336336
</matcher>
337337
</filter>
338338
<filter>
339-
<id>1528755597302</id>
339+
<id>1580324678227</id>
340340
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
341341
<type>5</type>
342342
<matcher>
@@ -345,7 +345,7 @@
345345
</matcher>
346346
</filter>
347347
<filter>
348-
<id>1528755597306</id>
348+
<id>1580324678238</id>
349349
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
350350
<type>5</type>
351351
<matcher>
@@ -354,7 +354,7 @@
354354
</matcher>
355355
</filter>
356356
<filter>
357-
<id>1528755597310</id>
357+
<id>1580324678249</id>
358358
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
359359
<type>5</type>
360360
<matcher>
@@ -363,7 +363,7 @@
363363
</matcher>
364364
</filter>
365365
<filter>
366-
<id>1528755597314</id>
366+
<id>1580324678260</id>
367367
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
368368
<type>5</type>
369369
<matcher>
@@ -372,7 +372,7 @@
372372
</matcher>
373373
</filter>
374374
<filter>
375-
<id>1528755597318</id>
375+
<id>1580324678271</id>
376376
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
377377
<type>5</type>
378378
<matcher>
@@ -381,7 +381,7 @@
381381
</matcher>
382382
</filter>
383383
<filter>
384-
<id>1528755597321</id>
384+
<id>1580324678282</id>
385385
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
386386
<type>5</type>
387387
<matcher>
@@ -390,7 +390,7 @@
390390
</matcher>
391391
</filter>
392392
<filter>
393-
<id>1528755597325</id>
393+
<id>1580324678293</id>
394394
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
395395
<type>5</type>
396396
<matcher>
@@ -399,7 +399,7 @@
399399
</matcher>
400400
</filter>
401401
<filter>
402-
<id>1528755597330</id>
402+
<id>1580324678305</id>
403403
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
404404
<type>5</type>
405405
<matcher>
@@ -408,7 +408,7 @@
408408
</matcher>
409409
</filter>
410410
<filter>
411-
<id>1528755597334</id>
411+
<id>1580324678315</id>
412412
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
413413
<type>5</type>
414414
<matcher>
@@ -417,14 +417,23 @@
417417
</matcher>
418418
</filter>
419419
<filter>
420-
<id>1528755597338</id>
420+
<id>1580324678325</id>
421421
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
422422
<type>5</type>
423423
<matcher>
424424
<id>org.eclipse.ui.ide.multiFilter</id>
425425
<arguments>1.0-name-matches-false-false-StreamBufferInterrupt.c</arguments>
426426
</matcher>
427427
</filter>
428+
<filter>
429+
<id>1580324678334</id>
430+
<name>src/Full_Demo/Standard-Demo-Tasks/Minimal</name>
431+
<type>5</type>
432+
<matcher>
433+
<id>org.eclipse.ui.ide.multiFilter</id>
434+
<arguments>1.0-name-matches-false-false-QueueSet.c</arguments>
435+
</matcher>
436+
</filter>
428437
<filter>
429438
<id>1461598705091</id>
430439
<name>src/lwIP_Demo/lwip-1.4.0/src/core</name>

FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
#include "StreamBufferDemo.h"
115115
#include "StreamBufferInterrupt.h"
116116
#include "MessageBufferAMP.h"
117+
#include "QueueSet.h"
117118

118119

119120
/* Priorities for the demo application tasks. */
@@ -233,6 +234,12 @@ void main_full( void )
233234
vStartStreamBufferInterruptDemo();
234235
vStartMessageBufferAMPTasks( mainMESSAGE_BUFFER_STACK_SIZE );
235236

237+
#if( configUSE_QUEUE_SETS == 1 )
238+
{
239+
vStartQueueSetTasks();
240+
}
241+
#endif
242+
236243
/* Start the tasks that implements the command console on the UART, as
237244
described above. */
238245
vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
@@ -403,17 +410,26 @@ unsigned long ulErrorFound = pdFALSE;
403410
ulErrorFound |= 1UL << 20UL;
404411
}
405412

413+
#if( configUSE_QUEUE_SETS == 1 )
414+
{
415+
if( xAreQueueSetTasksStillRunning() != pdPASS )
416+
{
417+
ulErrorFound |= 1UL << 21UL;
418+
}
419+
}
420+
#endif
421+
406422
/* Check that the register test 1 task is still running. */
407423
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
408424
{
409-
ulErrorFound |= 1UL << 21UL;
425+
ulErrorFound |= 1UL << 22UL;
410426
}
411427
ulLastRegTest1Value = ulRegTest1LoopCounter;
412428

413429
/* Check that the register test 2 task is still running. */
414430
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
415431
{
416-
ulErrorFound |= 1UL << 22UL;
432+
ulErrorFound |= 1UL << 23UL;
417433
}
418434
ulLastRegTest2Value = ulRegTest2LoopCounter;
419435

FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "IntSemTest.h"
7979
#include "StreamBufferInterrupt.h"
8080
#include "StreamBufferDemo.h"
81+
#include "QueueSet.h"
8182

8283
/* Xilinx includes. */
8384
#include "platform.h"
@@ -303,6 +304,12 @@ void vApplicationTickHook( void )
303304
a stream being sent from an interrupt to a task. */
304305
vBasicStreamBufferSendFromISR();
305306

307+
#if( configUSE_QUEUE_SETS == 1 )
308+
{
309+
vQueueSetAccessQueueSetFromISR();
310+
}
311+
#endif
312+
306313
/* Test flop alignment in interrupts - calling printf from an interrupt
307314
is BAD! */
308315
#if( configASSERT_DEFINED == 1 )

FreeRTOS/Source/queue.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -983,24 +983,23 @@ Queue_t * const pxQueue = xQueue;
983983
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
984984
{
985985
const int8_t cTxLock = pxQueue->cTxLock;
986+
const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting;
986987

987988
traceQUEUE_SEND_FROM_ISR( pxQueue );
988989

990+
/* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a
991+
semaphore or mutex. That means prvCopyDataToQueue() cannot result
992+
in a task disinheriting a priority and prvCopyDataToQueue() can be
993+
called here even though the disinherit function does not check if
994+
the scheduler is suspended before accessing the ready lists. */
995+
( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
996+
989997
/* The event list is not altered if the queue is locked. This will
990998
be done when the queue is unlocked later. */
991999
if( cTxLock == queueUNLOCKED )
9921000
{
9931001
#if ( configUSE_QUEUE_SETS == 1 )
9941002
{
995-
const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting;
996-
997-
/* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a
998-
semaphore or mutex. That means prvCopyDataToQueue() cannot result
999-
in a task disinheriting a priority and prvCopyDataToQueue() can be
1000-
called here even though the disinherit function does not check if
1001-
the scheduler is suspended before accessing the ready lists. */
1002-
( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
1003-
10041003
if( pxQueue->pxQueueSetContainer != NULL )
10051004
{
10061005
if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) )
@@ -1059,13 +1058,6 @@ Queue_t * const pxQueue = xQueue;
10591058
}
10601059
#else /* configUSE_QUEUE_SETS */
10611060
{
1062-
/* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a
1063-
semaphore or mutex. That means prvCopyDataToQueue() cannot result
1064-
in a task disinheriting a priority and prvCopyDataToQueue() can be
1065-
called here even though the disinherit function does not check if
1066-
the scheduler is suspended before accessing the ready lists. */
1067-
( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
1068-
10691061
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
10701062
{
10711063
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
@@ -1090,6 +1082,9 @@ Queue_t * const pxQueue = xQueue;
10901082
{
10911083
mtCOVERAGE_TEST_MARKER();
10921084
}
1085+
1086+
/* Not used in this path. */
1087+
( void ) uxPreviousMessagesWaiting;
10931088
}
10941089
#endif /* configUSE_QUEUE_SETS */
10951090
}

0 commit comments

Comments
 (0)