Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define FREERTOS_H
#include <stdint.h>
#include <tx_api.h>
#include <FreeRTOSConfig.h>
#define portCRITICAL_NESTING_IN_TCB
#define portCLEAN_UP_TCB
#define portPRE_TASK_DELETE_HOOK
#define portSETUP_TCB
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
#define portPRIVILEGE_BIT
#define portYIELD_WITHIN_API
#define portSUPPRESS_TICKS_AND_SLEEP
#define portTASK_USES_FLOATING_POINT
#define portALLOCATE_SECURE_CONTEXT
#define portDONT_DISCARD
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID
#define mtCOVERAGE_TEST_MARKER
#define mtCOVERAGE_TEST_DELAY
#define portASSERT_IF_IN_ISR
#define portTICK_TYPE_IS_ATOMIC
#define portTICK_TYPE_ENTER_CRITICAL
#define portTICK_TYPE_EXIT_CRITICAL
#define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR
#define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR
#define eTaskStateGet
#define portTickType
#define xTaskHandle
#define xQueueHandle
#define xSemaphoreHandle
#define xQueueSetHandle
#define xQueueSetMemberHandle
#define xTimeOutType
#define xMemoryRegion
#define xTaskParameters
#define xTaskStatusType
#define xTimerHandle
#define xCoRoutineHandle
#define pdTASK_HOOK_CODE
#define portTICK_RATE_MS
#define pcTaskGetTaskName
#define pcTimerGetTimerName
#define pcQueueGetQueueName
#define vTaskGetTaskInfo
#define tmrTIMER_CALLBACK
#define pdTASK_CODE
#define xListItem
#define xList
#define pxContainer
#define traceSTART
#define traceEND
#define vQueueAddToRegistry
#define vQueueUnregisterQueue
#define TX_FREERTOS_ASSERT_FAIL
#define configASSERT
#define configSTACK_DEPTH_TYPE
BaseType_t
UBaseType_t
StackType_t
#define TX_FREERTOS_AUTO_INIT
#define configUSE_16_BIT_TICKS
#define portMAX_DELAY
TickType_t
#define portMAX_DELAY
#define portTICK_TYPE_IS_ATOMIC
eNotifyAction
eTaskState
#define TXFR_NOTIFYACTION_VALID
txfr_queueset
txfr_task
txfr_task
StaticTask_t
TaskHandle_t
txfr_sem
SemaphoreHandle_t
StaticSemaphore_t
txfr_queue
QueueHandle_t
StaticQueue_t
EventBits_t
txfr_event
EventGroupHandle_t
StaticEventGroup_t
txfr_timer
TimerHandle_t
StaticTimer_t
txfr_timer
txfr_queueset
QueueSetHandle_t
QueueSetMemberHandle_t
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY
#define errQUEUE_BLOCKED
#define errQUEUE_YIELD
#define pdFALSE
#define pdTRUE
#define pdPASS
#define pdFAIL
#define errQUEUE_EMPTY
#define errQUEUE_FULL
tx_freertos_init();
#define tskIDLE_PRIORITY
#define taskYIELD
#define taskYIELD_FROM_ISR
pvPortMalloc(size_t);
vPortFree(void *);
vPortEnterCritical();
vPortExitCritical();
#define taskENTER_CRITICAL_FROM_ISR
#define taskEXIT_CRITICAL_FROM_ISR
#define portDISABLE_INTERRUPTS
#define portDISABLE_INTERRUPTS
#define portDISABLE_INTERRUPTS
#define portDISABLE_INTERRUPTS
#define portENABLE_INTERRUPTS
#define portENABLE_INTERRUPTS
#define portENABLE_INTERRUPTS
#define portENABLE_INTERRUPTS
#define taskENTER_CRITICAL
#define taskEXIT_CRITICAL
#define portENTER_CRITICAL
#define portEXIT_CRITICAL
#define taskDISABLE_INTERRUPTS
#define taskENABLE_INTERRUPTS
#define taskSCHEDULER_SUSPENDED
#define taskSCHEDULER_NOT_STARTED
#define taskSCHEDULER_RUNNING
vTaskStartScheduler();
xTaskGetSchedulerState();
vTaskSuspendAll();
xTaskResumeAll();
xTaskCreateStatic(TaskFunction_t, const char *const, const uint16_t, void *const, UBaseType_t, StackType_t *const, StaticTask_t *const);
xTaskCreate(TaskFunction_t, const char *const, const uint16_t, void *, UBaseType_t, TaskHandle_t *const);
uxTaskGetNumberOfTasks();
vTaskDelete(TaskHandle_t);
vTaskDelay(const TickType_t);
vTaskDelayUntil(TickType_t *const, const TickType_t);
xTaskGetCurrentTaskHandle();
vTaskSuspend(TaskHandle_t);
vTaskResume(TaskHandle_t);
xTaskResumeFromISR(TaskHandle_t);
xTaskAbortDelay(TaskHandle_t);
uxTaskPriorityGet(const TaskHandle_t);
uxTaskPriorityGetFromISR(const TaskHandle_t);
vTaskPrioritySet(TaskHandle_t, UBaseType_t);
pcTaskGetName(TaskHandle_t);
eTaskGetState(TaskHandle_t);
xTaskGetTickCount();
xTaskGetTickCountFromISR();
xTaskNotifyGive(TaskHandle_t);
vTaskNotifyGiveFromISR(TaskHandle_t, BaseType_t *);
ulTaskNotifyTake(BaseType_t, TickType_t);
xTaskNotifyWait(uint32_t, uint32_t, uint32_t *, TickType_t);
xTaskNotify(TaskHandle_t, uint32_t, eNotifyAction);
xTaskNotifyFromISR(TaskHandle_t, uint32_t, eNotifyAction, BaseType_t *);
xTaskNotifyAndQuery(TaskHandle_t, uint32_t, eNotifyAction, uint32_t *);
#define xTaskGenericNotify
xTaskNotifyAndQueryFromISR(TaskHandle_t, uint32_t, eNotifyAction, uint32_t *, BaseType_t *);
#define xTaskGenericNotifyFromISR
xTaskNotifyStateClear(TaskHandle_t);
ulTaskNotifyValueClear(TaskHandle_t, uint32_t);
#define semBINARY_SEMAPHORE_QUEUE_LENGTH
#define semSEMAPHORE_QUEUE_ITEM_LENGTH
#define semGIVE_BLOCK_TIME
xSemaphoreCreateCounting(UBaseType_t, UBaseType_t);
xSemaphoreCreateCountingStatic(UBaseType_t, UBaseType_t, StaticSemaphore_t *);
xSemaphoreCreateBinary();
xSemaphoreCreateBinaryStatic(StaticSemaphore_t *);
xSemaphoreCreateMutex();
xSemaphoreCreateMutexStatic(StaticSemaphore_t *);
xSemaphoreCreateRecursiveMutex();
xSemaphoreCreateRecursiveMutexStatic(StaticSemaphore_t *);
vSemaphoreDelete(SemaphoreHandle_t);
xSemaphoreTake(SemaphoreHandle_t, TickType_t);
xSemaphoreTakeFromISR(SemaphoreHandle_t, BaseType_t *);
xSemaphoreTakeRecursive(SemaphoreHandle_t, TickType_t);
xSemaphoreGive(SemaphoreHandle_t);
xSemaphoreGiveFromISR(SemaphoreHandle_t, BaseType_t *);
xSemaphoreGiveRecursive(SemaphoreHandle_t);
uxSemaphoreGetCount(SemaphoreHandle_t);
xSemaphoreGetMutexHolder(SemaphoreHandle_t);
xSemaphoreGetMutexHolderFromISR(SemaphoreHandle_t);
xQueueCreate(UBaseType_t, UBaseType_t);
xQueueCreateStatic(UBaseType_t, UBaseType_t, uint8_t *, StaticQueue_t *);
vQueueDelete(QueueHandle_t);
xQueueSend(QueueHandle_t, const void *, TickType_t);
xQueueSendFromISR(QueueHandle_t, const void *, BaseType_t *);
xQueueSendToBack(QueueHandle_t, const void *, TickType_t);
xQueueSendToBackFromISR(QueueHandle_t, const void *, BaseType_t *);
xQueueSendToFront(QueueHandle_t, const void *, TickType_t);
xQueueSendToFrontFromISR(QueueHandle_t, const void *, BaseType_t *);
xQueueReceive(QueueHandle_t, void *, TickType_t);
xQueueReceiveFromISR(QueueHandle_t, void *, BaseType_t *);
xQueuePeek(QueueHandle_t, void *, TickType_t);
xQueuePeekFromISR(QueueHandle_t, void *);
uxQueueMessagesWaiting(QueueHandle_t);
uxQueueMessagesWaitingFromISR(QueueHandle_t);
uxQueueSpacesAvailable(QueueHandle_t);
xQueueIsQueueEmptyFromISR(const QueueHandle_t);
xQueueIsQueueFullFromISR(const QueueHandle_t);
xQueueReset(QueueHandle_t);
xQueueOverwrite(QueueHandle_t, const void *);
xQueueOverwriteFromISR(QueueHandle_t, const void *, BaseType_t *);
xEventGroupCreate();
xEventGroupCreateStatic(StaticEventGroup_t *);
vEventGroupDelete(EventGroupHandle_t);
xEventGroupWaitBits(const EventGroupHandle_t, const EventBits_t, const BaseType_t, const BaseType_t, TickType_t);
xEventGroupSetBits(EventGroupHandle_t, const EventBits_t);
xEventGroupSetBitsFromISR(EventGroupHandle_t, const EventBits_t, BaseType_t *);
xEventGroupClearBits(EventGroupHandle_t, const EventBits_t);
xEventGroupClearBitsFromISR(EventGroupHandle_t, const EventBits_t);
xEventGroupGetBits(EventGroupHandle_t);
xEventGroupGetBitsFromISR(EventGroupHandle_t);
#define pdMS_TO_TICKS
xTimerCreate(const char *const, const TickType_t, const UBaseType_t, void *const, TimerCallbackFunction_t);
xTimerCreateStatic(const char *const, const TickType_t, const UBaseType_t, void *const, TimerCallbackFunction_t, StaticTimer_t *);
xTimerDelete(TimerHandle_t, TickType_t);
xTimerIsTimerActive(TimerHandle_t);
xTimerStart(TimerHandle_t, TickType_t);
xTimerStop(TimerHandle_t, TickType_t);
xTimerChangePeriod(TimerHandle_t, TickType_t, TickType_t);
xTimerReset(TimerHandle_t, TickType_t);
xTimerStartFromISR(TimerHandle_t, BaseType_t *);
xTimerStopFromISR(TimerHandle_t, BaseType_t *);
xTimerChangePeriodFromISR(TimerHandle_t, TickType_t, BaseType_t *);
xTimerResetFromISR(TimerHandle_t, BaseType_t *);
pvTimerGetTimerID(TimerHandle_t);
vTimerSetTimerID(TimerHandle_t, void *);
vTimerSetReloadMode(TimerHandle_t, const UBaseType_t);
pcTimerGetName(TimerHandle_t);
xTimerGetPeriod(TimerHandle_t);
xTimerGetExpiryTime(TimerHandle_t);
uxTimerGetReloadMode(TimerHandle_t);
xQueueCreateSet(const UBaseType_t);
xQueueAddToSet(QueueSetMemberHandle_t, QueueSetHandle_t);
xQueueRemoveFromSet(QueueSetMemberHandle_t, QueueSetHandle_t);
xQueueSelectFromSet(QueueSetHandle_t, const TickType_t);
xQueueSelectFromSetFromISR(QueueSetHandle_t);
Files
loading...
CodeScopeSTM32 Libraries and Samplesthreadxutility/rtos_compatibility_layers/FreeRTOS/FreeRTOS.h
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
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
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** ThreadX Component */ /** */ /** FreeRTOS compatibility Kit */ /** */... /**************************************************************************/ /**************************************************************************/ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ /* 03-02-2021 Andres Mlinar Modified comment(s), fixed */ /* interrupt macros, */ /* resulting in version 6.1.5 */... /**************************************************************************/ #ifndef FREERTOS_H #define FREERTOS_H #include <stdint.h> #include <tx_api.h> #include <FreeRTOSConfig.h> //// Hard coded configurations and other preprocessor definitions for compatibility. #define portCRITICAL_NESTING_IN_TCB 0 #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending ) #define portSETUP_TCB( pxTCB ) ( void ) pxTCB #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() #define portPRIVILEGE_BIT ((UBaseType_t)0x00) #define portYIELD_WITHIN_API portYIELD #define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime) #define portTASK_USES_FLOATING_POINT() #define portALLOCATE_SECURE_CONTEXT(ulSecureStackSize) #define portDONT_DISCARD #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() #define mtCOVERAGE_TEST_MARKER() #define mtCOVERAGE_TEST_DELAY() #define portASSERT_IF_IN_ISR() #define portTICK_TYPE_IS_ATOMIC 1 #define portTICK_TYPE_ENTER_CRITICAL() #define portTICK_TYPE_EXIT_CRITICAL() #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR(x) (void) x 20 defines #if (configENABLE_BACKWARD_COMPATIBILITY == 1) #define eTaskStateGet eTaskGetState #define portTickType TickType_t #define xTaskHandle TaskHandle_t #define xQueueHandle QueueHandle_t #define xSemaphoreHandle SemaphoreHandle_t #define xQueueSetHandle QueueSetHandle_t #define xQueueSetMemberHandle QueueSetMemberHandle_t #define xTimeOutType TimeOut_t #define xMemoryRegion MemoryRegion_t #define xTaskParameters TaskParameters_t #define xTaskStatusType TaskStatus_t #define xTimerHandle TimerHandle_t #define xCoRoutineHandle CoRoutineHandle_t #define pdTASK_HOOK_CODE TaskHookFunction_t #define portTICK_RATE_MS portTICK_PERIOD_MS #define pcTaskGetTaskName pcTaskGetName #define pcTimerGetTimerName pcTimerGetName #define pcQueueGetQueueName pcQueueGetName #define vTaskGetTaskInfo vTaskGetInfo #define tmrTIMER_CALLBACK TimerCallbackFunction_t #define pdTASK_CODE TaskFunction_t #define xListItem ListItem_t #define xList List_t #define pxContainer pvContainer /* ... */#endif // (#if configENABLE_BACKWARD_COMPATIBILITY == 1) #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \ ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )... //// Trace is not supported. #define traceSTART() #define traceEND() //// Other #define vQueueAddToRegistry(xQueue, pcName) #define vQueueUnregisterQueue(xQueue) 5 defines // Assertion failure macro invoked on internal errors. #ifndef TX_FREERTOS_ASSERT_FAIL #define TX_FREERTOS_ASSERT_FAIL() #endif // Assertion check macro used to check for invalid arguments. #ifndef configASSERT #define configASSERT(x) #endif #ifndef configSTACK_DEPTH_TYPE #define configSTACK_DEPTH_TYPE uint16_t #endif typedef LONG BaseType_t; typedef ULONG UBaseType_t; typedef UINT StackType_t; #ifndef TX_FREERTOS_AUTO_INIT #define TX_FREERTOS_AUTO_INIT 0 #endif #ifndef configMINIMAL_STACK_SIZE #error "configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h" #endif #ifndef configUSE_16_BIT_TICKS #define configUSE_16_BIT_TICKS 0 #endif #if (configUSE_16_BIT_TICKS == 1) typedef uint16_t TickType_t; #define portMAX_DELAY (TickType_t) (0xffffU) /* ... */#else typedef uint32_t TickType_t; #define portMAX_DELAY (TickType_t) (0xffffffffUL) #define portTICK_TYPE_IS_ATOMIC 1 // TODO - is this needed. /* ... */#endif typedef void (*TaskFunction_t)(void *); typedef enum { eNoAction = 0, eSetBits, eIncrement, eSetValueWithOverwrite, eSetValueWithoutOverwrite, ...} eNotifyAction; typedef enum { eRunning = 0, eReady, eBlocked, eSuspended, eDeleted, eInvalid ...} eTaskState; #define TXFR_NOTIFYACTION_VALID(x) (((int)x >= (int)eNoAction) && ((int)x <= (int)eSetValueWithoutOverwrite)) typedef struct txfr_queueset txfr_queueset_t; typedef struct txfr_task txfr_task_t; // Task related structures and type definitions. struct txfr_task { txfr_task_t *p_next; TX_THREAD thread; TaskFunction_t p_task_func; void *p_task_arg; uint32_t task_notify_val; uint32_t task_notify_val_pend; uint32_t *p_notify_val_ret; TX_SEMAPHORE notification_sem; uint8_t notification_pending; uint8_t clear_on_pend; uint32_t clear_mask; uint8_t allocated; ...}; typedef txfr_task_t StaticTask_t; typedef txfr_task_t* TaskHandle_t; // Semaphore related structures and type definitions. typedef struct txfr_sem { TX_SEMAPHORE sem; TX_MUTEX mutex; UBaseType_t max_count; uint8_t allocated; uint8_t is_mutex; txfr_queueset_t *p_set; ...} txfr_sem_t; typedef txfr_sem_t *SemaphoreHandle_t; typedef txfr_sem_t StaticSemaphore_t; // Queue related structures and type definitions. typedef struct txfr_queue { ULONG id; uint8_t allocated; txfr_queueset_t *p_set; uint8_t *p_mem; TX_SEMAPHORE read_sem; TX_SEMAPHORE write_sem; uint8_t *p_write; uint8_t *p_read; UBaseType_t queue_length; UBaseType_t msg_size; ...} txfr_queue_t; typedef txfr_queue_t *QueueHandle_t; typedef txfr_queue_t StaticQueue_t; // Event group related structures and type definitions. typedef TickType_t EventBits_t; typedef struct txfr_event { TX_EVENT_FLAGS_GROUP event; uint8_t allocated; ...} txfr_event_t; typedef txfr_event_t *EventGroupHandle_t; typedef txfr_event_t StaticEventGroup_t; // Timers related structures and type definitions. typedef struct txfr_timer txfr_timer_t; typedef txfr_timer_t *TimerHandle_t; typedef txfr_timer_t StaticTimer_t; typedef void (*TimerCallbackFunction_t)(TimerHandle_t xTimer); struct txfr_timer { TX_TIMER timer; uint32_t period; uint8_t one_shot; uint8_t allocated; void *id; TimerCallbackFunction_t callback; ...}; // Queue set related structures and type definitions. struct txfr_queueset { TX_QUEUE queue; ...}; typedef txfr_queueset_t *QueueSetHandle_t; typedef void *QueueSetMemberHandle_t; // Common definitions. #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) #define errQUEUE_BLOCKED ( -4 ) #define errQUEUE_YIELD ( -5 ) #define pdFALSE ((BaseType_t)0) #define pdTRUE ((BaseType_t)1) #define pdPASS (pdTRUE) #define pdFAIL (pdFALSE) #define errQUEUE_EMPTY ((BaseType_t)0) #define errQUEUE_FULL ((BaseType_t)0) 9 defines // Initialize the adaptation layer. UINT tx_freertos_init(void); #define tskIDLE_PRIORITY ((UBaseType_t)0U) #define taskYIELD() tx_thread_relinquish() #define taskYIELD_FROM_ISR() void *pvPortMalloc(size_t xWantedSize); void vPortFree(void *pv); void vPortEnterCritical(void); void vPortExitCritical(void); //// // Task API #ifndef taskENTER_CRITICAL_FROM_ISR #define taskENTER_CRITICAL_FROM_ISR() __get_interrupt_state(); __disable_interrupt(); #endif #ifndef taskEXIT_CRITICAL_FROM_ISR #define taskEXIT_CRITICAL_FROM_ISR(x) __set_interrupt_state(x); #endif #ifndef portDISABLE_INTERRUPTS #if defined(__IAR_SYSTEMS_ICC__) #define portDISABLE_INTERRUPTS() __disable_interrupt() #elif defined(__GNUC__ ) #define portDISABLE_INTERRUPTS() __disable_interrupts() #elif defined(__ARMCC_VERSION) #define portDISABLE_INTERRUPTS() __disable_irq() #else UINT _tx_thread_interrupt_disable(VOID); #define portDISABLE_INTERRUPTS() _tx_thread_interrupt_disable() /* ... */#endif/* ... */ #endif #ifndef portENABLE_INTERRUPTS #if defined(__IAR_SYSTEMS_ICC__) #define portENABLE_INTERRUPTS() __enable_interrupt() #elif defined(__GNUC__ ) #define portENABLE_INTERRUPTS() __enable_interrupts() #elif defined(__ARMCC_VERSION) #define portENABLE_INTERRUPTS() __enable_irq() #else VOID _tx_thread_interrupt_restore(UINT previous_posture); #define portENABLE_INTERRUPTS() _tx_thread_interrupt_restore(TX_INT_ENABLE) /* ... */#endif/* ... */ #endif #define taskENTER_CRITICAL() portENTER_CRITICAL() #define taskEXIT_CRITICAL() portEXIT_CRITICAL() #define portENTER_CRITICAL() vPortEnterCritical() #define portEXIT_CRITICAL() vPortExitCritical() #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS() #define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS() #define taskSCHEDULER_SUSPENDED ((BaseType_t)0) #define taskSCHEDULER_NOT_STARTED ((BaseType_t)1) #define taskSCHEDULER_RUNNING ((BaseType_t)2) 9 defines void vTaskStartScheduler(void); BaseType_t xTaskGetSchedulerState(void); void vTaskSuspendAll(void); BaseType_t xTaskResumeAll(void); TaskHandle_t xTaskCreateStatic(TaskFunction_t pxTaskCode, const char *const pcName, const configSTACK_DEPTH_TYPE ulStackDepth, void *const pvParameters, UBaseType_t uxPriority, StackType_t *const puxStackBuffer, StaticTask_t *const pxTaskBuffer); BaseType_t xTaskCreate(TaskFunction_t pvTaskCode, const char * const pcName, const configSTACK_DEPTH_TYPE usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask); UBaseType_t uxTaskGetNumberOfTasks(void); void vTaskDelete(TaskHandle_t xTask); void vTaskDelay(const TickType_t xTicksToDelay); void vTaskDelayUntil(TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement); TaskHandle_t xTaskGetCurrentTaskHandle(void); void vTaskSuspend(TaskHandle_t xTaskToSuspend); void vTaskResume(TaskHandle_t xTaskToResume); BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume); BaseType_t xTaskAbortDelay(TaskHandle_t xTask); UBaseType_t uxTaskPriorityGet(const TaskHandle_t xTask); UBaseType_t uxTaskPriorityGetFromISR(const TaskHandle_t xTask); void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority); char *pcTaskGetName(TaskHandle_t xTaskToQuery); eTaskState eTaskGetState(TaskHandle_t xTask); TickType_t xTaskGetTickCount(void); TickType_t xTaskGetTickCountFromISR(void); //// // Task notification API. BaseType_t xTaskNotifyGive(TaskHandle_t xTaskToNotify); void vTaskNotifyGiveFromISR(TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken); uint32_t ulTaskNotifyTake(BaseType_t xClearCountOnExit, TickType_t xTicksToWait); BaseType_t xTaskNotifyWait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ); BaseType_t xTaskNotify(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction); BaseType_t xTaskNotifyFromISR(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xTaskNotifyAndQuery(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue); #define xTaskGenericNotify(a, b, c, d) xTaskNotifyAndQuery(a, b, c, d) BaseType_t xTaskNotifyAndQueryFromISR(TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotifyValue, BaseType_t *pxHigherPriorityTaskWoken); #define xTaskGenericNotifyFromISR(a, b, c, d, e) xTaskNotifyAndQueryFromISR(a, b, c, d, e) BaseType_t xTaskNotifyStateClear(TaskHandle_t xTask); uint32_t ulTaskNotifyValueClear(TaskHandle_t xTask, uint32_t ulBitsToClear); //// // Semaphore API. #define semBINARY_SEMAPHORE_QUEUE_LENGTH ((uint8_t)1U) #define semSEMAPHORE_QUEUE_ITEM_LENGTH ((uint8_t)0U) #define semGIVE_BLOCK_TIME ((TickType_t)0U) SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount); SemaphoreHandle_t xSemaphoreCreateCountingStatic(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer); SemaphoreHandle_t xSemaphoreCreateBinary(void); SemaphoreHandle_t xSemaphoreCreateBinaryStatic(StaticSemaphore_t *pxSemaphoreBuffer); SemaphoreHandle_t xSemaphoreCreateMutex(void); SemaphoreHandle_t xSemaphoreCreateMutexStatic(StaticSemaphore_t *pxMutexBuffer); SemaphoreHandle_t xSemaphoreCreateRecursiveMutex(void); SemaphoreHandle_t xSemaphoreCreateRecursiveMutexStatic(StaticSemaphore_t *pxMutexBuffer); void vSemaphoreDelete(SemaphoreHandle_t xSemaphore); BaseType_t xSemaphoreTake(SemaphoreHandle_t xSemaphore, TickType_t xTicksToWait); BaseType_t xSemaphoreTakeFromISR(SemaphoreHandle_t xSemaphore, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xSemaphoreTakeRecursive(SemaphoreHandle_t xMutex, TickType_t xTicksToWait); BaseType_t xSemaphoreGive(SemaphoreHandle_t xSemaphore); BaseType_t xSemaphoreGiveFromISR(SemaphoreHandle_t xSemaphore, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xSemaphoreGiveRecursive(SemaphoreHandle_t xMutex); UBaseType_t uxSemaphoreGetCount(SemaphoreHandle_t xSemaphore); TaskHandle_t xSemaphoreGetMutexHolder(SemaphoreHandle_t xMutex); TaskHandle_t xSemaphoreGetMutexHolderFromISR(SemaphoreHandle_t xMutex); //// // Queue API. QueueHandle_t xQueueCreate(UBaseType_t uxQueueLength, UBaseType_t uxItemSize); QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t *pucQueueStorageBuffer, StaticQueue_t *pxQueueBuffer ); void vQueueDelete(QueueHandle_t xQueue); BaseType_t xQueueSend(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait); BaseType_t xQueueSendFromISR(QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xQueueSendToBack(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait); BaseType_t xQueueSendToBackFromISR(QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xQueueSendToFront(QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait); BaseType_t xQueueSendToFrontFromISR(QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait); BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xQueuePeek(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait); BaseType_t xQueuePeekFromISR(QueueHandle_t xQueue, void *pvBuffer); UBaseType_t uxQueueMessagesWaiting(QueueHandle_t xQueue); UBaseType_t uxQueueMessagesWaitingFromISR(QueueHandle_t xQueue); UBaseType_t uxQueueSpacesAvailable(QueueHandle_t xQueue); BaseType_t xQueueIsQueueEmptyFromISR(const QueueHandle_t xQueue); BaseType_t xQueueIsQueueFullFromISR(const QueueHandle_t xQueue); BaseType_t xQueueReset(QueueHandle_t xQueue); BaseType_t xQueueOverwrite(QueueHandle_t xQueue, const void * pvItemToQueue); BaseType_t xQueueOverwriteFromISR(QueueHandle_t xQueue, const void * pvItemToQueue, BaseType_t *pxHigherPriorityTaskWoken); //// // Event group API. EventGroupHandle_t xEventGroupCreate(void); EventGroupHandle_t xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffer); void vEventGroupDelete(EventGroupHandle_t xEventGroup); EventBits_t xEventGroupWaitBits(const EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait); EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet); BaseType_t xEventGroupSetBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken); EventBits_t xEventGroupClearBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear); BaseType_t xEventGroupClearBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear); EventBits_t xEventGroupGetBits(EventGroupHandle_t xEventGroup); EventBits_t xEventGroupGetBitsFromISR(EventGroupHandle_t xEventGroup); //// // Software timer API. #ifndef pdMS_TO_TICKS #ifndef configTICK_RATE_HZ #error "configTICK_RATE_HZ must be defined in FreeRTOSConfig.h" #endif // #ifndef configTICK_RATE_HZ #define pdMS_TO_TICKS(xTimeInMs) ((TickType_t) (((TickType_t) (xTimeInMs) * (TickType_t)configTICK_RATE_HZ) / (TickType_t)1000)) /* ... */#endif // #ifndef pdMS_TO_TICKS TimerHandle_t xTimerCreate(const char * const pcTimerName, const TickType_t xTimerPeriod, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction); TimerHandle_t xTimerCreateStatic(const char * const pcTimerName, const TickType_t xTimerPeriod, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer); BaseType_t xTimerDelete(TimerHandle_t xTimer, TickType_t xBlockTime); BaseType_t xTimerIsTimerActive(TimerHandle_t xTimer); BaseType_t xTimerStart(TimerHandle_t xTimer, TickType_t xBlockTime); BaseType_t xTimerStop(TimerHandle_t xTimer, TickType_t xBlockTime); BaseType_t xTimerChangePeriod(TimerHandle_t xTimer, TickType_t xNewPeriod, TickType_t xBlockTime); BaseType_t xTimerReset(TimerHandle_t xTimer, TickType_t xBlockTime); BaseType_t xTimerStartFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xTimerStopFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xTimerChangePeriodFromISR(TimerHandle_t xTimer, TickType_t xNewPeriod, BaseType_t *pxHigherPriorityTaskWoken); BaseType_t xTimerResetFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken); void *pvTimerGetTimerID(TimerHandle_t xTimer); void vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID); void vTimerSetReloadMode(TimerHandle_t xTimer, const UBaseType_t uxAutoReload); const char * pcTimerGetName(TimerHandle_t xTimer); TickType_t xTimerGetPeriod(TimerHandle_t xTimer); TickType_t xTimerGetExpiryTime(TimerHandle_t xTimer); UBaseType_t uxTimerGetReloadMode(TimerHandle_t xTimer); //// // Queue set API. QueueSetHandle_t xQueueCreateSet(const UBaseType_t uxEventQueueLength); BaseType_t xQueueAddToSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet); BaseType_t xQueueRemoveFromSet(QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet); QueueSetMemberHandle_t xQueueSelectFromSet(QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait); QueueSetMemberHandle_t xQueueSelectFromSetFromISR(QueueSetHandle_t xQueueSet); /* ... */ ...#endif /* FREERTOS_H */