1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
34
35
36
37
38
39
40
41
42
43
44
48
49
50
51
52
53
54
55
64
65
66
67
68
72
73
74
78
79
81
82
83
84
85
89
90
91
92
97
98
99
100
101
102
103
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
129
130
131
132
133
135
136
137
138
139
143
144
145
148
149
153
154
157
158
159
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
181
182
183
188
189
190
194
195
196
199
200
201
202
207
208
209
213
214
215
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
240
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
293
299
300
301
302
304
305
306
307
308
309
310
311
312
313
314
315
316
318
319
320
322
323
324
325
326
334
335
336
339
340
341
342
343
344
350
351
352
353
354
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
396
397
398
399
400
406
407
408
409
410
415
416
417
418
419
420
421
422
423
424
426
427
428
436
441
442
444
445
446
447
448
449
452
453
454
455
458
459
460
461
462
463
464
465
466
467
468
469
470
474
475
476
477
478
479
480
481
482
483
484
485
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
542
543
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
572
576
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
602
603
604
605
606
611
612
613
614
620
624
625
626
627
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
653
654
655
656
661
662
663
664
665
668
672
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
701
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
729
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
753
754
755
756
759
760
761
762
763
767
768
769
770
771
772
773
774
775
776
777
798
830
831
832
833
834
835
837
852
860
864
865
866
867
868
869
870
871
872
873
874
876
877
878
880
881
882
883
890
895
896
897
898
899
901
902
903
904
905
906
907
908
909
910
911
912
913
918
919
920
925
929
930
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
981
982
983
984
985
986
987
988
989
990
995
996
997
999
1000
1001
1002
1059
1060
1061
1081
1085
1086
1087
1088
1089
1090
1091
1097
1098
1099
1100
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1123
1124
1125
1126
1128
1129
1130
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1158
1159
1160
1161
1162
1163
1164
1170
1171
1172
1174
1175
1176
1177
1227
1228
1254
1255
1256
1262
1263
1264
1265
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1288
1289
1290
1291
1292
1295
1296
1297
1298
1301
1302
1303
1304
1305
1306
1307
1309
1310
1311
1312
1313
1314
1315
1316
1319
1330
1334
1335
1336
1337
1338
1339
1340
1341
1342
1344
1345
1346
1347
1348
1355
1360
1361
1362
1363
1364
1366
1367
1368
1369
1370
1371
1372
1373
1375
1376
1377
1378
1379
1380
1384
1388
1389
1396
1397
1398
1399
1401
1402
1403
1404
1409
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1433
1434
1435
1436
1437
1440
1441
1442
1443
1446
1447
1448
1449
1450
1452
1453
1454
1456
1457
1458
1459
1460
1462
1463
1464
1465
1477
1478
1479
1481
1492
1496
1497
1498
1499
1500
1501
1502
1503
1504
1507
1508
1511
1512
1513
1515
1516
1517
1518
1519
1526
1531
1532
1533
1534
1535
1537
1538
1539
1540
1541
1542
1543
1544
1548
1549
1550
1551
1552
1553
1567
1568
1569
1570
1571
1575
1579
1580
1587
1588
1589
1590
1591
1592
1593
1594
1598
1599
1600
1601
1602
1605
1606
1607
1608
1609
1610
1611
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1648
1649
1650
1651
1652
1655
1656
1657
1658
1661
1662
1663
1664
1665
1666
1667
1669
1670
1671
1674
1675
1676
1677
1678
1679
1680
1681
1682
1684
1696
1700
1701
1702
1703
1704
1705
1706
1707
1708
1710
1711
1712
1713
1714
1722
1727
1728
1729
1730
1731
1733
1734
1735
1736
1737
1738
1739
1740
1742
1743
1744
1745
1746
1747
1751
1755
1756
1763
1764
1765
1766
1768
1769
1770
1771
1776
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1828
1855
1861
1862
1863
1864
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1912
1913
1914
1915
1916
1917
1918
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1986
1987
1988
1989
1994
1995
2007
2008
2013
2014
2015
2016
2017
2018
2025
2026
2027
2028
2035
2036
2037
2038
2045
2046
2047
2048
2049
2050
2051
2052
2053
2059
2063
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2100
2101
2102
2103
2104
2105
2108
2112
2113
2114
2115
2116
2117
2118
2121
2125
2126
2141
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2162
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2179
2180
2181
2182
2183
2184
2185
2186
2188
2189
2228
2229
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2272
2276
2277
2278
2279
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2322
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2362
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2381
2382
2383
2384
2385
2387
2388
2389
2391
2392
2393
2394
2395
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2430
2434
2435
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2458
2459
2460
2461
2462
2464
2465
2466
2468
2469
2470
2471
2472
2477
2478
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2495
2499
2500
2501
2502
2503
2504
2505
2520
2524
2525
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2546
2547
2548
2549
2550
2552
2570
2574
2575
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2595
2596
2597
2598
2599
2603
2607
2608
2609
2610
2628
2632
2633
2634
2635
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2684
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2711
2712
2713
2714
2715
2716
2717
2718
2721
2722
2723
2724
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2755
2756
2761
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2830
2837
2838
2839
2840
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2920
2924
2925
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
/* ... */
#include <stdlib.h>
#include <string.h>
/* ... */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#if ( configUSE_CO_ROUTINES == 1 )
#include "croutine.h"
#endif
/* ... */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#define queueUNLOCKED ( ( int8_t ) -1 )
#define queueLOCKED_UNMODIFIED ( ( int8_t ) 0 )
/* ... */
#define uxQueueType pcHead
#define queueQUEUE_IS_MUTEX NULL
typedef struct QueuePointers
{
int8_t *pcTail;
int8_t *pcReadFrom;
...} QueuePointers_t;
typedef struct SemaphoreData
{
TaskHandle_t xMutexHolder;
UBaseType_t uxRecursiveCallCount;
...} SemaphoreData_t;
/* ... */
#define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( UBaseType_t ) 0 )
#define queueMUTEX_GIVE_BLOCK_TIME ( ( TickType_t ) 0U )
#if( configUSE_PREEMPTION == 0 )
/* ... */
#define queueYIELD_IF_USING_PREEMPTION()
/* ... */#else
#define queueYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API()
#endif
/* ... */
typedef struct QueueDefinition
{
int8_t *pcHead;
int8_t *pcWriteTo;
union
{
QueuePointers_t xQueue;
SemaphoreData_t xSemaphore;
...} u;
List_t xTasksWaitingToSend;
List_t xTasksWaitingToReceive;
volatile UBaseType_t uxMessagesWaiting;
UBaseType_t uxLength;
UBaseType_t uxItemSize;
volatile int8_t cRxLock;
volatile int8_t cTxLock;
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
uint8_t ucStaticallyAllocated;
#endif
#if ( configUSE_QUEUE_SETS == 1 )
struct QueueDefinition *pxQueueSetContainer;
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxQueueNumber;
uint8_t ucQueueType;/* ... */
#endif
...} xQUEUE;
/* ... */
typedef xQUEUE Queue_t;
/* ... */
#if ( configQUEUE_REGISTRY_SIZE > 0 )
/* ... */
typedef struct QUEUE_REGISTRY_ITEM
{
const char *pcQueueName;
QueueHandle_t xHandle;
...} xQueueRegistryItem;
/* ... */
typedef xQueueRegistryItem QueueRegistryItem_t;
/* ... */
PRIVILEGED_DATA QueueRegistryItem_t xQueueRegistry[ configQUEUE_REGISTRY_SIZE ];
/* ... */
#endif
/* ... */
static void prvUnlockQueue( Queue_t * const pxQueue ) PRIVILEGED_FUNCTION;
/* ... */
static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION;
/* ... */
static BaseType_t prvIsQueueFull( const Queue_t *pxQueue ) PRIVILEGED_FUNCTION;
/* ... */
static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition ) PRIVILEGED_FUNCTION;
/* ... */
static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;
#if ( configUSE_QUEUE_SETS == 1 )
/* ... */
static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION;/* ... */
#endif
/* ... */
static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION;
/* ... */
#if( configUSE_MUTEXES == 1 )
static void prvInitialiseMutex( Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION;
#endif
#if( configUSE_MUTEXES == 1 )
/* ... */
static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION;/* ... */
#endif
/* ... */
#define prvLockQueue( pxQueue ) \
taskENTER_CRITICAL(); \
{ \
if( ( pxQueue )->cRxLock == queueUNLOCKED ) \
{ \
( pxQueue )->cRxLock = queueLOCKED_UNMODIFIED; \
...} \
if( ( pxQueue )->cTxLock == queueUNLOCKED ) \
{ \
( pxQueue )->cTxLock = queueLOCKED_UNMODIFIED; \
...} \
...} \
taskEXIT_CRITICAL()...
BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue )
{
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
taskENTER_CRITICAL();
{
pxQueue->u.xQueue.pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize );
pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;
pxQueue->pcWriteTo = pxQueue->pcHead;
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - 1U ) * pxQueue->uxItemSize );
pxQueue->cRxLock = queueUNLOCKED;
pxQueue->cTxLock = queueUNLOCKED;
if( xNewQueue == pdFALSE )
{
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xNewQueue == pdFALSE) { ... }
else
{
vListInitialise( &( pxQueue->xTasksWaitingToSend ) );
vListInitialise( &( pxQueue->xTasksWaitingToReceive ) );
}else { ... }
...}
taskEXIT_CRITICAL();
/* ... */
return pdPASS;
}{ ... }
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
QueueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType )
{
Queue_t *pxNewQueue;
configASSERT( uxQueueLength > ( UBaseType_t ) 0 );
/* ... */
configASSERT( pxStaticQueue != NULL );
/* ... */
configASSERT( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) );
configASSERT( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) );
#if( configASSERT_DEFINED == 1 )
{
/* ... */
volatile size_t xSize = sizeof( StaticQueue_t );
configASSERT( xSize == sizeof( Queue_t ) );
( void ) xSize;
...}/* ... */
#endif
/* ... */
pxNewQueue = ( Queue_t * ) pxStaticQueue;
if( pxNewQueue != NULL )
{
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
{
/* ... */
pxNewQueue->ucStaticallyAllocated = pdTRUE;
...}/* ... */
#endif
prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue );
}if (pxNewQueue != NULL) { ... }
else
{
traceQUEUE_CREATE_FAILED( ucQueueType );
mtCOVERAGE_TEST_MARKER();
}else { ... }
return pxNewQueue;
}xQueueGenericCreateStatic (const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType) { ... }
/* ... */
#endif
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType )
{
Queue_t *pxNewQueue;
size_t xQueueSizeInBytes;
uint8_t *pucQueueStorage;
configASSERT( uxQueueLength > ( UBaseType_t ) 0 );
/* ... */
xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize );
/* ... */
pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes );
if( pxNewQueue != NULL )
{
/* ... */
pucQueueStorage = ( uint8_t * ) pxNewQueue;
pucQueueStorage += sizeof( Queue_t );
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
{
/* ... */
pxNewQueue->ucStaticallyAllocated = pdFALSE;
...}/* ... */
#endif
prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue );
}if (pxNewQueue != NULL) { ... }
else
{
traceQUEUE_CREATE_FAILED( ucQueueType );
mtCOVERAGE_TEST_MARKER();
}else { ... }
return pxNewQueue;
}{ ... }
/* ... */#endif
static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, const uint8_t ucQueueType, Queue_t *pxNewQueue )
{
/* ... */
( void ) ucQueueType;
if( uxItemSize == ( UBaseType_t ) 0 )
{
/* ... */
pxNewQueue->pcHead = ( int8_t * ) pxNewQueue;
}if (uxItemSize == ( UBaseType_t ) 0) { ... }
else
{
pxNewQueue->pcHead = ( int8_t * ) pucQueueStorage;
}else { ... }
/* ... */
pxNewQueue->uxLength = uxQueueLength;
pxNewQueue->uxItemSize = uxItemSize;
( void ) xQueueGenericReset( pxNewQueue, pdTRUE );
#if ( configUSE_TRACE_FACILITY == 1 )
{
pxNewQueue->ucQueueType = ucQueueType;
...}/* ... */
#endif
#if( configUSE_QUEUE_SETS == 1 )
{
pxNewQueue->pxQueueSetContainer = NULL;
...}/* ... */
#endif
traceQUEUE_CREATE( pxNewQueue );
}{ ... }
#if( configUSE_MUTEXES == 1 )
static void prvInitialiseMutex( Queue_t *pxNewQueue )
{
if( pxNewQueue != NULL )
{
/* ... */
pxNewQueue->u.xSemaphore.xMutexHolder = NULL;
pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;
pxNewQueue->u.xSemaphore.uxRecursiveCallCount = 0;
traceCREATE_MUTEX( pxNewQueue );
( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );
}if (pxNewQueue != NULL) { ... }
else
{
traceCREATE_MUTEX_FAILED();
}else { ... }
}{ ... }
/* ... */#endif
#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType )
{
QueueHandle_t xNewQueue;
const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;
xNewQueue = xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
return xNewQueue;
}{ ... }
/* ... */#endif
#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue )
{
QueueHandle_t xNewQueue;
const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;
/* ... */
( void ) ucQueueType;
xNewQueue = xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
return xNewQueue;
}xQueueCreateMutexStatic (const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue) { ... }
/* ... */
#endif
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
TaskHandle_t xQueueGetMutexHolder( QueueHandle_t xSemaphore )
{
TaskHandle_t pxReturn;
Queue_t * const pxSemaphore = ( Queue_t * ) xSemaphore;
/* ... */
taskENTER_CRITICAL();
{
if( pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX )
{
pxReturn = pxSemaphore->u.xSemaphore.xMutexHolder;
}if (pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX) { ... }
else
{
pxReturn = NULL;
}else { ... }
...}
taskEXIT_CRITICAL();
return pxReturn;
}xQueueGetMutexHolder (QueueHandle_t xSemaphore) { ... }
/* ... */
#endif
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore )
{
TaskHandle_t pxReturn;
configASSERT( xSemaphore );
/* ... */
if( ( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX )
{
pxReturn = ( ( Queue_t * ) xSemaphore )->u.xSemaphore.xMutexHolder;
}if (( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX) { ... }
else
{
pxReturn = NULL;
}else { ... }
return pxReturn;
}xQueueGetMutexHolderFromISR (QueueHandle_t xSemaphore) { ... }
/* ... */
#endif
#if ( configUSE_RECURSIVE_MUTEXES == 1 )
BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex )
{
BaseType_t xReturn;
Queue_t * const pxMutex = ( Queue_t * ) xMutex;
configASSERT( pxMutex );
/* ... */
if( pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() )
{
traceGIVE_MUTEX_RECURSIVE( pxMutex );
/* ... */
( pxMutex->u.xSemaphore.uxRecursiveCallCount )--;
if( pxMutex->u.xSemaphore.uxRecursiveCallCount == ( UBaseType_t ) 0 )
{
/* ... */
( void ) xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK );
}if (pxMutex->u.xSemaphore.uxRecursiveCallCount == ( UBaseType_t ) 0) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
xReturn = pdPASS;
}if (pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle()) { ... }
else
{
/* ... */
xReturn = pdFAIL;
traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex );
}else { ... }
return xReturn;
}{ ... }
/* ... */#endif
#if ( configUSE_RECURSIVE_MUTEXES == 1 )
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait )
{
BaseType_t xReturn;
Queue_t * const pxMutex = ( Queue_t * ) xMutex;
configASSERT( pxMutex );
/* ... */
traceTAKE_MUTEX_RECURSIVE( pxMutex );
if( pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle() )
{
( pxMutex->u.xSemaphore.uxRecursiveCallCount )++;
xReturn = pdPASS;
}if (pxMutex->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle()) { ... }
else
{
xReturn = xQueueSemaphoreTake( pxMutex, xTicksToWait );
/* ... */
if( xReturn != pdFAIL )
{
( pxMutex->u.xSemaphore.uxRecursiveCallCount )++;
}if (xReturn != pdFAIL) { ... }
else
{
traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex );
}else { ... }
}else { ... }
return xReturn;
}{ ... }
/* ... */#endif
#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue )
{
QueueHandle_t xHandle;
configASSERT( uxMaxCount != 0 );
configASSERT( uxInitialCount <= uxMaxCount );
xHandle = xQueueGenericCreateStatic( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticQueue, queueQUEUE_TYPE_COUNTING_SEMAPHORE );
if( xHandle != NULL )
{
( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount;
traceCREATE_COUNTING_SEMAPHORE();
}if (xHandle != NULL) { ... }
else
{
traceCREATE_COUNTING_SEMAPHORE_FAILED();
}else { ... }
return xHandle;
}xQueueCreateCountingSemaphoreStatic (const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue) { ... }
/* ... */
#endif
#if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount )
{
QueueHandle_t xHandle;
configASSERT( uxMaxCount != 0 );
configASSERT( uxInitialCount <= uxMaxCount );
xHandle = xQueueGenericCreate( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE );
if( xHandle != NULL )
{
( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount;
traceCREATE_COUNTING_SEMAPHORE();
}if (xHandle != NULL) { ... }
else
{
traceCREATE_COUNTING_SEMAPHORE_FAILED();
}else { ... }
return xHandle;
}{ ... }
/* ... */#endif
BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition )
{
BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
...}/* ... */
#endif
/* ... */
for( ;; )
{
taskENTER_CRITICAL();
{
/* ... */
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
{
traceQUEUE_SEND( pxQueue );
#if ( configUSE_QUEUE_SETS == 1 )
{
const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting;
xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
if( pxQueue->pxQueueSetContainer != NULL )
{
if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) )
{
/* ... */
mtCOVERAGE_TEST_MARKER();
}if (( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 )) { ... }
else if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE )
{
/* ... */
queueYIELD_IF_USING_PREEMPTION();
}else if (prvNotifyQueueSetContainer( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->pxQueueSetContainer != NULL) { ... }
else
{
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else if( xYieldRequired != pdFALSE )
{
/* ... */
queueYIELD_IF_USING_PREEMPTION();
}else if (xYieldRequired != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}/* ... */
#else
{
xYieldRequired = prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else if( xYieldRequired != pdFALSE )
{
/* ... */
queueYIELD_IF_USING_PREEMPTION();
}else if (xYieldRequired != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#endif
taskEXIT_CRITICAL();
return pdPASS;
}if (( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE )) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
/* ... */
traceQUEUE_SEND_FAILED( pxQueue );
return errQUEUE_FULL;
}if (xTicksToWait == ( TickType_t ) 0) { ... }
else if( xEntryTimeSet == pdFALSE )
{
/* ... */
vTaskInternalSetTimeOutState( &xTimeOut );
xEntryTimeSet = pdTRUE;
}else if (xEntryTimeSet == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}
taskEXIT_CRITICAL();
/* ... */
vTaskSuspendAll();
prvLockQueue( pxQueue );
if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )
{
if( prvIsQueueFull( pxQueue ) != pdFALSE )
{
traceBLOCKING_ON_QUEUE_SEND( pxQueue );
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );
/* ... */
prvUnlockQueue( pxQueue );
/* ... */
if( xTaskResumeAll() == pdFALSE )
{
portYIELD_WITHIN_API();
}if (xTaskResumeAll() == pdFALSE) { ... }
}if (prvIsQueueFull( pxQueue ) != pdFALSE) { ... }
else
{
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
}else { ... }
}if (xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE) { ... }
else
{
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
traceQUEUE_SEND_FAILED( pxQueue );
return errQUEUE_FULL;
}else { ... }
}for (;;) { ... }
}{ ... }
BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition )
{
BaseType_t xReturn;
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
/* ... */
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
{
const int8_t cTxLock = pxQueue->cTxLock;
const UBaseType_t uxPreviousMessagesWaiting = pxQueue->uxMessagesWaiting;
traceQUEUE_SEND_FROM_ISR( pxQueue );
/* ... */
( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
/* ... */
if( cTxLock == queueUNLOCKED )
{
#if ( configUSE_QUEUE_SETS == 1 )
{
if( pxQueue->pxQueueSetContainer != NULL )
{
if( ( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 ) )
{
/* ... */
mtCOVERAGE_TEST_MARKER();
}if (( xCopyPosition == queueOVERWRITE ) && ( uxPreviousMessagesWaiting != ( UBaseType_t ) 0 )) { ... }
else if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else if (prvNotifyQueueSetContainer( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->pxQueueSetContainer != NULL) { ... }
else
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}/* ... */
#else
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
( void ) uxPreviousMessagesWaiting;
...}/* ... */
#endif
}if (cTxLock == queueUNLOCKED) { ... }
else
{
/* ... */
pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 );
}else { ... }
xReturn = pdPASS;
}if (( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE )) { ... }
else
{
traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );
xReturn = errQUEUE_FULL;
}else { ... }
...}
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}{ ... }
BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherPriorityTaskWoken )
{
BaseType_t xReturn;
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
/* ... */
configASSERT( pxQueue );
/* ... */
configASSERT( pxQueue->uxItemSize == 0 );
/* ... */
configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->u.xSemaphore.xMutexHolder != NULL ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
/* ... */
if( uxMessagesWaiting < pxQueue->uxLength )
{
const int8_t cTxLock = pxQueue->cTxLock;
traceQUEUE_SEND_FROM_ISR( pxQueue );
/* ... */
pxQueue->uxMessagesWaiting = uxMessagesWaiting + ( UBaseType_t ) 1;
/* ... */
if( cTxLock == queueUNLOCKED )
{
#if ( configUSE_QUEUE_SETS == 1 )
{
if( pxQueue->pxQueueSetContainer != NULL )
{
if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (prvNotifyQueueSetContainer( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->pxQueueSetContainer != NULL) { ... }
else
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}/* ... */
#else
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#endif
}if (cTxLock == queueUNLOCKED) { ... }
else
{
/* ... */
pxQueue->cTxLock = ( int8_t ) ( cTxLock + 1 );
}else { ... }
xReturn = pdPASS;
}if (uxMessagesWaiting < pxQueue->uxLength) { ... }
else
{
traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );
xReturn = errQUEUE_FULL;
}else { ... }
...}
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}{ ... }
BaseType_t xQueueReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait )
{
BaseType_t xEntryTimeSet = pdFALSE;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
configASSERT( ( pxQueue ) );
/* ... */
configASSERT( !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
...}/* ... */
#endif
/* ... */
for( ;; )
{
taskENTER_CRITICAL();
{
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
/* ... */
if( uxMessagesWaiting > ( UBaseType_t ) 0 )
{
prvCopyDataFromQueue( pxQueue, pvBuffer );
traceQUEUE_RECEIVE( pxQueue );
pxQueue->uxMessagesWaiting = uxMessagesWaiting - ( UBaseType_t ) 1;
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
taskEXIT_CRITICAL();
return pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_RECEIVE_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (xTicksToWait == ( TickType_t ) 0) { ... }
else if( xEntryTimeSet == pdFALSE )
{
/* ... */
vTaskInternalSetTimeOutState( &xTimeOut );
xEntryTimeSet = pdTRUE;
}else if (xEntryTimeSet == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}
taskEXIT_CRITICAL();
/* ... */
vTaskSuspendAll();
prvLockQueue( pxQueue );
if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )
{
/* ... */
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
prvUnlockQueue( pxQueue );
if( xTaskResumeAll() == pdFALSE )
{
portYIELD_WITHIN_API();
}if (xTaskResumeAll() == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
/* ... */
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
}else { ... }
}if (xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE) { ... }
else
{
/* ... */
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceQUEUE_RECEIVE_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
}for (;;) { ... }
}{ ... }
BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait )
{
BaseType_t xEntryTimeSet = pdFALSE;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
#if( configUSE_MUTEXES == 1 )
BaseType_t xInheritanceOccurred = pdFALSE;
#endif
configASSERT( ( pxQueue ) );
/* ... */
configASSERT( pxQueue->uxItemSize == 0 );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
...}/* ... */
#endif
/* ... */
for( ;; )
{
taskENTER_CRITICAL();
{
/* ... */
const UBaseType_t uxSemaphoreCount = pxQueue->uxMessagesWaiting;
/* ... */
if( uxSemaphoreCount > ( UBaseType_t ) 0 )
{
traceQUEUE_RECEIVE( pxQueue );
/* ... */
pxQueue->uxMessagesWaiting = uxSemaphoreCount - ( UBaseType_t ) 1;
#if ( configUSE_MUTEXES == 1 )
{
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
{
/* ... */
pxQueue->u.xSemaphore.xMutexHolder = pvTaskIncrementMutexHeldCount();
}if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#endif
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
taskEXIT_CRITICAL();
return pdPASS;
}if (uxSemaphoreCount > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
#if( configUSE_MUTEXES == 1 )
{
configASSERT( xInheritanceOccurred == pdFALSE );
...}/* ... */
#endif
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_RECEIVE_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (xTicksToWait == ( TickType_t ) 0) { ... }
else if( xEntryTimeSet == pdFALSE )
{
/* ... */
vTaskInternalSetTimeOutState( &xTimeOut );
xEntryTimeSet = pdTRUE;
}else if (xEntryTimeSet == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}
taskEXIT_CRITICAL();
/* ... */
vTaskSuspendAll();
prvLockQueue( pxQueue );
if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )
{
/* ... */
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue );
#if ( configUSE_MUTEXES == 1 )
{
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
{
taskENTER_CRITICAL();
{
xInheritanceOccurred = xTaskPriorityInherit( pxQueue->u.xSemaphore.xMutexHolder );
...}
taskEXIT_CRITICAL();
}if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#endif
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
prvUnlockQueue( pxQueue );
if( xTaskResumeAll() == pdFALSE )
{
portYIELD_WITHIN_API();
}if (xTaskResumeAll() == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
/* ... */
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
}else { ... }
}if (xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE) { ... }
else
{
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
/* ... */
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
#if ( configUSE_MUTEXES == 1 )
{
/* ... */
if( xInheritanceOccurred != pdFALSE )
{
taskENTER_CRITICAL();
{
UBaseType_t uxHighestWaitingPriority;
/* ... */
uxHighestWaitingPriority = prvGetDisinheritPriorityAfterTimeout( pxQueue );
vTaskPriorityDisinheritAfterTimeout( pxQueue->u.xSemaphore.xMutexHolder, uxHighestWaitingPriority );
...}
taskEXIT_CRITICAL();
}if (xInheritanceOccurred != pdFALSE) { ... }
...}/* ... */
#endif
traceQUEUE_RECEIVE_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
}for (;;) { ... }
}{ ... }
BaseType_t xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait )
{
BaseType_t xEntryTimeSet = pdFALSE;
TimeOut_t xTimeOut;
int8_t *pcOriginalReadPosition;
Queue_t * const pxQueue = xQueue;
configASSERT( ( pxQueue ) );
/* ... */
configASSERT( !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) );
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
{
configASSERT( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) );
...}/* ... */
#endif
/* ... */
for( ;; )
{
taskENTER_CRITICAL();
{
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
/* ... */
if( uxMessagesWaiting > ( UBaseType_t ) 0 )
{
/* ... */
pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom;
prvCopyDataFromQueue( pxQueue, pvBuffer );
traceQUEUE_PEEK( pxQueue );
pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition;
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
queueYIELD_IF_USING_PREEMPTION();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
taskEXIT_CRITICAL();
return pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_PEEK_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (xTicksToWait == ( TickType_t ) 0) { ... }
else if( xEntryTimeSet == pdFALSE )
{
/* ... */
vTaskInternalSetTimeOutState( &xTimeOut );
xEntryTimeSet = pdTRUE;
}else if (xEntryTimeSet == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
...}
taskEXIT_CRITICAL();
/* ... */
vTaskSuspendAll();
prvLockQueue( pxQueue );
if( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE )
{
/* ... */
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceBLOCKING_ON_QUEUE_PEEK( pxQueue );
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
prvUnlockQueue( pxQueue );
if( xTaskResumeAll() == pdFALSE )
{
portYIELD_WITHIN_API();
}if (xTaskResumeAll() == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
/* ... */
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
}else { ... }
}if (xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE) { ... }
else
{
/* ... */
prvUnlockQueue( pxQueue );
( void ) xTaskResumeAll();
if( prvIsQueueEmpty( pxQueue ) != pdFALSE )
{
traceQUEUE_PEEK_FAILED( pxQueue );
return errQUEUE_EMPTY;
}if (prvIsQueueEmpty( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
}for (;;) { ... }
}{ ... }
BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, BaseType_t * const pxHigherPriorityTaskWoken )
{
BaseType_t xReturn;
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
const UBaseType_t uxMessagesWaiting = pxQueue->uxMessagesWaiting;
if( uxMessagesWaiting > ( UBaseType_t ) 0 )
{
const int8_t cRxLock = pxQueue->cRxLock;
traceQUEUE_RECEIVE_FROM_ISR( pxQueue );
prvCopyDataFromQueue( pxQueue, pvBuffer );
pxQueue->uxMessagesWaiting = uxMessagesWaiting - ( UBaseType_t ) 1;
/* ... */
if( cRxLock == queueUNLOCKED )
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
/* ... */
if( pxHigherPriorityTaskWoken != NULL )
{
*pxHigherPriorityTaskWoken = pdTRUE;
}if (pxHigherPriorityTaskWoken != NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (cRxLock == queueUNLOCKED) { ... }
else
{
/* ... */
pxQueue->cRxLock = ( int8_t ) ( cRxLock + 1 );
}else { ... }
xReturn = pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFAIL;
traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );
}else { ... }
...}
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}{ ... }
BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer )
{
BaseType_t xReturn;
UBaseType_t uxSavedInterruptStatus;
int8_t *pcOriginalReadPosition;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( pxQueue->uxItemSize != 0 );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
{
traceQUEUE_PEEK_FROM_ISR( pxQueue );
/* ... */
pcOriginalReadPosition = pxQueue->u.xQueue.pcReadFrom;
prvCopyDataFromQueue( pxQueue, pvBuffer );
pxQueue->u.xQueue.pcReadFrom = pcOriginalReadPosition;
xReturn = pdPASS;
}if (pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFAIL;
traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue );
}else { ... }
...}
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}{ ... }
UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
configASSERT( xQueue );
taskENTER_CRITICAL();
{
uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting;
...}
taskEXIT_CRITICAL();
return uxReturn;
}{ ... }
UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
taskENTER_CRITICAL();
{
uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting;
...}
taskEXIT_CRITICAL();
return uxReturn;
}{ ... }
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
uxReturn = pxQueue->uxMessagesWaiting;
return uxReturn;
}{ ... }
void vQueueDelete( QueueHandle_t xQueue )
{
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
traceQUEUE_DELETE( pxQueue );
#if ( configQUEUE_REGISTRY_SIZE > 0 )
{
vQueueUnregisterQueue( pxQueue );
...}/* ... */
#endif
#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) )
{
/* ... */
vPortFree( pxQueue );
...}/* ... */
#elif( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
{
/* ... */
if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdFALSE )
{
vPortFree( pxQueue );
}if (pxQueue->ucStaticallyAllocated == ( uint8_t ) pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#else
{
/* ... */
( void ) pxQueue;
...}/* ... */
#endif
}{ ... }
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue )
{
return ( ( Queue_t * ) xQueue )->uxQueueNumber;
}{ ... }
/* ... */#endif
#if ( configUSE_TRACE_FACILITY == 1 )
void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber )
{
( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber;
}{ ... }
/* ... */#endif
#if ( configUSE_TRACE_FACILITY == 1 )
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue )
{
return ( ( Queue_t * ) xQueue )->ucQueueType;
}{ ... }
/* ... */#endif
#if( configUSE_MUTEXES == 1 )
static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue )
{
UBaseType_t uxHighestPriorityOfWaitingTasks;
/* ... */
if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U )
{
uxHighestPriorityOfWaitingTasks = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) listGET_ITEM_VALUE_OF_HEAD_ENTRY( &( pxQueue->xTasksWaitingToReceive ) );
}if (listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U) { ... }
else
{
uxHighestPriorityOfWaitingTasks = tskIDLE_PRIORITY;
}else { ... }
return uxHighestPriorityOfWaitingTasks;
}{ ... }
/* ... */#endif
static BaseType_t prvCopyDataToQueue( Queue_t * const pxQueue, const void *pvItemToQueue, const BaseType_t xPosition )
{
BaseType_t xReturn = pdFALSE;
UBaseType_t uxMessagesWaiting;
uxMessagesWaiting = pxQueue->uxMessagesWaiting;
if( pxQueue->uxItemSize == ( UBaseType_t ) 0 )
{
#if ( configUSE_MUTEXES == 1 )
{
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
{
xReturn = xTaskPriorityDisinherit( pxQueue->u.xSemaphore.xMutexHolder );
pxQueue->u.xSemaphore.xMutexHolder = NULL;
}if (pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}/* ... */
#endif
}if (pxQueue->uxItemSize == ( UBaseType_t ) 0) { ... }
else if( xPosition == queueSEND_TO_BACK )
{
( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );
pxQueue->pcWriteTo += pxQueue->uxItemSize;
if( pxQueue->pcWriteTo >= pxQueue->u.xQueue.pcTail )
{
pxQueue->pcWriteTo = pxQueue->pcHead;
...}
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else if (xPosition == queueSEND_TO_BACK) { ... }
else
{
( void ) memcpy( ( void * ) pxQueue->u.xQueue.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );
pxQueue->u.xQueue.pcReadFrom -= pxQueue->uxItemSize;
if( pxQueue->u.xQueue.pcReadFrom < pxQueue->pcHead )
{
pxQueue->u.xQueue.pcReadFrom = ( pxQueue->u.xQueue.pcTail - pxQueue->uxItemSize );
...}
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
if( xPosition == queueOVERWRITE )
{
if( uxMessagesWaiting > ( UBaseType_t ) 0 )
{
/* ... */
--uxMessagesWaiting;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xPosition == queueOVERWRITE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}else { ... }
pxQueue->uxMessagesWaiting = uxMessagesWaiting + ( UBaseType_t ) 1;
return xReturn;
}{ ... }
static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer )
{
if( pxQueue->uxItemSize != ( UBaseType_t ) 0 )
{
pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize;
if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail )
{
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead;
...}
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( size_t ) pxQueue->uxItemSize );
}if (pxQueue->uxItemSize != ( UBaseType_t ) 0) { ... }
}{ ... }
static void prvUnlockQueue( Queue_t * const pxQueue )
{
/* ... */
taskENTER_CRITICAL();
{
int8_t cTxLock = pxQueue->cTxLock;
while( cTxLock > queueLOCKED_UNMODIFIED )
{
/* ... */
#if ( configUSE_QUEUE_SETS == 1 )
{
if( pxQueue->pxQueueSetContainer != NULL )
{
if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE )
{
/* ... */
vTaskMissedYield();
}if (prvNotifyQueueSetContainer( pxQueue ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->pxQueueSetContainer != NULL) { ... }
else
{
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
vTaskMissedYield();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
break;
}else { ... }
}else { ... }
...}/* ... */
#else
{
/* ... */
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
vTaskMissedYield();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
break;
}else { ... }
...}/* ... */
#endif
--cTxLock;
}while (cTxLock > queueLOCKED_UNMODIFIED) { ... }
pxQueue->cTxLock = queueUNLOCKED;
...}
taskEXIT_CRITICAL();
taskENTER_CRITICAL();
{
int8_t cRxLock = pxQueue->cRxLock;
while( cRxLock > queueLOCKED_UNMODIFIED )
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
vTaskMissedYield();
}if (xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
--cRxLock;
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
break;
}else { ... }
}while (cRxLock > queueLOCKED_UNMODIFIED) { ... }
pxQueue->cRxLock = queueUNLOCKED;
...}
taskEXIT_CRITICAL();
}{ ... }
static BaseType_t prvIsQueueEmpty( const Queue_t *pxQueue )
{
BaseType_t xReturn;
taskENTER_CRITICAL();
{
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
...}
taskEXIT_CRITICAL();
return xReturn;
}{ ... }
BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
return xReturn;
}{ ... }
static BaseType_t prvIsQueueFull( const Queue_t *pxQueue )
{
BaseType_t xReturn;
taskENTER_CRITICAL();
{
if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == pxQueue->uxLength) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
...}
taskEXIT_CRITICAL();
return xReturn;
}{ ... }
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == pxQueue->uxLength) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
return xReturn;
}{ ... }
#if ( configUSE_CO_ROUTINES == 1 )
BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
/* ... */
portDISABLE_INTERRUPTS();
{
if( prvIsQueueFull( pxQueue ) != pdFALSE )
{
/* ... */
if( xTicksToWait > ( TickType_t ) 0 )
{
/* ... */
vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToSend ) );
portENABLE_INTERRUPTS();
return errQUEUE_BLOCKED;
}if (xTicksToWait > ( TickType_t ) 0) { ... }
else
{
portENABLE_INTERRUPTS();
return errQUEUE_FULL;
}else { ... }
}if (prvIsQueueFull( pxQueue ) != pdFALSE) { ... }
...}
portENABLE_INTERRUPTS();
portDISABLE_INTERRUPTS();
{
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )
{
prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK );
xReturn = pdPASS;
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
/* ... */
if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
/* ... */
xReturn = errQUEUE_YIELD;
}if (xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->uxMessagesWaiting < pxQueue->uxLength) { ... }
else
{
xReturn = errQUEUE_FULL;
}else { ... }
...}
portENABLE_INTERRUPTS();
return xReturn;
}xQueueCRSend (QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait) { ... }
/* ... */
#endif
#if ( configUSE_CO_ROUTINES == 1 )
BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
/* ... */
portDISABLE_INTERRUPTS();
{
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
/* ... */
if( xTicksToWait > ( TickType_t ) 0 )
{
/* ... */
vCoRoutineAddToDelayedList( xTicksToWait, &( pxQueue->xTasksWaitingToReceive ) );
portENABLE_INTERRUPTS();
return errQUEUE_BLOCKED;
}if (xTicksToWait > ( TickType_t ) 0) { ... }
else
{
portENABLE_INTERRUPTS();
return errQUEUE_FULL;
}else { ... }
}if (pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
...}
portENABLE_INTERRUPTS();
portDISABLE_INTERRUPTS();
{
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
{
pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize;
if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail )
{
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead;
}if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
--( pxQueue->uxMessagesWaiting );
( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize );
xReturn = pdPASS;
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
/* ... */
if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
xReturn = errQUEUE_YIELD;
}if (xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFAIL;
}else { ... }
...}
portENABLE_INTERRUPTS();
return xReturn;
}xQueueCRReceive (QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait) { ... }
/* ... */
#endif
#if ( configUSE_CO_ROUTINES == 1 )
BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken )
{
Queue_t * const pxQueue = xQueue;
/* ... */
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )
{
prvCopyDataToQueue( pxQueue, pvItemToQueue, queueSEND_TO_BACK );
/* ... */
if( xCoRoutinePreviouslyWoken == pdFALSE )
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
{
return pdTRUE;
}if (xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (xCoRoutinePreviouslyWoken == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (pxQueue->uxMessagesWaiting < pxQueue->uxLength) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
return xCoRoutinePreviouslyWoken;
}xQueueCRSendFromISR (QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken) { ... }
/* ... */
#endif
#if ( configUSE_CO_ROUTINES == 1 )
BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
/* ... */
if( pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0 )
{
pxQueue->u.xQueue.pcReadFrom += pxQueue->uxItemSize;
if( pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail )
{
pxQueue->u.xQueue.pcReadFrom = pxQueue->pcHead;
}if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
--( pxQueue->uxMessagesWaiting );
( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.xQueue.pcReadFrom, ( unsigned ) pxQueue->uxItemSize );
if( ( *pxCoRoutineWoken ) == pdFALSE )
{
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE )
{
if( xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE )
{
*pxCoRoutineWoken = pdTRUE;
}if (xCoRoutineRemoveFromEventList( &( pxQueue->xTasksWaitingToSend ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToSend ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (( *pxCoRoutineWoken ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
xReturn = pdPASS;
}if (pxQueue->uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFAIL;
}else { ... }
return xReturn;
}xQueueCRReceiveFromISR (QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken) { ... }
/* ... */
#endif
#if ( configQUEUE_REGISTRY_SIZE > 0 )
void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName )
{
UBaseType_t ux;
/* ... */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
if( xQueueRegistry[ ux ].pcQueueName == NULL )
{
xQueueRegistry[ ux ].pcQueueName = pcQueueName;
xQueueRegistry[ ux ].xHandle = xQueue;
traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName );
break;
}if (xQueueRegistry[ ux ].pcQueueName == NULL) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}for (ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++) { ... }
...}
/* ... */
#endif
#if ( configQUEUE_REGISTRY_SIZE > 0 )
const char *pcQueueGetName( QueueHandle_t xQueue )
{
UBaseType_t ux;
const char *pcReturn = NULL;
/* ... */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
if( xQueueRegistry[ ux ].xHandle == xQueue )
{
pcReturn = xQueueRegistry[ ux ].pcQueueName;
break;
}if (xQueueRegistry[ ux ].xHandle == xQueue) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}for (ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++) { ... }
return pcReturn;
...}
/* ... */
#endif
#if ( configQUEUE_REGISTRY_SIZE > 0 )
void vQueueUnregisterQueue( QueueHandle_t xQueue )
{
UBaseType_t ux;
/* ... */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
if( xQueueRegistry[ ux ].xHandle == xQueue )
{
xQueueRegistry[ ux ].pcQueueName = NULL;
/* ... */
xQueueRegistry[ ux ].xHandle = ( QueueHandle_t ) 0;
break;
}if (xQueueRegistry[ ux ].xHandle == xQueue) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}for (ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++) { ... }
}{ ... }
/* ... */
#endif
#if ( configUSE_TIMERS == 1 )
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely )
{
Queue_t * const pxQueue = xQueue;
/* ... */
/* ... */
prvLockQueue( pxQueue );
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U )
{
vTaskPlaceOnEventListRestricted( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait, xWaitIndefinitely );
}if (pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0U) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
prvUnlockQueue( pxQueue );
}vQueueWaitForMessageRestricted (QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely) { ... }
/* ... */
#endif
#if( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
QueueSetHandle_t xQueueCreateSet( const UBaseType_t uxEventQueueLength )
{
QueueSetHandle_t pxQueue;
pxQueue = xQueueGenericCreate( uxEventQueueLength, ( UBaseType_t ) sizeof( Queue_t * ), queueQUEUE_TYPE_SET );
return pxQueue;
}xQueueCreateSet (const UBaseType_t uxEventQueueLength) { ... }
/* ... */
#endif
#if ( configUSE_QUEUE_SETS == 1 )
BaseType_t xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
{
BaseType_t xReturn;
taskENTER_CRITICAL();
{
if( ( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL )
{
xReturn = pdFAIL;
}if (( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer != NULL) { ... }
else if( ( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0 )
{
/* ... */
xReturn = pdFAIL;
}else if (( ( Queue_t * ) xQueueOrSemaphore )->uxMessagesWaiting != ( UBaseType_t ) 0) { ... }
else
{
( ( Queue_t * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet;
xReturn = pdPASS;
}else { ... }
...}
taskEXIT_CRITICAL();
return xReturn;
}xQueueAddToSet (QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) { ... }
/* ... */
#endif
#if ( configUSE_QUEUE_SETS == 1 )
BaseType_t xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
{
BaseType_t xReturn;
Queue_t * const pxQueueOrSemaphore = ( Queue_t * ) xQueueOrSemaphore;
if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet )
{
xReturn = pdFAIL;
}if (pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet) { ... }
else if( pxQueueOrSemaphore->uxMessagesWaiting != ( UBaseType_t ) 0 )
{
/* ... */
xReturn = pdFAIL;
}else if (pxQueueOrSemaphore->uxMessagesWaiting != ( UBaseType_t ) 0) { ... }
else
{
taskENTER_CRITICAL();
{
pxQueueOrSemaphore->pxQueueSetContainer = NULL;
...}
taskEXIT_CRITICAL();
xReturn = pdPASS;
}else { ... }
return xReturn;
}xQueueRemoveFromSet (QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet) { ... }
/* ... */
#endif
#if ( configUSE_QUEUE_SETS == 1 )
QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t const xTicksToWait )
{
QueueSetMemberHandle_t xReturn = NULL;
( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait );
return xReturn;
}xQueueSelectFromSet (QueueSetHandle_t xQueueSet, TickType_t const xTicksToWait) { ... }
/* ... */
#endif
#if ( configUSE_QUEUE_SETS == 1 )
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet )
{
QueueSetMemberHandle_t xReturn = NULL;
( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL );
return xReturn;
}xQueueSelectFromSetFromISR (QueueSetHandle_t xQueueSet) { ... }
/* ... */
#endif
#if ( configUSE_QUEUE_SETS == 1 )
static BaseType_t prvNotifyQueueSetContainer( const Queue_t * const pxQueue )
{
Queue_t *pxQueueSetContainer = pxQueue->pxQueueSetContainer;
BaseType_t xReturn = pdFALSE;
configASSERT( pxQueueSetContainer );
configASSERT( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength );
if( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength )
{
const int8_t cTxLock = pxQueueSetContainer->cTxLock;
traceQUEUE_SEND( pxQueueSetContainer );
xReturn = prvCopyDataToQueue( pxQueueSetContainer, &pxQueue, queueSEND_TO_BACK );
if( cTxLock == queueUNLOCKED )
{
if( listLIST_IS_EMPTY( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) == pdFALSE )
{
if( xTaskRemoveFromEventList( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) != pdFALSE )
{
xReturn = pdTRUE;
}if (xTaskRemoveFromEventList( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) != pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (listLIST_IS_EMPTY( &( pxQueueSetContainer->xTasksWaitingToReceive ) ) == pdFALSE) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}if (cTxLock == queueUNLOCKED) { ... }
else
{
pxQueueSetContainer->cTxLock = ( int8_t ) ( cTxLock + 1 );
}else { ... }
}if (pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
return xReturn;
}prvNotifyQueueSetContainer (const Queue_t * const pxQueue) { ... }
/* ... */
#endif