文章目录
0 前言
@ Author :Dargon
@ Record Date :2021/07/12
@ Reference Book : `FreeRTOS源码详解与应用开发`,`ARM Cortex-M3与Cortex-M4权威指南`,`B站正点原子FreeRTOS讲解视频`
@ Purpose :学习正点原子的miniFly,该飞控基于FreeRTOS系统开发的,所以学习一下记录下关于RTOS系统的一些基本操作,大概了解系统的工作原理,如何创建,运行,切换任务等等基本操作流程。在此进行学习的记录。
1 列表基础知识
1.1 列表List_t
- List_t 结构体定义
typedef struct xLIST { listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ configLIST_VOLATILE UBaseType_t uxNumberOfItems; ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */ MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ } List_t;uxNumberOfItems表示列表中列表项的个数pxIndex用来遍历列表,一个列表项ListItem_t类型的指针xListEnd用作一个标记,位于列表的末尾
1.2 列表项ListItem_t
- ListItem_t 结构体定义
struct xLIST_ITEM { listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */ struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */ struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */ void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */ void * configLIST_VOLATILE pvContainer;

这篇博客详细介绍了FreeRTOS中的列表(List_t)、列表项(ListItem_t)和Mini列表项(MiniListItem_t)的基础知识,包括它们的结构体定义和作用。此外,还深入解析了API函数的实现,如列表初始化、列表项初始化、列表插入、列表末尾插入以及列表删除的内部逻辑。通过对这些操作的探讨,有助于更好地理解和运用FreeRTOS的任务管理机制。
最低0.47元/天 解锁文章
1613

被折叠的 条评论
为什么被折叠?



