在好例子网,分享、交流、成长!
您当前所在位置:首页C/C++ 开发实例嵌入式开发 → 含有FreeRTOS的api函数说明和使用举例

含有FreeRTOS的api函数说明和使用举例

嵌入式开发

下载此实例
  • 开发语言:C/C++
  • 实例大小:2.37M
  • 下载次数:9
  • 浏览次数:62
  • 发布时间:2022-02-10
  • 实例类别:嵌入式开发
  • 发 布 人:salaba
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: FreeRTOS Manual RTOS ref for

实例介绍

【实例简介】含有FreeRTOS的api函数说明和使用举例

the FreeRTOS Reference Manual

【实例截图】

【核心代码】

Contents
Contents ................................................................................................................................... 5
List of Figures ........................................................................................................................... 9
List of Code Listings ............................................................................................................... 10
List of Tables .......................................................................................................................... 16
List of Notation ........................................................................................................................ 17
Chapter 1 About This Manual ............................................................................................... 18
1.1 Scope........................................................................................................................ 19
Chapter 2 Task and Scheduler API ...................................................................................... 22
2.1 portSWITCH_TO_USER_MODE() ............................................................................ 23
2.2 vTaskAllocateMPURegions() .................................................................................... 24
2.3 xTaskAbortDelay() .................................................................................................... 27
2.4 xTaskCallApplicationTaskHook() ............................................................................... 29
2.5 xTaskCheckForTimeOut() ......................................................................................... 32
2.6 xTaskCreate() ........................................................................................................... 34
2.7 xTaskCreateStatic() .................................................................................................. 39
2.8 xTaskCreateRestricted() ........................................................................................... 43
2.9 vTaskDelay() ............................................................................................................. 48
2.10 vTaskDelayUntil() ...................................................................................................... 50
2.11 vTaskDelete() ............................................................................................................ 53
2.12 taskDISABLE_INTERRUPTS() ................................................................................. 55
2.13 taskENABLE_INTERRUPTS() .................................................................................. 57
2.14 taskENTER_CRITICAL() ........................................................................................... 58
2.15 taskENTER_CRITICAL_FROM_ISR() ....................................................................... 61
2.16 taskEXIT_CRITICAL() ............................................................................................... 63
2.1 taskEXIT_CRITICAL_FROM_ISR() ........................................................................... 65
2.2 xTaskGetApplicationTaskTag() ................................................................................. 67
2.3 xTaskGetCurrentTaskHandle().................................................................................. 69
2.4 xTaskGetIdleTaskHandle() ........................................................................................ 70
2.1 xTaskGetHandle() ..................................................................................................... 71
2.2 uxTaskGetNumberOfTasks() .................................................................................... 73
2.3 vTaskGetRunTimeStats() .......................................................................................... 74
2.4 xTaskGetSchedulerState() ........................................................................................ 78
2.5 uxTaskGetStackHighWaterMark() ............................................................................. 79
2.6 eTaskGetState() ........................................................................................................ 81
2.7 uxTaskGetSystemState() .......................................................................................... 83
2.8 vTaskGetTaskInfo() ................................................................................................... 87
2.9 pvTaskGetThreadLocalStoragePointer() ................................................................... 89
vi
2.10 pcTaskGetName() ..................................................................................................... 91
2.11 xTaskGetTickCount() ................................................................................................ 92
2.12 xTaskGetTickCountFromISR() .................................................................................. 94
2.13 vTaskList() ................................................................................................................. 96
2.14 xTaskNotify() ............................................................................................................. 99
2.15 xTaskNotifyAndQuery() ........................................................................................... 102
2.16 xTaskNotifyAndQueryFromISR() ............................................................................. 106
2.17 xTaskNotifyFromISR() ............................................................................................. 110
2.18 xTaskNotifyGive() .................................................................................................... 115
2.19 vTaskNotifyGiveFromISR() ...................................................................................... 118
2.20 xTaskNotifyStateClear() .......................................................................................... 121
2.21 ulTaskNotifyTake() .................................................................................................. 123
2.22 xTaskNotifyWait() .................................................................................................... 126
2.23 uxTaskPriorityGet() ................................................................................................. 129
2.24 vTaskPrioritySet() .................................................................................................... 131
2.25 vTaskResume() ....................................................................................................... 133
2.26 xTaskResumeAll() ................................................................................................... 135
2.27 xTaskResumeFromISR() ......................................................................................... 138
2.28 vTaskSetApplicationTaskTag() ................................................................................ 141
2.29 vTaskSetThreadLocalStoragePointer() .................................................................... 143
2.30 vTaskSetTimeOutState() ......................................................................................... 145
2.31 vTaskStartScheduler() ............................................................................................. 147
2.32 vTaskStepTick() ...................................................................................................... 149
2.33 vTaskSuspend() ...................................................................................................... 151
2.34 vTaskSuspendAll() .................................................................................................. 153
2.35 taskYIELD() ............................................................................................................. 155
Chapter 3 Queue API ......................................................................................................... 157
3.1 vQueueAddToRegistry() .......................................................................................... 158
3.2 xQueueAddToSet() ................................................................................................. 160
3.3 xQueueCreate()....................................................................................................... 162
3.4 xQueueCreateSet() ................................................................................................. 164
3.5 xQueueCreateStatic() .............................................................................................. 168
3.6 vQueueDelete() ....................................................................................................... 170
3.7 pcQueueGetName() ................................................................................................ 172
3.8 xQueueIsQueueEmptyFromISR() ............................................................................ 173
3.9 xQueueIsQueueFullFromISR() ................................................................................ 174
3.10 uxQueueMessagesWaiting() ................................................................................... 175
3.11 uxQueueMessagesWaitingFromISR() ..................................................................... 176
3.12 xQueueOverwrite() .................................................................................................. 178
3.13 xQueueOverwriteFromISR() .................................................................................... 180
3.14 xQueuePeek() ......................................................................................................... 182
3.15 xQueuePeekFromISR() ........................................................................................... 185
3.16 xQueueReceive() .................................................................................................... 186
vii
3.17 xQueueReceiveFromISR() ...................................................................................... 189
3.18 xQueueRemoveFromSet() ...................................................................................... 192
3.19 xQueueReset() ........................................................................................................ 194
3.20 xQueueSelectFromSet().......................................................................................... 195
3.21 xQueueSelectFromSetFromISR() ........................................................................... 197
3.22 xQueueSend(), xQueueSendToFront(), xQueueSendToBack()............................... 199
3.23 xQueueSendFromISR(), xQueueSendToBackFromISR(),
xQueueSendToFrontFromISR() .............................................................................. 202
3.24 uxQueueSpacesAvailable() ..................................................................................... 206
Chapter 4 Semaphore API ................................................................................................. 208
4.1 vSemaphoreCreateBinary() ..................................................................................... 209
4.2 xSemaphoreCreateBinary() ..................................................................................... 212
4.3 xSemaphoreCreateBinaryStatic() ............................................................................ 215
4.4 xSemaphoreCreateCounting() ................................................................................ 218
4.5 xSemaphoreCreateCountingStatic() ........................................................................ 221
4.6 xSemaphoreCreateMutex() ..................................................................................... 224
4.7 xSemaphoreCreateMutexStatic() ............................................................................ 226
4.8 xSemaphoreCreateRecursiveMutex() ..................................................................... 228
4.9 xSemaphoreCreateRecursiveMutexStatic() ............................................................ 231
4.10 vSemaphoreDelete() ............................................................................................... 233
4.11 uxSemaphoreGetCount() ........................................................................................ 234
4.12 xSemaphoreGetMutexHolder()................................................................................ 235
4.13 xSemaphoreGive() .................................................................................................. 236
4.14 xSemaphoreGiveFromISR() .................................................................................... 238
4.15 xSemaphoreGiveRecursive() .................................................................................. 241
4.16 xSemaphoreTake() ................................................................................................. 244
4.17 xSemaphoreTakeFromISR() ................................................................................... 247
4.18 xSemaphoreTakeRecursive() .................................................................................. 249
Chapter 5 Software Timer API ........................................................................................... 253
5.1 xTimerChangePeriod() ............................................................................................ 254
5.2 xTimerChangePeriodFromISR() .............................................................................. 257
5.3 xTimerCreate() ........................................................................................................ 259
5.4 xTimerCreateStatic() ............................................................................................... 263
5.5 xTimerDelete() ........................................................................................................ 267
5.1 xTimerGetExpiryTime() ........................................................................................... 269
5.1 pcTimerGetName() ................................................................................................. 271
5.2 xTimerGetPeriod()................................................................................................... 272
5.3 xTimerGetTimerDaemonTaskHandle() .................................................................... 273
5.4 pvTimerGetTimerID() .............................................................................................. 274
5.5 xTimerIsTimerActive() ............................................................................................. 276
5.6 xTimerPendFunctionCall() ....................................................................................... 278
5.7 xTimerPendFunctionCallFromISR() ........................................................................ 280
viii
5.8 xTimerReset() ......................................................................................................... 283
5.9 xTimerResetFromISR() ........................................................................................... 286
5.10 vTimerSetTimerID() ................................................................................................. 288
5.11 xTimerStart() ........................................................................................................... 290
5.12 xTimerStartFromISR() ............................................................................................. 292
5.13 xTimerStop() ........................................................................................................... 294
5.14 xTimerStopFromISR() ............................................................................................. 296
Chapter 6 Event Groups API .............................................................................................. 298
6.1 xEventGroupClearBits() ........................................................................................... 299
6.2 xEventGroupClearBitsFromISR() ............................................................................ 301
6.3 xEventGroupCreate() .............................................................................................. 304
6.4 xEventGroupCreateStatic() ..................................................................................... 306
6.1 vEventGroupDelete() ............................................................................................... 308
6.2 xEventGroupGetBits() ............................................................................................. 309
6.1 xEventGroupGetBitsFromISR() ............................................................................... 310
6.2 xEventGroupSetBits() .............................................................................................. 311
6.3 xEventGroupSetBitsFromISR() ................................................................................ 313
6.1 xEventGroupSync() ................................................................................................. 316
6.2 xEventGroupWaitBits() ............................................................................................ 320
Chapter 7 Kernel Configuration .......................................................................................... 323
7.1 FreeRTOSConfig.h .................................................................................................. 324
7.2 Constants that Start “INCLUDE_” ............................................................................ 325
7.3 Constants that Start “config” .................................................................................... 329
Chapter 8 Stream Buffer API .............................................................................................. 348
8.1 xStreamBufferBytesAvailable() ................................................................................ 349
8.2 xStreamBufferCreate() ............................................................................................ 350
8.3 xStreamBufferCreateStatic() ................................................................................... 352
8.4 vStreamBufferDelete() ............................................................................................. 354
8.5 xStreamBufferIsEmpty() .......................................................................................... 355
8.6 xStreamBufferIsFull() .............................................................................................. 356
8.7 xStreamBufferReceive() .......................................................................................... 357
8.8 xStreamBufferReceiveFromISR() ............................................................................ 360
8.9 xStreamBufferReset() .............................................................................................. 363
8.10 xStreamBufferSend() ............................................................................................... 364
8.11 xStreamBufferSendFromISR() ................................................................................. 367
8.12 xStreamBufferSetTriggerLevel() .............................................................................. 370
8.13 xStreamBufferSpacesAvailable() ............................................................................. 371
Chapter 9 Message Buffer API ........................................................................................... 372
9.1 xMessageBufferCreate() ......................................................................................... 373
9.2 xMessageBufferCreateStatic() ................................................................................. 375
9.3 vMessageBufferDelete() .......................................................................................... 377
ix
9.4 xMessageBufferIsEmpty() ....................................................................................... 378
9.5 xMessageBufferIsFull() ........................................................................................... 379
9.6 xMessageBufferReceive() ....................................................................................... 380
9.7 xMessageBufferReceiveFromISR() ......................................................................... 383
9.8 xMessageBufferReset() .......................................................................................... 386
9.9 xMessageBufferSend() ........................................................................................... 387
9.10 xMessageBufferSendFromISR() ............................................................................. 390
9.11 xMessageBufferSpacesAvailable() .......................................................................... 393
APPENDIX 1: Data Types and Coding Style Guide .......................................................... 394
INDEX .................................................................................................................................. 397
List of Figures
Figure 1 An example of the table produced by calling vTaskGetRunTimeStats() .................... 74
Figure 2 An example of the table produced by calling vTaskList() ........................................... 96
Figure 3 Time line showing the execution of 4 tasks, all of which run at the idle priority ........ 334
Figure 4 An example interrupt priority configuration .............................................................. 337
x
List of Code Listings
Listing 1 portSWITCH_TO_USER_MODE() macro prototype ................................................. 23
Listing 2 vTaskAllocateMPURegions() function prototype ....................................................... 24
Listing 3 The data structures used by xTaskCreateRestricted() .............................................. 25
Listing 4 Example use of vTaskAllocateMPURegions() ........................................................... 26
Listing 5 xTaskAbortDelay() function prototype ....................................................................... 27
Listing 6 Example use of xTaskAbortDelay() ........................................................................... 28
Listing 7 xTaskCallApplicationTaskHook() function prototype ................................................. 29
Listing 8 The prototype to which all task hook functions must conform .................................... 29
Listing 9 Example use of xTaskCallApplicationTaskHook() ..................................................... 31
Listing 10 xTaskCheckForTimeOut() function prototype .......................................................... 32
Listing 11 Example use of vTaskSetTimeOutState() and xTaskCheckForTimeOut() ............... 33
Listing 12 xTaskCreate() function prototype ............................................................................ 34
Listing 13 Example use of xTaskCreate() ................................................................................ 38
Listing 14 xTaskCreateStatic() function prototype ................................................................... 39
Listing 15 Example use of xTaskCreateStatic() ....................................................................... 42
Listing 16 xTaskCreateRestricted() function prototype ............................................................ 43
Listing 17 The data structures used by xTaskCreateRestricted() ............................................ 44
Listing 18 Statically declaring a correctly aligned stack for use by a restricted task ................. 45
Listing 19 Example use of xTaskCreateRestricted() ................................................................ 47
Listing 20 vTaskDelay() function prototype .............................................................................. 48
Listing 21 Example use of vTaskDelay() ................................................................................. 49
Listing 22 vTaskDelayUntil() function prototype....................................................................... 50
Listing 23 Example use of vTaskDelayUntil() .......................................................................... 52
Listing 24 vTaskDelete() function prototype ............................................................................ 53
Listing 25 Example use of the vTaskDelete() .......................................................................... 54
Listing 26 taskDISABLE_INTERRUPTS() macro prototype ..................................................... 55
Listing 27 taskENABLE_INTERRUPTS() macro prototype ...................................................... 57
Listing 28 taskENTER_CRITICAL macro prototype ................................................................ 58
Listing 29 Example use of taskENTER_CRITICAL() and taskEXIT_CRITICAL() ..................... 60
Listing 30 taskENTER_CRITICAL_FROM_ISR() macro prototype .......................................... 61
Listing 31 Example use of taskENTER_CRITICAL_FROM_ISR() and
taskEXIT_CRITICAL_FROM_ISR() .................................................................. 62
Listing 32 taskEXIT_CRITICAL() macro prototype .................................................................. 63
Listing 33 taskEXIT_CRITICAL_FROM_ISR() macro prototype .............................................. 65
Listing 34 xTaskGetApplicationTaskTag() function prototype .................................................. 67
Listing 35 Example use of xTaskGetApplicationTaskTag() ...................................................... 68
Listing 36 xTaskGetCurrentTaskHandle() function prototype .................................................. 69
Listing 37 xTaskGetIdleTaskHandle() function prototype ........................................................ 70
Listing 38 xTaskGetHandle() function prototype ...................................................................... 71
Listing 39 Example use of xTaskGetHandle() ......................................................................... 72
xi
Listing 40 uxTaskGetNumberOfTasks() function prototype ..................................................... 73
Listing 41 vTaskGetRunTimeStats() function prototype .......................................................... 74
Listing 42 Example macro definitions, taken from the LM3Sxxx Eclipse Demo ....................... 76
Listing 43 Example macro definitions, taken from the LPC17xx Eclipse Demo ....................... 77
Listing 44 Example use of vTaskGetRunTimeStats() .............................................................. 77
Listing 45 xTaskGetSchedulerState() function prototype ......................................................... 78
Listing 46 Example use of uxTaskGetStackHighWaterMark() ................................................. 80
Listing 47 eTaskGetState() function prototype ........................................................................ 81
Listing 48 uxTaskGetSystemState() function prototype ........................................................... 83
Listing 49 Example use of uxTaskGetSystemState() .............................................................. 85
Listing 50 The TaskStatus_t definition .................................................................................... 86
Listing 51 vTaskGetTaskInfo() function prototype ................................................................... 87
Listing 52 Example use of vTaskGetTaskInfo() ....................................................................... 88
Listing 53 pvTaskGetThreadLocalStoragePointer() function prototype .................................... 89
Listing 54 Example use of pvTaskGetThreadLocalStoragePointer() ....................................... 90
Listing 55 pcTaskGetName() function prototype ..................................................................... 91
Listing 56 xTaskGetTickCount() function prototype ................................................................. 92
Listing 57 Example use of xTaskGetTickCount()..................................................................... 93
Listing 58 xTaskGetTickCountFromISR() function prototype ................................................... 94
Listing 59 Example use of xTaskGetTickCountFromISR() ...................................................... 95
Listing 60 vTaskList() function prototype ................................................................................. 96
Listing 61 Example use of vTaskList() ..................................................................................... 98
Listing 62 xTaskNotify() function prototype ............................................................................. 99
Listing 63 Example use of xTaskNotify() ............................................................................... 101
Listing 64 xTaskNotifyAndQuery() function prototype ........................................................... 102
Listing 65 Example use of xTaskNotifyAndQuery() ............................................................... 105
Listing 66 xTaskNotifyAndQueryFromISR() function prototype ............................................. 106
Listing 67 Example use of xTaskNotifyAndQueryFromISR() ................................................. 109
Listing 68 xTaskNotifyFromISR() function prototype ............................................................. 110
Listing 69 Example use of xTaskNotifyFromISR() ................................................................. 114
Listing 70 xTaskNotifyGive() function prototype .................................................................... 115
Listing 71 Example use of xTaskNotifyGive() ........................................................................ 117
Listing 72 vTaskNotifyGiveFromISR() function prototype ...................................................... 118
Listing 73 Example use of vTaskNotifyGiveFromISR() .......................................................... 120
Listing 74 xTaskNotifyStateClear() function prototype ........................................................... 121
Listing 75 Example use of xTaskNotifyStateClear() .............................................................. 122
Listing 76 ulTaskNotifyTake() function prototype................................................................... 123
Listing 77 Example use of ulTaskNotifyTake() ...................................................................... 125
Listing 78 xTaskNotifyWait() function prototype .................................................................... 126
Listing 79 Example use of xTaskNotifyWait() ........................................................................ 128
Listing 80 uxTaskPriorityGet() function prototype .................................................................. 129
Listing 81 Example use of uxTaskPriorityGet() ..................................................................... 130
Listing 82 vTaskPrioritySet() function prototype .................................................................... 131
xii
Listing 83 Example use of vTaskPrioritySet() ........................................................................ 132
Listing 84 vTaskResume() function prototype ....................................................................... 133
Listing 85 Example use of vTaskResume() ........................................................................... 134
Listing 86 xTaskResumeAll() function prototype .................................................................... 135
Listing 87 Example use of xTaskResumeAll() ....................................................................... 137
Listing 88 xTaskResumeFromISR() function prototype ......................................................... 138
Listing 89 Example use of xTaskResumeFromISR() ............................................................. 140
Listing 90 vTaskSetApplicationTaskTag() function prototype ................................................ 141
Listing 91 Example use of vTaskSetApplicationTaskTag() .................................................... 142
Listing 92 vTaskSetThreadLocalStoragePointer() function prototype .................................... 143
Listing 93 Example use of vTaskSetThreadLocalStoragePointer() ........................................ 144
Listing 94 vTaskSetTimeOutState() function prototype .......................................................... 145
Listing 95 Example use of vTaskSetTimeOutState() and xTaskCheckForTimeOut() ............. 146
Listing 96 vTaskStartScheduler() function prototype ............................................................. 147
Listing 97 Example use of vTaskStartScheduler() ................................................................. 148
Listing 98 Example use of vTaskStepTick() ........................................................................... 150
Listing 99 vTaskSuspend() function prototype ....................................................................... 151
Listing 100 Example use of vTaskSuspend() ........................................................................ 152
Listing 101 vTaskSuspendAll() function prototype ................................................................. 153
Listing 102 Example use of vTaskSuspendAll()..................................................................... 154
Listing 103 taskYIELD() macro prototype .............................................................................. 155
Listing 104 Example use of taskYIELD() ............................................................................... 156
Listing 105 vQueueAddToRegistry() function prototype ........................................................ 158
Listing 106 Example use of vQueueAddToRegistry() ............................................................ 159
Listing 107 xQueueAddToSet() function prototype ................................................................ 160
Listing 108 xQueueCreate() function prototype ..................................................................... 162
Listing 109 Example use of xQueueCreate() ......................................................................... 163
Listing 110 xQueueCreateSet() function prototype ................................................................ 164
Listing 111 Example use of xQueueCreateSet() and other queue set API functions ............. 167
Listing 112 xQueueCreateStatic() function prototype ............................................................ 168
Listing 113 Example use of xQueueCreateStatic() ................................................................ 169
Listing 114 vQueueDelete() function prototype...................................................................... 170
Listing 115 Example use of vQueueDelete() ......................................................................... 171
Listing 116 pcQueueGetName() function prototype ............................................................... 172
Listing 117 xQueueIsQueueEmptyFromISR() function prototype .......................................... 173
Listing 118 xQueueIsQueueFullFromISR() function prototype ............................................... 174
Listing 119 uxQueueMessagesWaiting() function prototype .................................................. 175
Listing 120 Example use of uxQueueMessagesWaiting() ...................................................... 175
Listing 121 uxQueueMessagesWaitingFromISR() function prototype .................................... 176
Listing 122 Example use of uxQueueMessagesWaitingFromISR()........................................ 177
Listing 123 xQueueOverwrite() function prototype ................................................................. 178
Listing 124 Example use of xQueueOverwrite() .................................................................... 179
Listing 125 xQueueOverwriteFromISR() function prototype................................................... 180
xiii
Listing 126 Example use of xQueueOverwriteFromISR() ...................................................... 181
Listing 127 xQueuePeek() function prototype ....................................................................... 182
Listing 128 Example use of xQueuePeek() ........................................................................... 184
Listing 129 xQueuePeekFromISR() function prototype ......................................................... 185
Listing 130 xQueueReceive() function prototype ................................................................... 186
Listing 131 Example use of xQueueReceive() ...................................................................... 188
Listing 132 xQueueReceiveFromISR() function prototype ..................................................... 189
Listing 133 Example use of xQueueReceiveFromISR() ........................................................ 191
Listing 134 xQueueRemoveFromSet() function prototype ..................................................... 192
Listing 135 Example use of xQueueRemoveFromSet() ........................................................ 193
Listing 136 xQueueReset() function prototype ...................................................................... 194
Listing 137 xQueueSelectFromSet() function prototype ........................................................ 195
Listing 138 xQueueSelectFromSetFromISR() function prototype .......................................... 197
Listing 139 Example use of xQueueSelectFromSetFromISR() .............................................. 198
Listing 140 xQueueSend(), xQueueSendToFront() and xQueueSendToBack() function
prototypes ...................................................................................................... 199
Listing 141 Example use of xQueueSendToBack() ............................................................... 201
Listing 142 xQueueSendFromISR(), xQueueSendToBackFromISR() and
xQueueSendToFrontFromISR() function prototypes ...................................... 202
Listing 143 Example use of xQueueSendToBackFromISR() ................................................. 205
Listing 144 uxQueueSpacesAvailable() function prototype ................................................... 206
Listing 145 Example use of uxQueueSpacesAvailable() ....................................................... 206
Listing 146 vSemaphoreCreateBinary() macro prototype ...................................................... 209
Listing 147 Example use of vSemaphoreCreateBinary() ....................................................... 211
Listing 148 xSemaphoreCreateBinary() function prototype ................................................... 212
Listing 149 Example use of xSemaphoreCreateBinary() ....................................................... 214
Listing 150 xSemaphoreCreateBinaryStatic() function prototype .......................................... 215
Listing 151 Example use of xSemaphoreCreateBinaryStatic() .............................................. 217
Listing 152 xSemaphoreCreateCounting() function prototype ............................................... 218
Listing 153 Example use of xSemaphoreCreateCounting() ................................................... 220
Listing 154 xSemaphoreCreateCountingStatic() function prototype ...................................... 221
Listing 155 Example use of xSemaphoreCreateCountingStatic() .......................................... 223
Listing 156 xSemaphoreCreateMutex() function prototype .................................................... 224
Listing 157 Example use of xSemaphoreCreateMutex() ....................................................... 225
Listing 158 xSemaphoreCreateMutexStatic() function prototype ........................................... 226
Listing 159 Example use of xSemaphoreCreateMutexStatic() .............................................. 227
Listing 160 xSemaphoreCreateRecursiveMutex() function prototype .................................... 228
Listing 161 Example use of xSemaphoreCreateRecursiveMutex() ........................................ 230
Listing 162 xSemaphoreCreateRecursiveMutexStatic() function prototype ........................... 231
Listing 163 Example use of xSemaphoreCreateRecursiveMutexStatic() ............................... 232
Listing 164 vSemaphoreDelete() function prototype .............................................................. 233
Listing 165 uxSemaphoreGetCount() function prototype ....................................................... 234
Listing 166 xSemaphoreGetMutexHolder() function prototype .............................................. 235
Listing 167 xSemaphoreGive() function prototype................................................................. 236
xiv
Listing 168 Example use of xSemaphoreGive()..................................................................... 237
Listing 169 xSemaphoreGiveFromISR() function prototype ................................................... 238
Listing 170 Example use of xSemaphoreGiveFromISR() ...................................................... 240
Listing 171 xSemaphoreGiveRecursive() function prototype ................................................. 241
Listing 172 Example use of xSemaphoreGiveRecursive() ..................................................... 243
Listing 173 xSemaphoreTake() function prototype ................................................................ 244
Listing 174 Example use of xSemaphoreTake() .................................................................... 246
Listing 175 xSemaphoreTakeFromISR() function prototype .................................................. 247
Listing 176 xSemaphoreTakeRecursive() function prototype................................................. 249
Listing 177 Example use of xSemaphoreTakeRecursive() .................................................... 251
Listing 178 xTimerChangePeriod() function prototype ........................................................... 254
Listing 179 Example use of xTimerChangePeriod() .............................................................. 256
Listing 180 xTimerChangePeriodFromISR() function prototype ............................................. 257
Listing 181 Example use of xTimerChangePeriodFromISR() ................................................ 258
Listing 182 xTimerCreate() function prototype ....................................................................... 259
Listing 183 The timer callback function prototype .................................................................. 260
Listing 184 Definition of the callback function used in the calls to xTimerCreate() in
Listing 185 ..................................................................................................... 261
Listing 185 Example use of xTimerCreate() .......................................................................... 262
Listing 186 xTimerCreateStatic() function prototype .............................................................. 263
Listing 187 The timer callback function prototype .................................................................. 264
Listing 188 Definition of the callback function used in the calls to xTimerCreate() in
Listing 185 ..................................................................................................... 265
Listing 189 Example use of xTimerCreateStatic() .................................................................. 266
Listing 190 xTimerDelete() macro prototype .......................................................................... 267
Listing 191 xTimerGetExpiryTime() function prototype .......................................................... 269
Listing 192 Example use of xTimerGetExpiryTime() .............................................................. 270
Listing 193 pcTimerGetName() function prototype ................................................................ 271
Listing 194 xTimerGetPeriod() function prototype ................................................................. 272
Listing 195 Example use of xTimerGetPeriod() ..................................................................... 272
Listing 196 xTimerGetTimerDaemonTaskHandle() function prototype .................................. 273
Listing 197 pvTimerGetTimerID() function prototype ............................................................. 274
Listing 198 Example use of pvTimerGetTimerID() ................................................................. 275
Listing 199 xTimerIsTimerActive() function prototype ............................................................ 276
Listing 200 Example use of xTimerIsTimerActive() ................................................................ 277
Listing 201 xTimerPendFunctionCall() function prototype ..................................................... 278
Listing 202 The prototype of a function that can be pended using a call to
xTimerPendFunctionCall() .............................................................................. 278
Listing 203 xTimerPendFunctionCallFromISR() function prototype ....................................... 280
Listing 204 The prototype of a function that can be pended using a call to
xTimerPendFunctionCallFromISR() ............................................................... 280
Listing 205 Example use of xTimerPendFunctionCallFromISR() ........................................... 282
Listing 206 xTimerReset() function prototype ........................................................................ 283
Listing 207 Example use of xTimerReset() ............................................................................ 285
xv
Listing 208 xTimerResetFromISR() function prototype .......................................................... 286
Listing 209 Example use of xTimerResetFromISR() ............................................................. 287
Listing 210 vTimerSetTimerID() function prototype ............................................................... 288
Listing 211 Example use of vTimerSetTimerID() ................................................................... 289
Listing 212 xTimerStart() function prototype .......................................................................... 290
Listing 213 xTimerStartFromISR() macro prototype .............................................................. 292
Listing 214 Example use of xTimerStartFromISR() ............................................................... 293
Listing 215 xTimerStop() function prototype .......................................................................... 294
Listing 216 xTimerStopFromISR() function prototype ............................................................ 296
Listing 217 Example use of xTimerStopFromISR() ............................................................... 297
Listing 218 xEventGroupClearBits() function prototype ......................................................... 299
Listing 219 Example use of xEventGroupClearBits() ............................................................. 300
Listing 220 xEventGroupClearBitsFromISR() function prototype ........................................... 301
Listing 221 Example use of xEventGroupClearBitsFromISR()............................................... 303
Listing 222 xEventGroupCreate() function prototype ............................................................. 304
Listing 223 Example use of xEventGroupCreate() ................................................................ 305
Listing 224 xEventGroupCreateStatic() function prototype .................................................... 306
Listing 225 Example use of xEventGroupCreateStatic()........................................................ 307
Listing 226 vEventGroupDelete() function prototype ............................................................. 308
Listing 227 xEventGroupGetBits() function prototype ............................................................ 309
Listing 228 xEventGroupGetBitsFromISR() function prototype.............................................. 310
Listing 229 xEventGroupSetBits() function prototype ............................................................ 311
Listing 230 Example use of xEventGroupSetBits() ................................................................ 312
Listing 231 xEventGroupSetBitsFromISR() function prototype .............................................. 313
Listing 232 Example use of xEventGroupSetBitsFromISR() .................................................. 315
Listing 233 xEventGroupSync() function prototype ............................................................... 316
Listing 234 Example use of xEventGroupSync() ................................................................... 319
Listing 235 xEventGroupWaitBits() function prototype .......................................................... 320
Listing 236 Example use of xEventGroupWaitBits() .............................................................. 322
Listing 237 Declaring an array that will be used as the FreeRTOS heap ............................... 329
Listing 238 An example configASSERT() definition ............................................................... 330
Listing 239 The stack overflow hook function prototype ........................................................ 330
Listing 240 An example of saving and restoring the processors privilege state ..................... 335
Listing 241 The daemon task startup hook function name and prototype. ............................. 342
Listing 242 The idle task hook function name and prototype. ................................................ 342
Listing 243 The malloc() failed hook function name and prototype. ....................................... 343
Listing 244 The tick hook function name and prototype......................................................... 346
Listing 245 size_t xStreamBufferBytesAvailable() function prototype .................................... 349
Listing 246 xStreamBufferCreate() function prototype ........................................................... 350
Listing 247 Example use of xStreamBufferCreate() .............................................................. 351
Listing 248 xStreamBufferCreateStatic() function prototype .................................................. 352
Listing 249 Example use of xStreamBufferCreateStatic() ...................................................... 353
Listing 250 vStreamBufferDelete() function prototype ........................................................... 354
xvi
Listing 251 xStreamBufferIsEmpty() function prototype ......................................................... 355
Listing 252 xStreamBufferIsFull() function prototype ............................................................. 356
Listing 253 xStreamBufferReceive() function prototype ......................................................... 357
Listing 254 Example use of xStreamBufferReceive() ............................................................ 359
Listing 255 xStreamBufferReceiveFromISR() function prototype ........................................... 360
Listing 256 Example use of xStreamBufferReceiveFromISR() .............................................. 362
Listing 257 xStreamBufferReset() function prototype ............................................................ 363
Listing 258 xStreamBufferSend() function prototype ............................................................. 364
Listing 259 Example use of xStreamBufferSend() ................................................................. 366
Listing 260 xStreamBufferSendFromISR() function prototype ............................................... 367
Listing 261 Example use of xStreamBufferSendFromISR() ................................................... 369
Listing 262 xStreamBufferSetTriggerLevel() function prototype ............................................. 370
Listing 263 xStreamBufferSpacesAvailable() function prototype ........................................... 371
Listing 266 xMessageBufferCreate() function prototype ........................................................ 373
Listing 267 Example use of xMessageBufferCreate() ............................................................ 374
Listing 268 xMessageBufferCreateStatic() function prototype ............................................... 375
Listing 269 Example use of xMessageBufferCreateStatic() ................................................... 376
Listing 270 vMessageBufferDelete() function prototype ........................................................ 377
Listing 271 xMessageBufferIsEmpty() function prototype ...................................................... 378
Listing 272 xMessageBufferIsFull() function prototype .......................................................... 379
Listing 273 xMessageBufferReceive() function prototype ...................................................... 380
Listing 274 Example use of xMessageBufferReceive() .......................................................... 382
Listing 275 xMessageBufferReceiveFromISR() function prototype ........................................ 383
Listing 276 Example use of xMessageBufferReceiveFromISR() ........................................... 385
Listing 277 xMessageBufferReset() function prototype ......................................................... 386
Listing 278 xMessageBufferSend() function prototype .......................................................... 387
Listing 279 Example use of xMessageBufferSend() .............................................................. 389
Listing 280 xMessageBufferSendFromISR() function prototype ............................................ 390
Listing 281 Example use of xMessageBufferSendFromISR() ................................................ 392
Listing 282 xMessageBufferSpacesAvailable () function prototype........................................ 393
List of Tables
Table 1. eTaskGetState() return values.................................................................................. 81
Table 2. Additional macros that are required if ...................................................................... 333
Table 3. Special data types used by FreeRTOS ................................................................... 394
Table 4. Macro prefixes ........................................................................................................ 396
Table 5. Common macro definitions ..................................................................................... 396


标签: FreeRTOS Manual RTOS ref for

实例下载地址

含有FreeRTOS的api函数说明和使用举例

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警