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
32
35
36
37
38
39
40
41
42
43
44
45
48
49
50
51
52
68
69
73
74
75
79
80
82
83
84
85
86
91
96
97
98
103
104
105
106
107
108
109
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
135
136
137
138
140
141
142
143
144
148
149
150
153
154
158
159
162
163
164
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
190
191
192
197
198
199
203
204
205
206
207
210
211
212
213
214
220
221
222
226
227
228
229
230
231
232
237
238
239
240
241
242
251
252
253
254
258
271
272
277
286
287
292
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
350
356
357
358
359
363
364
365
366
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
388
389
390
391
392
393
395
396
397
398
399
400
403
404
405
406
407
408
409
410
411
414
415
416
417
418
419
420
426
427
428
429
430
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
467
468
469
470
471
472
473
474
478
479
480
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
518
521
522
523
524
525
526
527
528
529
530
532
533
534
535
536
542
543
544
545
546
551
552
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
574
575
576
584
589
590
592
593
594
595
596
597
600
601
602
603
606
607
608
609
610
611
612
613
614
615
616
617
618
622
623
624
625
626
627
628
629
630
631
632
633
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
703
704
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
737
741
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
771
772
773
774
775
780
781
782
783
789
793
794
795
796
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
827
828
829
830
835
836
837
838
839
842
846
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
881
885
886
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
920
924
925
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
957
958
959
960
961
962
963
967
968
969
970
971
972
973
974
975
976
977
998
999
1000
1002
1017
1025
1029
1030
1031
1032
1033
1034
1035
1037
1052
1060
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1079
1080
1081
1083
1084
1085
1086
1087
1088
1095
1100
1101
1102
1103
1104
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1123
1124
1125
1130
1134
1135
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1210
1211
1212
1214
1215
1216
1217
1274
1275
1276
1296
1300
1301
1302
1303
1304
1305
1306
1312
1313
1314
1315
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1343
1344
1345
1346
1348
1349
1350
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1381
1382
1383
1384
1385
1386
1387
1393
1394
1395
1397
1398
1399
1400
1450
1451
1477
1478
1479
1485
1486
1487
1488
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1517
1518
1519
1520
1521
1524
1525
1526
1527
1528
1529
1530
1531
1532
1534
1535
1536
1537
1538
1539
1540
1541
1544
1555
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1572
1573
1574
1575
1576
1577
1578
1579
1586
1591
1592
1593
1594
1595
1597
1598
1599
1600
1601
1602
1603
1604
1606
1607
1608
1609
1610
1611
1612
1616
1620
1621
1628
1629
1630
1631
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1670
1671
1672
1673
1674
1677
1678
1679
1680
1681
1682
1683
1685
1686
1687
1689
1690
1691
1692
1693
1695
1696
1697
1698
1710
1711
1712
1714
1725
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1742
1743
1744
1745
1746
1747
1748
1749
1756
1761
1762
1763
1764
1765
1767
1768
1769
1770
1771
1772
1773
1774
1778
1779
1780
1781
1782
1783
1797
1798
1799
1800
1801
1802
1806
1810
1811
1818
1819
1820
1821
1822
1823
1824
1825
1829
1830
1831
1832
1833
1836
1837
1838
1839
1840
1841
1842
1847
1848
1849
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1893
1894
1895
1896
1897
1900
1901
1902
1903
1904
1905
1906
1907
1908
1910
1911
1912
1915
1916
1917
1918
1919
1920
1921
1922
1923
1925
1937
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1954
1955
1956
1957
1958
1959
1960
1961
1969
1974
1975
1976
1977
1978
1980
1981
1982
1983
1984
1985
1986
1987
1989
1990
1991
1992
1993
1994
1995
1999
2003
2004
2011
2012
2013
2014
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2085
2112
2118
2119
2120
2121
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2177
2178
2179
2180
2181
2182
2183
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2267
2268
2269
2270
2275
2276
2288
2289
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2375
2379
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2418
2419
2420
2421
2422
2423
2427
2431
2432
2433
2434
2435
2436
2437
2441
2445
2446
2461
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2484
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2502
2503
2504
2505
2506
2507
2508
2509
2511
2512
2551
2552
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2595
2599
2600
2601
2602
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2648
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2693
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2718
2719
2720
2721
2722
2724
2725
2726
2728
2729
2730
2731
2732
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2767
2771
2772
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2801
2802
2803
2804
2805
2807
2808
2809
2811
2812
2813
2814
2815
2820
2821
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2839
2843
2844
2845
2846
2847
2848
2849
2850
2865
2869
2870
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2897
2898
2899
2900
2901
2903
2921
2925
2926
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2952
2953
2954
2955
2956
2957
2961
2965
2966
2967
2968
2969
2987
2991
2992
2993
2994
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3023
3024
3025
3026
3031
3032
3036
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3071
3072
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3105
3106
3107
3108
3109
3110
3111
3112
3115
3116
3117
3118
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3154
3155
3156
3161
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3245
3252
3253
3254
3255
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3351
3355
3356
3360
3361
3362
3363
3364
/* ... */
#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 queueINT8_MAX ( ( int8_t ) 127 )
/* ... */
#define uxQueueType pcHead
#define queueQUEUE_IS_MUTEX NULL
5 defines
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
#if ( configNUMBER_OF_CORES == 1 )
#define queueYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API()
#else
#define queueYIELD_IF_USING_PREEMPTION() vTaskYieldWithinAPI()
#endif /* ... */
#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 prvGetHighestPriorityOfWaitToReceiveList( 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()...
/* ... */
#define prvIncrementQueueTxLock( pxQueue, cTxLock ) \
do { \
const UBaseType_t uxNumberOfTasks = uxTaskGetNumberOfTasks(); \
if( ( UBaseType_t ) ( cTxLock ) < uxNumberOfTasks ) \
{ \
configASSERT( ( cTxLock ) != queueINT8_MAX ); \
( pxQueue )->cTxLock = ( int8_t ) ( ( cTxLock ) + ( int8_t ) 1 ); \
...} \
...} while( 0 )...
/* ... */
#define prvIncrementQueueRxLock( pxQueue, cRxLock ) \
do { \
const UBaseType_t uxNumberOfTasks = uxTaskGetNumberOfTasks(); \
if( ( UBaseType_t ) ( cRxLock ) < uxNumberOfTasks ) \
{ \
configASSERT( ( cRxLock ) != queueINT8_MAX ); \
( pxQueue )->cRxLock = ( int8_t ) ( ( cRxLock ) + ( int8_t ) 1 ); \
...} \
...} while( 0 )...
BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
BaseType_t xNewQueue )
{
BaseType_t xReturn = pdPASS;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericReset( xQueue, xNewQueue );
configASSERT( pxQueue );
if( ( pxQueue != NULL ) &&
( pxQueue->uxLength >= 1U ) &&
( ( SIZE_MAX / pxQueue->uxLength ) >= pxQueue->uxItemSize ) )
{
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();
}if (( pxQueue != NULL ) && ( pxQueue->uxLength >= 1U ) && /* Check for multiplication overflow. */ ( ( SIZE_MAX / pxQueue->uxLength ) >= pxQueue->uxItemSize )) { ... }
else
{
xReturn = pdFAIL;
}else { ... }
configASSERT( xReturn != pdFAIL );
/* ... */
traceRETURN_xQueueGenericReset( xReturn );
return xReturn;
}{ ... }
#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 = NULL;
traceENTER_xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType );
/* ... */
configASSERT( pxStaticQueue );
if( ( uxQueueLength > ( UBaseType_t ) 0 ) &&
( pxStaticQueue != NULL ) &&
/* ... */
( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0U ) ) ) &&
( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0U ) ) ) )
{
#if ( configASSERT_DEFINED == 1 )
{
/* ... */
volatile size_t xSize = sizeof( StaticQueue_t );
configASSERT( xSize == sizeof( Queue_t ) );
( void ) xSize;
...}/* ... */
#endif
/* ... */
pxNewQueue = ( Queue_t * ) pxStaticQueue;
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
{
/* ... */
pxNewQueue->ucStaticallyAllocated = pdTRUE;
...}/* ... */
#endif
prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue );
}if (( uxQueueLength > ( UBaseType_t ) 0 ) && ( pxStaticQueue != NULL ) && /* A queue storage area should be provided if the item size is not 0, and * should not be provided if the item size is 0. */ ( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0U ) ) ) && ( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0U ) ) )) { ... }
else
{
configASSERT( pxNewQueue );
mtCOVERAGE_TEST_MARKER();
}else { ... }
traceRETURN_xQueueGenericCreateStatic( pxNewQueue );
return pxNewQueue;
}xQueueGenericCreateStatic (const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t * pucQueueStorage, StaticQueue_t * pxStaticQueue, const uint8_t ucQueueType) { ... }
/* ... */
#endif
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
uint8_t ** ppucQueueStorage,
StaticQueue_t ** ppxStaticQueue )
{
BaseType_t xReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGenericGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue );
configASSERT( pxQueue );
configASSERT( ppxStaticQueue );
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
{
if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
{
if( ppucQueueStorage != NULL )
{
*ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
}if (ppucQueueStorage != NULL) { ... }
*ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
xReturn = pdTRUE;
}if (pxQueue->ucStaticallyAllocated == ( uint8_t ) pdTRUE) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
...}/* ... */
#else
{
if( ppucQueueStorage != NULL )
{
*ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
}if (ppucQueueStorage != NULL) { ... }
*ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
xReturn = pdTRUE;
...}/* ... */
#endif
traceRETURN_xQueueGenericGetStaticBuffers( xReturn );
return xReturn;
}xQueueGenericGetStaticBuffers (QueueHandle_t xQueue, uint8_t ** ppucQueueStorage, StaticQueue_t ** ppxStaticQueue) { ... }
/* ... */
#endif
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength,
const UBaseType_t uxItemSize,
const uint8_t ucQueueType )
{
Queue_t * pxNewQueue = NULL;
size_t xQueueSizeInBytes;
uint8_t * pucQueueStorage;
traceENTER_xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
if( ( uxQueueLength > ( UBaseType_t ) 0 ) &&
( ( SIZE_MAX / uxQueueLength ) >= uxItemSize ) &&
( ( UBaseType_t ) ( SIZE_MAX - sizeof( Queue_t ) ) >= ( uxQueueLength * uxItemSize ) ) )
{
/* ... */
xQueueSizeInBytes = ( size_t ) ( ( size_t ) uxQueueLength * ( size_t ) 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 { ... }
}if (( uxQueueLength > ( UBaseType_t ) 0 ) && /* Check for multiplication overflow. */ ( ( SIZE_MAX / uxQueueLength ) >= uxItemSize ) && /* Check for addition overflow. */ ( ( UBaseType_t ) ( SIZE_MAX - sizeof( Queue_t ) ) >= ( uxQueueLength * uxItemSize ) )) { ... }
else
{
configASSERT( pxNewQueue );
mtCOVERAGE_TEST_MARKER();
}else { ... }
traceRETURN_xQueueGenericCreate( pxNewQueue );
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 { ... }
}prvInitialiseMutex (Queue_t * pxNewQueue) { ... }
/* ... */
#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;
traceENTER_xQueueCreateMutex( ucQueueType );
xNewQueue = xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
traceRETURN_xQueueCreateMutex( xNewQueue );
return xNewQueue;
}xQueueCreateMutex (const uint8_t ucQueueType) { ... }
/* ... */
#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;
traceENTER_xQueueCreateMutexStatic( ucQueueType, pxStaticQueue );
/* ... */
( void ) ucQueueType;
xNewQueue = xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType );
prvInitialiseMutex( ( Queue_t * ) xNewQueue );
traceRETURN_xQueueCreateMutexStatic( 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;
traceENTER_xQueueGetMutexHolder( xSemaphore );
configASSERT( 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();
traceRETURN_xQueueGetMutexHolder( pxReturn );
return pxReturn;
}xQueueGetMutexHolder (QueueHandle_t xSemaphore) { ... }
/* ... */
#endif
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
TaskHandle_t xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore )
{
TaskHandle_t pxReturn;
traceENTER_xQueueGetMutexHolderFromISR( xSemaphore );
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 { ... }
traceRETURN_xQueueGetMutexHolderFromISR( pxReturn );
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;
traceENTER_xQueueGiveMutexRecursive( 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 { ... }
traceRETURN_xQueueGiveMutexRecursive( xReturn );
return xReturn;
}xQueueGiveMutexRecursive (QueueHandle_t xMutex) { ... }
/* ... */
#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;
traceENTER_xQueueTakeMutexRecursive( xMutex, xTicksToWait );
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 { ... }
traceRETURN_xQueueTakeMutexRecursive( xReturn );
return xReturn;
}xQueueTakeMutexRecursive (QueueHandle_t xMutex, TickType_t xTicksToWait) { ... }
/* ... */
#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 = NULL;
traceENTER_xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue );
if( ( uxMaxCount != 0U ) &&
( 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 { ... }
}if (( uxMaxCount != 0U ) && ( uxInitialCount <= uxMaxCount )) { ... }
else
{
configASSERT( xHandle );
mtCOVERAGE_TEST_MARKER();
}else { ... }
traceRETURN_xQueueCreateCountingSemaphoreStatic( xHandle );
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 = NULL;
traceENTER_xQueueCreateCountingSemaphore( uxMaxCount, uxInitialCount );
if( ( uxMaxCount != 0U ) &&
( 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 { ... }
}if (( uxMaxCount != 0U ) && ( uxInitialCount <= uxMaxCount )) { ... }
else
{
configASSERT( xHandle );
mtCOVERAGE_TEST_MARKER();
}else { ... }
traceRETURN_xQueueCreateCountingSemaphore( xHandle );
return xHandle;
}xQueueCreateCountingSemaphore (const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount) { ... }
/* ... */
#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;
traceENTER_xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
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();
traceRETURN_xQueueGenericSend( pdPASS );
return pdPASS;
}if (( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE )) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
/* ... */
traceQUEUE_SEND_FAILED( pxQueue );
traceRETURN_xQueueGenericSend( errQUEUE_FULL );
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 )
{
taskYIELD_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 );
traceRETURN_xQueueGenericSend( errQUEUE_FULL );
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;
traceENTER_xQueueGenericSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition );
configASSERT( pxQueue );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
/* ... */
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_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
{
/* ... */
prvIncrementQueueTxLock( pxQueue, cTxLock );
}else { ... }
xReturn = pdPASS;
}if (( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE )) { ... }
else
{
traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );
xReturn = errQUEUE_FULL;
}else { ... }
...}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueGenericSendFromISR( xReturn );
return xReturn;
}{ ... }
BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
BaseType_t * const pxHigherPriorityTaskWoken )
{
BaseType_t xReturn;
UBaseType_t uxSavedInterruptStatus;
Queue_t * const pxQueue = xQueue;
traceENTER_xQueueGiveFromISR( xQueue, pxHigherPriorityTaskWoken );
/* ... */
configASSERT( pxQueue );
/* ... */
configASSERT( pxQueue->uxItemSize == 0 );
/* ... */
configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->u.xSemaphore.xMutexHolder != NULL ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_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 = ( UBaseType_t ) ( 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
{
/* ... */
prvIncrementQueueTxLock( pxQueue, cTxLock );
}else { ... }
xReturn = pdPASS;
}if (uxMessagesWaiting < pxQueue->uxLength) { ... }
else
{
traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue );
xReturn = errQUEUE_FULL;
}else { ... }
...}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueGiveFromISR( xReturn );
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;
traceENTER_xQueueReceive( xQueue, pvBuffer, xTicksToWait );
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 = ( UBaseType_t ) ( 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();
traceRETURN_xQueueReceive( pdPASS );
return pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueReceive( errQUEUE_EMPTY );
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 )
{
taskYIELD_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 );
traceRETURN_xQueueReceive( errQUEUE_EMPTY );
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
traceENTER_xQueueSemaphoreTake( xQueue, xTicksToWait );
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 = ( UBaseType_t ) ( 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();
traceRETURN_xQueueSemaphoreTake( pdPASS );
return pdPASS;
}if (uxSemaphoreCount > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueSemaphoreTake( errQUEUE_EMPTY );
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 )
{
taskYIELD_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 = prvGetHighestPriorityOfWaitToReceiveList( pxQueue );
/* ... */
vTaskPriorityDisinheritAfterTimeout( pxQueue->u.xSemaphore.xMutexHolder, uxHighestWaitingPriority );
...}
taskEXIT_CRITICAL();
}if (xInheritanceOccurred != pdFALSE) { ... }
...}/* ... */
#endif
traceQUEUE_RECEIVE_FAILED( pxQueue );
traceRETURN_xQueueSemaphoreTake( errQUEUE_EMPTY );
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;
traceENTER_xQueuePeek( xQueue, pvBuffer, xTicksToWait );
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();
traceRETURN_xQueuePeek( pdPASS );
return pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
if( xTicksToWait == ( TickType_t ) 0 )
{
/* ... */
taskEXIT_CRITICAL();
traceQUEUE_PEEK_FAILED( pxQueue );
traceRETURN_xQueuePeek( errQUEUE_EMPTY );
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 )
{
taskYIELD_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 );
traceRETURN_xQueuePeek( errQUEUE_EMPTY );
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;
traceENTER_xQueueReceiveFromISR( xQueue, pvBuffer, pxHigherPriorityTaskWoken );
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_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 = ( UBaseType_t ) ( 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
{
/* ... */
prvIncrementQueueRxLock( pxQueue, cRxLock );
}else { ... }
xReturn = pdPASS;
}if (uxMessagesWaiting > ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFAIL;
traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );
}else { ... }
...}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueueReceiveFromISR( xReturn );
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;
traceENTER_xQueuePeekFromISR( xQueue, pvBuffer );
configASSERT( pxQueue );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( pxQueue->uxItemSize != 0 );
/* ... */
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
uxSavedInterruptStatus = ( UBaseType_t ) taskENTER_CRITICAL_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 { ... }
...}
taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus );
traceRETURN_xQueuePeekFromISR( xReturn );
return xReturn;
}{ ... }
UBaseType_t uxQueueMessagesWaiting( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
traceENTER_uxQueueMessagesWaiting( xQueue );
configASSERT( xQueue );
taskENTER_CRITICAL();
{
uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting;
...}
taskEXIT_CRITICAL();
traceRETURN_uxQueueMessagesWaiting( uxReturn );
return uxReturn;
}{ ... }
UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_uxQueueSpacesAvailable( xQueue );
configASSERT( pxQueue );
taskENTER_CRITICAL();
{
uxReturn = ( UBaseType_t ) ( pxQueue->uxLength - pxQueue->uxMessagesWaiting );
...}
taskEXIT_CRITICAL();
traceRETURN_uxQueueSpacesAvailable( uxReturn );
return uxReturn;
}{ ... }
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue )
{
UBaseType_t uxReturn;
Queue_t * const pxQueue = xQueue;
traceENTER_uxQueueMessagesWaitingFromISR( xQueue );
configASSERT( pxQueue );
uxReturn = pxQueue->uxMessagesWaiting;
traceRETURN_uxQueueMessagesWaitingFromISR( uxReturn );
return uxReturn;
}{ ... }
void vQueueDelete( QueueHandle_t xQueue )
{
Queue_t * const pxQueue = xQueue;
traceENTER_vQueueDelete( 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
traceRETURN_vQueueDelete();
}{ ... }
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue )
{
traceENTER_uxQueueGetQueueNumber( xQueue );
traceRETURN_uxQueueGetQueueNumber( ( ( Queue_t * ) xQueue )->uxQueueNumber );
return ( ( Queue_t * ) xQueue )->uxQueueNumber;
}uxQueueGetQueueNumber (QueueHandle_t xQueue) { ... }
/* ... */
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueNumber )
{
traceENTER_vQueueSetQueueNumber( xQueue, uxQueueNumber );
( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber;
traceRETURN_vQueueSetQueueNumber();
}vQueueSetQueueNumber (QueueHandle_t xQueue, UBaseType_t uxQueueNumber) { ... }
/* ... */
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue )
{
traceENTER_ucQueueGetQueueType( xQueue );
traceRETURN_ucQueueGetQueueType( ( ( Queue_t * ) xQueue )->ucQueueType );
return ( ( Queue_t * ) xQueue )->ucQueueType;
}ucQueueGetQueueType (QueueHandle_t xQueue) { ... }
/* ... */
#endif
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue )
{
traceENTER_uxQueueGetQueueItemSize( xQueue );
traceRETURN_uxQueueGetQueueItemSize( ( ( Queue_t * ) xQueue )->uxItemSize );
return ( ( Queue_t * ) xQueue )->uxItemSize;
...}
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue )
{
traceENTER_uxQueueGetQueueLength( xQueue );
traceRETURN_uxQueueGetQueueLength( ( ( Queue_t * ) xQueue )->uxLength );
return ( ( Queue_t * ) xQueue )->uxLength;
...}
#if ( configUSE_MUTEXES == 1 )
static UBaseType_t prvGetHighestPriorityOfWaitToReceiveList( const Queue_t * const pxQueue )
{
UBaseType_t uxHighestPriorityOfWaitingTasks;
/* ... */
if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U )
{
uxHighestPriorityOfWaitingTasks = ( UBaseType_t ) ( ( 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;
}prvGetHighestPriorityOfWaitToReceiveList (const Queue_t * const pxQueue) { ... }
/* ... */
#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;
}if (pxQueue->pcWriteTo >= pxQueue->u.xQueue.pcTail) { ... }
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 );
}if (pxQueue->u.xQueue.pcReadFrom < pxQueue->pcHead) { ... }
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 = ( UBaseType_t ) ( 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;
}if (pxQueue->u.xQueue.pcReadFrom >= pxQueue->u.xQueue.pcTail) { ... }
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;
traceENTER_xQueueIsQueueEmptyFromISR( xQueue );
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
traceRETURN_xQueueIsQueueEmptyFromISR( xReturn );
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;
traceENTER_xQueueIsQueueFullFromISR( xQueue );
configASSERT( pxQueue );
if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )
{
xReturn = pdTRUE;
}if (pxQueue->uxMessagesWaiting == pxQueue->uxLength) { ... }
else
{
xReturn = pdFALSE;
}else { ... }
traceRETURN_xQueueIsQueueFullFromISR( xReturn );
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;
traceENTER_xQueueCRSend( xQueue, pvItemToQueue, xTicksToWait );
/* ... */
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();
traceRETURN_xQueueCRSend( xReturn );
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;
traceENTER_xQueueCRReceive( xQueue, pvBuffer, xTicksToWait );
/* ... */
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();
traceRETURN_xQueueCRReceive( xReturn );
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;
traceENTER_xQueueCRSendFromISR( xQueue, pvItemToQueue, xCoRoutinePreviouslyWoken );
/* ... */
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 { ... }
traceRETURN_xQueueCRSendFromISR( xCoRoutinePreviouslyWoken );
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;
traceENTER_xQueueCRReceiveFromISR( xQueue, pvBuffer, pxCoRoutineWoken );
/* ... */
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 { ... }
traceRETURN_xQueueCRReceiveFromISR( xReturn );
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;
QueueRegistryItem_t * pxEntryToWrite = NULL;
traceENTER_vQueueAddToRegistry( xQueue, pcQueueName );
configASSERT( xQueue );
if( pcQueueName != NULL )
{
/* ... */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
if( xQueue == xQueueRegistry[ ux ].xHandle )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
break;
}if (xQueue == xQueueRegistry[ ux ].xHandle) { ... }
else if( ( pxEntryToWrite == NULL ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
}else if (( pxEntryToWrite == NULL ) && ( xQueueRegistry[ ux ].pcQueueName == NULL )) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
}for (ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++) { ... }
}if (pcQueueName != NULL) { ... }
if( pxEntryToWrite != NULL )
{
pxEntryToWrite->pcQueueName = pcQueueName;
pxEntryToWrite->xHandle = xQueue;
traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName );
}if (pxEntryToWrite != NULL) { ... }
traceRETURN_vQueueAddToRegistry();
}vQueueAddToRegistry (QueueHandle_t xQueue, const char * pcQueueName) { ... }
/* ... */
#endif
#if ( configQUEUE_REGISTRY_SIZE > 0 )
const char * pcQueueGetName( QueueHandle_t xQueue )
{
UBaseType_t ux;
const char * pcReturn = NULL;
traceENTER_pcQueueGetName( xQueue );
configASSERT( xQueue );
/* ... */
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++) { ... }
traceRETURN_pcQueueGetName( pcReturn );
return pcReturn;
}pcQueueGetName (QueueHandle_t xQueue) { ... }
/* ... */
#endif
#if ( configQUEUE_REGISTRY_SIZE > 0 )
void vQueueUnregisterQueue( QueueHandle_t xQueue )
{
UBaseType_t ux;
traceENTER_vQueueUnregisterQueue( xQueue );
configASSERT( xQueue );
/* ... */
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++) { ... }
traceRETURN_vQueueUnregisterQueue();
}vQueueUnregisterQueue (QueueHandle_t xQueue) { ... }
/* ... */
#endif
#if ( configUSE_TIMERS == 1 )
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue,
TickType_t xTicksToWait,
const BaseType_t xWaitIndefinitely )
{
Queue_t * const pxQueue = xQueue;
traceENTER_vQueueWaitForMessageRestricted( xQueue, xTicksToWait, xWaitIndefinitely );
/* ... */
/* ... */
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 );
traceRETURN_vQueueWaitForMessageRestricted();
}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;
traceENTER_xQueueCreateSet( uxEventQueueLength );
pxQueue = xQueueGenericCreate( uxEventQueueLength, ( UBaseType_t ) sizeof( Queue_t * ), queueQUEUE_TYPE_SET );
traceRETURN_xQueueCreateSet( pxQueue );
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;
traceENTER_xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
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();
traceRETURN_xQueueAddToSet( xReturn );
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;
traceENTER_xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
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 { ... }
traceRETURN_xQueueRemoveFromSet( xReturn );
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;
traceENTER_xQueueSelectFromSet( xQueueSet, xTicksToWait );
( void ) xQueueReceive( ( QueueHandle_t ) xQueueSet, &xReturn, xTicksToWait );
traceRETURN_xQueueSelectFromSet( xReturn );
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;
traceENTER_xQueueSelectFromSetFromISR( xQueueSet );
( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL );
traceRETURN_xQueueSelectFromSetFromISR( xReturn );
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_SET_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
{
prvIncrementQueueTxLock( pxQueueSetContainer, cTxLock );
}else { ... }
}if (pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength) { ... }
else
{
mtCOVERAGE_TEST_MARKER();
}else { ... }
return xReturn;
}prvNotifyQueueSetContainer (const Queue_t * const pxQueue) { ... }
/* ... */
#endif