804 Star 2.4K Fork 1.2K

GVPHuawei LiteOS / LiteOS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
development-guidelines-48.md 14.51 KB
一键复制 编辑 原始数据 按行查看 历史

Development Guidelines

Functions

The doubly linked list module of Huawei LiteOS provides the following functions. For details about the APIs, see the API reference.

Function Category

API

Description

List initialization

LOS_ListInit

Initializes a specified node to a doubly linked list node.

LOS_DL_LIST_HEAD

Defines a node and initializes it to a doubly linked list node.

Node insertion

LOS_ListAdd

Inserts a specified node to the head of a doubly linked list.

LOS_ListHeadInsert

Inserts a specified node to the head of a doubly linked list, which is the same as LOS_ListAdd.

LOS_ListTailInsert

Inserts a specified node to the tail of a doubly linked list.

Node deletion

LOS_ListDelete

Deletes a specified node from a doubly linked list.

LOS_ListDelInit

Deletes a specified node from the linked list and uses the node to initialize the linked list.

Checking whether a doubly linked list is empty

LOS_ListEmpty

Checks whether a doubly linked list is empty.

Obtaining a node

LOS_DL_LIST_LAST

Obtains the previous node of a specified node.

LOS_DL_LIST_FIRST

Obtains the next node of a specified node.

Obtaining structure information

LOS_DL_LIST_ENTRY

Obtains the address of the structure that contains the linked list. The first input parameter of the API indicates a node in the linked list, the second input parameter indicates the name of the structure to be obtained, and the third input parameter indicates the name of the linked list in the structure.

LOS_OFF_SET_OF

Obtains the offset of a member in a specified structure relative to the start address of the structure.

Traversing the doubly linked list

LOS_DL_LIST_FOR_EACH

Traverses a doubly linked list.

LOS_DL_LIST_FOR_EACH_SAFE

Traverses a doubly linked list, and stores the next node of the current node for security verification.

Traversing the structure that contains the doubly linked list

LOS_DL_LIST_FOR_EACH_ENTRY

Traverses a specified doubly linked list and obtain the address of the structure that contains the linked list node.

LOS_DL_LIST_FOR_EACH_ENTRY_SAFE

Traverses a specified doubly linked list, obtains the structure address of the node that contains the linked list, and stores the structure address that contains the next node of the current node.

LOS_DL_LIST_FOR_EACH_ENTRY_HOOK

Traverses a specified doubly linked list, obtain the structure address of the link list node, and call the hook function in each loop.

Development Process

The doubly linked list development process is as follows:

  1. Call LOS_ListInit/LOS_DL_LIST_HEAD to initialize the doubly linked list.
  2. Call LOS_ListAdd/LOS_ListHeadInsert to insert a node to the head of the linked list.
  3. Call the LOS_ListTailInsert API to insert a node into the tail of the list.
  4. Call the LOS_ListDelete API to delete a node from the list.
  5. Call the LOS_ListEmpty API to determine whether the doubly linked list is empty.
  6. Call the LOS_ListDelInit API to delete a node and use the node to initialize the doubly linked list.
C
1
https://gitee.com/LiteOS/LiteOS.git
git@gitee.com:LiteOS/LiteOS.git
LiteOS
LiteOS
LiteOS
master

搜索帮助