FreeRTOS编程参考手册深度解析

需积分: 33 23 下载量 44 浏览量 更新于2024-11-02 收藏 25.07MB RAR 举报
资源摘要信息:"FreeRTOS是一个流行的开源实时操作系统(RTOS),专为小型嵌入式系统设计,可以运行在有限的硬件资源上。该系统具备多任务管理、同步、内存管理等功能。FreeRTOS提供了一个小型、可裁剪的核心,开发者可以根据需要添加额外的组件来满足具体项目的需求。 FreeRTOS编程参考手册是该操作系统的官方文档,它详细介绍了FreeRTOS的API(应用程序编程接口)函数,这些函数是开发者用来编程和管理任务、队列、信号量、事件组、互斥量等系统组件的核心。手册涵盖了各种编程接口,包括: 1. 任务管理:创建、删除、挂起、恢复和管理任务。 2. 队列管理:创建、删除、发送、接收和管理队列。 3. 信号量管理:创建、获取和释放信号量。 4. 事件组管理:创建、设置、清除事件标志和等待多个事件标志。 5. 互斥量管理:创建、获取和释放互斥量,解决优先级反转问题。 6. 定时器管理:创建和管理软件定时器。 7. 内存管理:动态和静态内存分配函数。 8. 时钟和时间管理:获取系统时间,设置和管理软件定时器回调。 9. 中断管理:处理中断服务例程(ISR)中的FreeRTOS操作。 10. 系统功能:提供运行时系统统计信息、系统ID和版本查询等。 此手册不仅提供了函数的使用说明,还包括了FreeRTOS的系统架构和设计概念,例如调度策略、任务优先级、堆栈溢出保护等。此外,手册中还提供了许多示例代码和最佳实践,以帮助开发者更好地理解和使用FreeRTOS。 FreeRTOS Reference Manual V9.0.0版本的手册是一个重要的参考资料,因为FreeRTOS会定期更新其软件以修复漏洞、增加新特性和改进现有功能。因此,开发者应确保参考最新版本的手册,以便充分利用FreeRTOS提供的最新功能和性能改进。 通过使用FreeRTOS编程参考手册,开发者可以快速掌握FreeRTOS的编程方法,并高效地开发出响应快速、资源占用小的嵌入式系统。这本手册是FreeRTOS生态系统中不可或缺的工具,尤其适合那些希望深入了解实时操作系统内部工作原理的开发者。 需要注意的是,虽然FreeRTOS可以在商业项目中免费使用,但它必须遵循GNU通用公共许可证(GPLv2)的规定,这可能会对某些商业产品的许可造成影响。因此,开发者在选择使用FreeRTOS时,应仔细评估其开源许可条款。"
2018-11-18 上传
中文的参考手册 内容 Contents5..................................................................................................................................................... 列表 Figures8............................................................................................................................................... 代码清单 Listings9....................................................................................................................................... Tables15 名单.............................................................................................................................................. 列表 Notation15........................................................................................................................................... 章节 1 关于这............................................................................................................................. Manual16 1.1Scope17............................................................................................................................................. 章节 2Task 和调度........................................................................................................................... API20 2.1 portSWITCH_TO_USER_MODE() 21.................................................................................. 2.2 vTaskAllocateMPURegions() 22........................................................................................... 2.3 xTaskAbortDelay() 25............................................................................................................. 2.4 xTaskCallApplicationTaskHook() 27.................................................................................... 2.5 xTaskCheckForTimeOut() 30................................................................................................ 2.6 xTaskCreate() 32..................................................................................................................... 2.7 xTaskCreateStatic() 37........................................................................................................... 2.8 xTaskCreateRestricted() 41................................................................................................... 2.9 vTaskDelay() 46....................................................................................................................... 2.10 vTaskDelayUntil() 48............................................................................................................... 2.11 vTaskDelete() 51..................................................................................................................... 2.12 taskDISABLE_INTERRUPTS() 53........................................................................................ 2.13 taskENABLE_INTERRUPTS() 55......................................................................................... 2.14 taskENTER_CRITICAL() 56.................................................................................................. 2.15 taskENTER_CRITICAL_FROM_ISR() 59........................................................................... 2.16 taskEXIT_CRITICAL() 61....................................................................................................... 2.1 taskEXIT_CRITICAL_FROM_ISR() 63................................................................................ 2.2 xTaskGetApplicationTaskTag() 65....................................................................................... 2.3 xTaskGetCurrentTaskHandle() 67........................................................................................ 2.4 xTaskGetIdleTaskHandle() 68............................................................................................... 2.1 xTaskGetHandle() 69.............................................................................................................. 2.2 uxTaskGetNumberOfTasks() 71........................................................................................... 2.3 vTaskGetRunTimeStats() 72................................................................................................. 2.4 xTaskGetSchedulerState() 76...............................................................................................六 2.5 uxTaskGetStackHighWaterMark() 77.................................................................................. 2.6 eTaskGetState() 79................................................................................................................. 2.7 uxTaskGetSystemState() 81.................................................................................................. 2.8 vTaskGetTaskInfo() 85........................................................................................................... 2.9 pvTaskGetThreadLocalStoragePointer() 87.......................................................................7 2.10 pcTaskGetName() 89.............................................................................................................. 2.11 xTaskGetTickCount() 90........................................................................................................ 2.12 xTaskGetTickCountFromISR() 92........................................................................................ 2.13 vTaskList() 94........................................................................................................................... 2.14 xTaskNotify() 97....................................................................................................................... 2.15 xTaskNotifyAndQuery() 100.................................................................................................. 2.16 xTaskNotifyAndQueryFromISR() 104.................................................................................. 2.17 xTaskNotifyFromISR() 108.................................................................................................... 2.18 xTaskNotifyGive() 113............................................................................................................ 2.19 vTaskNotifyGiveFromISR() 116............................................................................................ 2.20 xTaskNotifyStateClear() 119.................................................................................................. 2.21 ulTask​ ​ NotifyTake() 121.................................................................................................. 2.22 xTaskNotifyWait() 124............................................................................................................ 2.23 uxTaskPriorityGet() 127.......................................................................................................... 2.24 vTaskPrioritySet() 129............................................................................................................ 2.25 vTaskResume() 131................................................................................................................ 2.26 xTaskResumeAll() 133........................................................................................................... 2.27 xTaskResumeFromISR() 136................................................................................................ 2.28 vTaskSetApplicationTaskTag() 139...................................................................................... 2.29 vTaskSetThreadLocalStoragePointer() 141........................................................................ 2.30 vTaskSetTimeOutState() 143................................................................................................ 2.31 vTaskStartScheduler() 145.................................................................................................... 2.32 vTaskStepTick() 147............................................................................................................... 2.33 vTaskSuspend() 149............................................................................................................... 2.34 vTaskSuspendAll() 151.......................................................................................................... 2.35 taskYIELD() 153...................................................................................................................... 章节 3Queue.................................................................................................................................. API155 3.1 vQueueAddToRegistry() 156................................................................................................. 3.2 xQueueAddToSet() 158.......................................................................................................... 3.3 xQueueCreate() 160............................................................................................................... 3.4 xQueueCreateSet() 162......................................................................................................... 3.5 xQueueCreateStatic() 166..................................................................................................... 3.6 vQueueDelete() 168................................................................................................................ 3.7 pcQueueGetName() 170........................................................................................................ 3.8 xQueueIsQueueEmptyFromISR() 171................................................................................. 3.9 xQueueIsQueueFullFromISR() 172...................................................................................... 3.10 uxQueueMessagesWaiting() 173.......................................................................................... 3.11 uxQueueMessagesWaitingFromISR() 174..........................................................................六 3.12 xQueueOverwrite() 176.......................................................................................................... 3.13 xQueueOverwriteFromISR() 178.......................................................................................... 3.14 xQueuePeek() 180.................................................................................................................. 3.15 xQueuePeekFromISR() 183.................................................................................................. 3.16 xQueueReceive() 184............................................................................................................. 3.17 xQueueReceiveFromISR() 187............................................................................................. 3.18 xQueueRemoveFromSet() 190............................................................................................. 3.19 xQueueReset() 192................................................................................................................. 3.20 xQueueSelectFromSet() 193................................................................................................. 3.21 xQueueSelectFromSetFromISR() 195................................................................................. 3.22 xQueueSend() , xQueueSendToFront() , xQueueSendToBack() 197............... 3.23 xQueueSendFromISR() , xQueueSendToBackFromISR() , xQueueSendToFrontFromISR() ............................................................200 3.24 uxQueueSpacesAvailable() 204............................................................................................ 章节 4Semaphore......................................................................................................................... API206 4.1 vSemaphoreCreateBinary() 207........................................................................................... 4.2 xSemaphoreCreateBinary() 210........................................................................................... 4.3 xSemaphoreCreateBinaryStatic() 213................................................................................. 4.4 xSemaphoreCreateCounting() 216....................................................................................... 4.5 xSemaphoreCreateCountingStatic() 219............................................................................. 4.6 xSemaphoreCreateMutex() 222............................................................................................ 4.7 xSemaphoreCreateMutexStatic() 224.................................................................................. 4.8 xSemaphoreCreateRecursiveMutex() 226.......................................................................... 4.9 xSemaphoreCreateRecursiveMutexStatic() 229................................................................ 4.10 vSemaphoreDelete() 231....................................................................................................... 4.11 uxSemaphoreGetCount() 232............................................................................................... 4.12 xSemaphoreGetMutexHolder() 233...................................................................................... 4.13 xSemaphoreGive() 234.......................................................................................................... 4.14 xSemaphoreGiveFromISR() 236.......................................................................................... 4.15 xSemaphoreGiveRecursive() 239......................................................................................... 4.16 xSemaphoreTake() 242.......................................................................................................... 4.17 xSemaphoreTakeFromISR() 245.......................................................................................... 4.18 xSemaphoreTakeRecursive() 247........................................................................................ 章节 5Software 定时器................................................................................................................. API251 5.1 xTimerChangePeriod() 252.................................................................................................... 5.2 xTimerChangePeriodFromISR() 255.................................................................................... 5.3 xTimerCreate() 257................................................................................................................. 5.4 xTimerCreateStatic() 261.......................................................................................................9 5.5 xTimerDelete() 265.................................................................................................................. 5.1 xTimerGetExpiryTime() ....................................................................................................267 5.1 pcTimerGetName() 269.......................................................................................................... 5.2 xTimerGetPeriod() 270........................................................................................................... 5.3 xTimerGetTimerDaemonTaskHandle() 271........................................................................ 5.4 pvTimerGetTimerID() 272...................................................................................................... 5.5 xTimerIsTimerActive() 274..................................................................................................... 5.6 xTimerPendFunctionCall() 276.............................................................................................. 5.7 xTimerPendFunctionCallFromISR() 278..............................................................................8 5.8 xTimerReset() 281................................................................................................................... 5.9 xTimerResetFromISR() 284................................................................................................... 5.10 vTimerSetTimerID() 286......................................................................................................... 5.11 xTimerStart() 288..................................................................................................................... 5.12 xTimerStartFromISR() 290..................................................................................................... 5.13 xTimerStop() 292..................................................................................................................... 5.14 xTimerStopFromISR() 294..................................................................................................... 章节 6Event 组............................................................................................................................... API296 6.1 xEventGroupClearBits() 297.................................................................................................. 6.2 xEventGroupClearBitsFromISR() 299.................................................................................. 6.3 xEventGroupCreate() 302...................................................................................................... 6.4 xEventGroupCreateStatic() 304............................................................................................ 6.1 vEventGroupDelete() 306...................................................................................................... 6.2 xEventGroupGetBits() 307..................................................................................................... 6.1 xEventGroupGetBitsFromISR() 308..................................................................................... 6.2 xEventGroupSetBits() 309..................................................................................................... 6.3 xEventGroupSetBitsFromISR() 311..................................................................................... 6.1 xEventGroupSync() 314......................................................................................................... 6.2 xEventGroupWaitBits() 318................................................................................................... 章节 7Kernel................................................................................................................. Configuration321 7.1 FreeRTOSConfig.h322............................................................................................................... 7.2 常量开始“INCLUDE_”...........................................................................................................323 7.3 常量开始“配置”.......................................................................................................................327 附录 1: 数据类型和编码样式.................................................................................................. Guide347