版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、The FreeRTOS Reference ManualThis reference manual is for FreeRTOS V9.0.0. Check http:/www.FreeRTOS.org regularly forupdates, FreeRTOS tutorial books, and additional online documentation.This text is being provided for free. In return we ask that you use the business contact email link on http:/www.
2、FreeRTOS.org/contact to provide feedback, comments and corrections.Thank you.The FreeRTOS Reference ManualAPI Functions and Configuration OptionsReal Time Engineers ltd.Reference Manual for FreeRTOS version 9.0.0 issue 2.All text, source code and diagrams are the exclusive property of Real Time Engi
3、neers Ltd.Distribution, use in presentations, or publication in any form is strictly prohibited without prior written authority from Real Time Engineers Ltd. Real Time Engineers Ltd. 2016. All rights reserved.FreeRTOS, FreeRTOS.org and the FreeRTOS logo are trademarks of Real TimeEngineers Ltd.http:
4、/www.FreeRTOS.orghttp:/www.FreeRTOS.org/plushttp:/www.FreeRTOS.org/labsContentsContents5List of Figures8List of Code Listings9List of Tables15List of Notation15Chapter 1About This Manual161.1Scope17Chapter 2Task and Scheduler API2.32.42.
5、2.82.9portSWITCH_TO_USER_MODE()21vTaskAllocateMPURegions()22xTaskAbortDelay()25xTaskCallApplicationTaskHook()27xTaskCheckForTimeOut()30xTaskCreate()32xTaskCreateStatic()37xTaskCreateRestricted()41vTaskDelay()46vTaskDelayUntil()48vTaskDelete()51taskDISABLE_INTERRUPTS()53taskENABLE_
6、INTERRUPTS()55taskENTER_CRITICAL()56taskENTER_CRITICAL_FROM_ISR()59taskEXIT_CRITICAL()61taskEXIT_CRITICAL_FROM_ISR()63xTaskGetApplicationTaskTag()65xTaskGetCurrentTaskHandle()67xTaskGetIdleTaskHandle()68xTaskGetHandle()69uxTaskGetNumberOfTasks()71vTaskGetRunTimeStats()72xTaskGetSchedulerState()76uxT
7、askGetStackHighWaterMark()77eTaskGetState()79uxTaskGetSystemState()81vTaskGetTaskInfo()85pvTaskGetThreadLocalStoragePointer()87v42.252.262.272.282.292.302.312.322.332.342.35pcTaskGetName()89xTaskGetTickCount()90xTaskGetTickCountFromISR()92vT
8、askList()94xTaskNotify()97xTaskNotifyAndQuery()100xTaskNotifyAndQueryFromISR()104xTaskNotifyFromISR()108xTaskNotifyGive()113vTaskNotifyGiveFromISR()116xTaskNotifyStateClear()119ulTaskNotifyTake()121xTaskNotifyWait()124uxTaskPriorityGet()127vTaskPrioritySet()129vTaskResume()131xTaskResumeAll()133xTas
9、kResumeFromISR()136vTaskSetApplicationTaskTag()139vTaskSetThreadLocalStoragePointer()141vTaskSetTimeOutState()143vTaskStartScheduler()145vTaskStepTick()147vTaskSuspend()149vTaskSuspendAll()151taskYIELD()153Chapter 3Queue API1553.16vQueueAddToRegistr
10、y()156xQueueAddToSet()158xQueueCreate()160xQueueCreateSet()162xQueueCreateStatic()166vQueueDelete()168pcQueueGetName()170xQueueIsQueueEmptyFromISR()171xQueueIsQueueFullFromISR()172uxQueueMessagesWaiting()173uxQueueMessagesWaitingFromISR()174xQueueOverwrite()176xQueueOverwriteFromISR()178xQueuePeek()
11、180xQueuePeekFromISR()183xQueueReceive()184vi23.23xQueueReceiveFromISR()187xQueueRemoveFromSet()190xQueueReset()192xQueueSelectFromSet()193xQueueSelectFromSetFromISR()195xQueueSend(), xQueueSendToFront(), xQueueSendToBack()197xQueueSendFromISR(),xQueueSendToBackFromISR(),xQueu
12、eSendToFrontFromISR()200uxQueueSpacesAvailable()2043.24Chapter 4Semaphore API208vSemaphoreCreateBinary()207xSemaphoreCreateBinary()210xSemaphoreCreateBinaryStatic()213xSemaphoreCreateCounting()216xSemaphoreCreateCountingStatic()219xSemap
13、horeCreateMutex()222xSemaphoreCreateMutexStatic()224xSemaphoreCreateRecursiveMutex()226xSemaphoreCreateRecursiveMutexStatic()229vSemaphoreDelete()231uxSemaphoreGetCount()232xSemaphoreGetMutexHolder()233xSemaphoreGive()234xSemaphoreGiveFromISR()236xSemaphoreGiveRecursive()239xSemaphoreTake()242xSemap
14、horeTakeFromISR()245xSemaphoreTakeRecursive()247Chapter 5Software Timer API255.7xTimerChangePeriod()252xTimerChangePeriodFromISR()255xTimerCreate()257xTimerCreateStatic()261xTimerDelete()265xTimerGetExpiryTime()267pcTimerGetName()269xTimerGetPeriod()270xTimerGetT
15、imerDaemonTaskHandle()271pvTimerGetTimerID()272xTimerIsTimerActive()274xTimerPendFunctionCall()276xTimerPendFunctionCallFromISR()278vii035.14xTimerReset()281xTimerResetFromISR()284vTimerSetTimerID()286xTimerStart()288xTimerStartFromISR()290xTimerStop()292xTimerStopFromISR()294Cha
16、pter 6Event Groups API296.16.2xEventGroupClearBits()297xEventGroupClearBitsFromISR()299xEventGroupCreate()302xEventGroupCreateStatic()304vEventGroupDelete()306xEventGroupGetBits()307xEventGroupGetBitsFromISR()308xEventGroupSetBits()309xEventGroupSetBitsFromISR()311xEventG
17、roupSync()314xEventGroupWaitBits()318Chapter 7Kernel Configuration3FreeRTOSConfig.h322Constants that Start “INCLUDE_”323Constants that Start “config”327APPENDIX 1:Data Types and Coding Style Guide347INDEX350List of FiguresFigure 1 An example of the table produced by calling vTaskGetRunTim
18、eStats()72Figure 2 An example of the table produced by calling vTaskList()94Figure 3 Time line showing the execution of 4 tasks, all of which run at the idle priority332Figure 4 An example interrupt priority configuration335viiiList of Code ListingsListing 1 portSWITCH_TO_USER_MODE() macro prototype
19、21Listing 2 vTaskAllocateMPURegions() function prototype22Listing 3 The data structures used by xTaskCreateRestricted()23Listing 4 Example use of vTaskAllocateMPURegions()24Listing 5 xTaskAbortDelay() function prototype25Listing 6 Example use of xTaskAbortDelay()26Listing 7 xTaskCallApplicationTaskH
20、ook() function prototype27Listing 8 The prototype to which all task hook functions must conform27Listing 9 Example use of xTaskCallApplicationTaskHook()29Listing 10 xTaskCheckForTimeOut() function prototype30Listing 11 Example use of vTaskSetTimeOutState() and xTaskCheckForTimeOut()31Listing 12 xTas
21、kCreate() function prototype32Listing 13 Example use of xTaskCreate()36Listing 14 xTaskCreateStatic() function prototype37Listing 15 Example use of xTaskCreateStatic()40Listing 16 xTaskCreateRestricted() function prototype41Listing 17 The data structures used by xTaskCreateRestricted()42Listing 18 S
22、tatically declaring a correctly aligned stack for use by a restricted task43Listing 19 Example use of xTaskCreateRestricted()45Listing 20 vTaskDelay() function prototype46Listing 21 Example use of vTaskDelay()47Listing 22 vTaskDelayUntil() function prototype48Listing 23 Example use of vTaskDelayUnti
23、l()50Listing 24 vTaskDelete() function prototype51Listing 25 Example use of the vTaskDelete()52Listing 26 taskDISABLE_INTERRUPTS() macro prototype53Listing 27 taskENABLE_INTERRUPTS() macro prototype55Listing 28 taskENTER_CRITICAL macro prototype56Listing 29 Example use of taskENTER_CRITICAL() and ta
24、skEXIT_CRITICAL()58Listing 30 taskENTER_CRITICAL_FROM_ISR() macro prototype59Listing 31 Example use of taskENTER_CRITICAL_FROM_ISR() and taskEXIT_CRITICAL_FROM_ISR()60Listing 32 taskEXIT_CRITICAL() macro prototype61Listing 33 taskEXIT_CRITICAL_FROM_ISR() macro prototype63Listing 34 xTaskGetApplicati
25、onTaskTag() function prototype65Listing 35 Example use of xTaskGetApplicationTaskTag()66Listing 36 xTaskGetCurrentTaskHandle() function prototype67Listing 37 xTaskGetIdleTaskHandle() function prototype68Listing 38 xTaskGetHandle() function prototype69Listing 39 Example use of xTaskGetHandle()70ixLis
26、ting 40 uxTaskGetNumberOfTasks() function prototype71Listing 41 vTaskGetRunTimeStats() function prototype72Listing 42 Example macro definitions, taken from the LM3Sxxx Eclipse Demo74Listing 43 Example macro definitions, taken from the LPC17xx Eclipse Demo75Listing 44 Example use of vTaskGetRunTimeSt
27、ats()75Listing 45 xTaskGetSchedulerState() function prototype76Listing 46 Example use of uxTaskGetStackHighWaterMark()78Listing 47 eTaskGetState() function prototype79Listing 48 uxTaskGetSystemState() function prototype81Listing 49 Example use of uxTaskGetSystemState()83Listing 50 The TaskStatus_t d
28、efinition84Listing 51 vTaskGetTaskInfo() function prototype85Listing 52 Example use of vTaskGetTaskInfo()86Listing 53 pvTaskGetThreadLocalStoragePointer() function prototype87Listing 54 Example use of pvTaskGetThreadLocalStoragePointer()88Listing 55 pcTaskGetName() function prototype89Listing 56 xTa
29、skGetTickCount() function prototype90Listing 57 Example use of xTaskGetTickCount()91Listing 58 xTaskGetTickCountFromISR() function prototype92Listing 59 Example use of xTaskGetTickCountFromISR()93Listing 60 vTaskList() function prototype94Listing 61 Example use of vTaskList()96Listing 62 xTaskNotify
30、() function prototype97Listing 63 Example use of xTaskNotify()99Listing 64 xTaskNotifyAndQuery() function prototype100Listing 65 Example use of xTaskNotifyAndQuery()103Listing 66 xTaskNotifyAndQueryFromISR() function prototype104Listing 67 Example use of xTaskNotifyAndQueryFromISR()107Listing 68 xTa
31、skNotifyFromISR() function prototype108Listing 69 Example use of xTaskNotifyFromISR()112Listing 70 xTaskNotifyGive() function prototype113Listing 71 Example use of xTaskNotifyGive()115Listing 72 vTaskNotifyGiveFromISR() function prototype116Listing 73 Example use of vTaskNotifyGiveFromISR()118Listin
32、g 74 xTaskNotifyStateClear() function prototype119Listing 75 Example use of xTaskNotifyStateClear()120Listing 76 ulTaskNotifyTake() function prototype121Listing 77 Example use of ulTaskNotifyTake()123Listing 78 xTaskNotifyWait() function prototype124Listing 79 Example use of xTaskNotifyWait()126List
33、ing 80 uxTaskPriorityGet() function prototype127Listing 81 Example use of uxTaskPriorityGet()128Listing 82 vTaskPrioritySet() function prototype129xListing 83 Example use of vTaskPrioritySet()130Listing 84 vTaskResume() function prototype131Listing 85 Example use of vTaskResume()132Listing 86 xTaskR
34、esumeAll() function prototype133Listing 87 Example use of xTaskResumeAll()135Listing 88 xTaskResumeFromISR() function prototype136Listing 89 Example use of xTaskResumeFromISR()138Listing 90 vTaskSetApplicationTaskTag() function prototype139Listing 91 Example use of vTaskSetApplicationTaskTag()140Lis
35、ting 92 vTaskSetThreadLocalStoragePointer() function prototype141Listing 93 Example use of vTaskSetThreadLocalStoragePointer()142Listing 94 vTaskSetTimeOutState() function prototype143Listing 95 Example use of vTaskSetTimeOutState() and xTaskCheckForTimeOut()144Listing 96 vTaskStartScheduler() funct
36、ion prototype145Listing 97 Example use of vTaskStartScheduler()146Listing 98 Example use of vTaskStepTick()148Listing 99 vTaskSuspend() function prototype149Listing 100 Example use of vTaskSuspend()150Listing 101 vTaskSuspendAll() function prototype151Listing 102 Example use of vTaskSuspendAll()152L
37、isting 103 taskYIELD() macro prototype153Listing 104 Example use of taskYIELD()154Listing 105 vQueueAddToRegistry() function prototype156Listing 106 Example use of vQueueAddToRegistry()157Listing 107 xQueueAddToSet() function prototype158Listing 108 xQueueCreate() function prototype160Listing 109 Ex
38、ample use of xQueueCreate()161Listing 110 xQueueCreateSet() function prototype162Listing 111 Example use of xQueueCreateSet() and other queue set API functions165Listing 112 xQueueCreateStatic() function prototype166Listing 113 Example use of xQueueCreateStatic()167Listing 114 vQueueDelete() functio
39、n prototype168Listing 115 Example use of vQueueDelete()169Listing 116 pcQueueGetName() function prototype170Listing 117 xQueueIsQueueEmptyFromISR() function prototype171Listing 118 xQueueIsQueueFullFromISR() function prototype172Listing 119 uxQueueMessagesWaiting() function prototype173Listing 120 E
40、xample use of uxQueueMessagesWaiting()173Listing 121 uxQueueMessagesWaitingFromISR() function prototype174Listing 122 Example use of uxQueueMessagesWaitingFromISR()175Listing 123 xQueueOverwrite() function prototype176Listing 124 Example use of xQueueOverwrite()177Listing 125 xQueueOverwriteFromISR(
41、) function prototype178xiListing 126 Example use of xQueueOverwriteFromISR()179Listing 127 xQueuePeek() function prototype180Listing 128 Example use of xQueuePeek()182Listing 129 xQueuePeekFromISR() function prototype183Listing 130 xQueueReceive() function prototype184Listing 131 Example use of xQue
42、ueReceive()186Listing 132 xQueueReceiveFromISR() function prototype187Listing 133 Example use of xQueueReceiveFromISR()189Listing 134 xQueueRemoveFromSet() function prototype190Listing 135 Example use of xQueueRemoveFromSet()191Listing 136 xQueueReset() function prototype192Listing 137 xQueueSelectF
43、romSet() function prototype193Listing 138 xQueueSelectFromSetFromISR() function prototype195Listing 139 Example use of xQueueSelectFromSetFromISR()196Listing 140 xQueueSend(), xQueueSendToFront() and xQueueSendToBack() function prototypes197Listing 141 Example use of xQueueSendToBack()199Listing 142
44、 xQueueSendFromISR(), xQueueSendToBackFromISR() and xQueueSendToFrontFromISR() function prototypes200Listing 143 Example use of xQueueSendToBackFromISR()203Listing 144 uxQueueSpacesAvailable() function prototype204Listing 145 Example use of uxQueueSpacesAvailable()204Listing 146 vSemaphoreCreateBina
45、ry() macro prototype207Listing 147 Example use of vSemaphoreCreateBinary()209Listing 148 xSemaphoreCreateBinary() function prototype210Listing 149 Example use of xSemaphoreCreateBinary()212Listing 150 xSemaphoreCreateBinaryStatic() function prototype213Listing 151 Example use of xSemaphoreCreateBina
46、ryStatic()215Listing 152 xSemaphoreCreateCounting() function prototype216Listing 153 Example use of xSemaphoreCreateCounting()218Listing 154 xSemaphoreCreateCountingStatic() function prototype219Listing 155 Example use of xSemaphoreCreateCountingStatic()221Listing 156 xSemaphoreCreateMutex() functio
47、n prototype222Listing 157 Example use of xSemaphoreCreateMutex()223Listing 158 xSemaphoreCreateMutexStatic() function prototype224Listing 159 Example use of xSemaphoreCreateMutexStatic()225Listing 160 xSemaphoreCreateRecursiveMutex() function prototype226Listing 161 Example use of xSemaphoreCreateRe
48、cursiveMutex()228Listing 162 xSemaphoreCreateRecursiveMutexStatic() function prototype229Listing 163 Example use of xSemaphoreCreateRecursiveMutexStatic()230Listing 164 vSemaphoreDelete() function prototype231Listing 165 uxSemaphoreGetCount() function prototype232Listing 166 xSemaphoreGetMutexHolder
49、() function prototype233Listing 167 xSemaphoreGive() function prototype234xiiListing 168 Example use of xSemaphoreGive()235Listing 169 xSemaphoreGiveFromISR() function prototype236Listing 170 Example use of xSemaphoreGiveFromISR()238Listing 171 xSemaphoreGiveRecursive() function prototype239Listing
50、172 Example use of xSemaphoreGiveRecursive()241Listing 173 xSemaphoreTake() function prototype242Listing 174 Example use of xSemaphoreTake()244Listing 175 xSemaphoreTakeFromISR() function prototype245Listing 176 xSemaphoreTakeRecursive() function prototype247Listing 177 Example use of xSemaphoreTake
51、Recursive()249Listing 178 xTimerChangePeriod() function prototype252Listing 179 Example use of xTimerChangePeriod()254Listing 180 xTimerChangePeriodFromISR() function prototype255Listing 181 Example use of xTimerChangePeriodFromISR()256Listing 182 xTimerCreate() function prototype257Listing 183 The
52、timer callback function prototype258Listing 184 Definition of the callback function used in the calls to xTimerCreate() inListing 185259Listing 185 Example use of xTimerCreate()260Listing 186 xTimerCreateStatic() function prototype261Listing 187 The timer callback function prototype262Listing 188 De
53、finition of the callback function used in the calls to xTimerCreate() inListing 185263Listing 189 Example use of xTimerCreateStatic()264Listing 190 xTimerDelete() macro prototype265Listing 191 xTimerGetExpiryTime() function prototype267Listing 192 Example use of xTimerGetExpiryTime()268Listing 193 p
54、cTimerGetName() function prototype269Listing 194 xTimerGetPeriod() function prototype270Listing 195 Example use of xTimerGetPeriod()270Listing 196 xTimerGetTimerDaemonTaskHandle() function prototype271Listing 197 pvTimerGetTimerID() function prototype272Listing 198 Example use of pvTimerGetTimerID()
55、273Listing 199 xTimerIsTimerActive() function prototype274Listing 200 Example use of xTimerIsTimerActive()275Listing 201 xTimerPendFunctionCall() function prototype276Listing 202 The prototype of a function that can be pended using a call to xTimerPendFunctionCall()276Listing 203 xTimerPendFunctionCallFromISR() function prototype278Listing 204 The prototype of a function that can be pended us
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 黑龙江省鹤岗市向阳区2025届数学三年级下学期期中质量检测模拟试题(含解析)
- 2026年呼吸道多病原体协同监测工作实施方案范文
- 2026电子加工技术考试题及答案
- 2026电仪工考试题目及答案
- 2026电梯初级工考试题及答案
- 2026电商考试题型分布及答案
- 2026电气技术考试题及答案
- 2026电力招标考试题及答案解析
- 2026电力安全考试题及答案
- 2026年高处作业安全考试试题及答案
- 2026广西数字金服科技有限公司招聘6人笔试模拟试题及答案详解
- 2026年江苏省苏州市《保安员证》考试题库含答案(完整)
- 2025年MLED直显产业白皮书(节选)
- 公立医院行政管理岗招聘考试核心考点笔记:医疗质量安全核心制度
- 脚手架施工安全技术安全生产模板
- 2026年政府会计考试高频考点解析
- 人教版八年级数学上册轴对称《最短路径问题》 教学课件
- 220kV变电站电气设备常规交接试验方案
- 100以内两位数进位加法退位减法计算题-(直接打印版)
- (正式版)SH∕T 3541-2024 石油化工泵组施工及验收规范
- 混凝土泵车安全作业指导书
评论
0/150
提交评论