WS63 SDK 文档
7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
list.h
浏览该文件的文档.
1
/*
2
* Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2018-2020. All rights reserved.
3
* Description: List Header
4
*/
5
6
#ifndef LIST_H
7
#define LIST_H
8
9
#include "
common_def.h
"
10
15
#define LIST_POISON1 ((void *)0x10100100)
16
#define LIST_POISON2 ((void *)0x20200200)
17
18
struct
list_head
{
19
struct
list_head
*
next
, *
prev
;
20
};
21
22
static
inline
void
INIT_LIST_HEAD(
struct
list_head
*node)
23
{
24
node->
next
= node;
25
node->
prev
= node;
26
}
27
28
static
inline
void
list_add_node(
struct
list_head
*cur,
struct
list_head
*
prev
,
struct
list_head
*
next
)
29
{
30
next
->
prev
= cur;
31
cur->
next
=
next
;
32
cur->
prev
=
prev
;
33
prev
->
next
= cur;
34
}
35
36
static
inline
void
list_add(
struct
list_head
*cur,
struct
list_head
*head)
37
{
38
list_add_node(cur, head, head->
next
);
39
}
40
41
static
inline
void
list_add_tail(
struct
list_head
*cur,
struct
list_head
*head)
42
{
43
list_add_node(cur, head->
prev
, head);
44
}
45
46
static
inline
void
list_del_node(
struct
list_head
*
prev
,
struct
list_head
*
next
)
47
{
48
next
->
prev
=
prev
;
49
prev
->
next
=
next
;
50
}
51
52
static
inline
void
list_del(
struct
list_head
*node)
53
{
54
list_del_node(node->
prev
, node->
next
);
55
node->
next
= (
struct
list_head
*)
LIST_POISON1
;
56
node->
prev
= (
struct
list_head
*)
LIST_POISON2
;
57
}
58
59
static
inline
int
list_empty(
const
struct
list_head
*list)
60
{
61
return
list->
next
== list;
62
}
63
64
#ifndef LOSCFG_LIB_LIBC
65
#ifndef offsetof
66
#define offsetof(type, member) ((unsigned int)&((type *)0)->member)
67
#endif
68
#endif
69
70
#ifndef container_of
71
#define container_of(cur, type, member) ((type *)((char *)(cur) - offsetof(type, member)))
72
#endif
73
74
#define list_entry(cur, type, member) container_of(cur, type, member)
75
76
#define list_first_entry(cur, type, member) container_of((cur)->next, type, member)
77
78
#define list_next_entry(cur, type, member) container_of((cur)->member.next, type, member)
79
80
#define list_for_each_entry(cur, node_type, head, member) \
81
for ((cur) = list_first_entry(head, node_type, member); \
82
&(cur)->member != (head); \
83
(cur) = list_next_entry(cur, node_type, member))
84
85
#define list_for_each_entry_safe(cur, cur_next, node_type, head, member) \
86
for ((cur) = list_first_entry(head, node_type, member), \
87
(cur_next) = list_next_entry(cur, node_type, member); \
88
&(cur)->member != (head); \
89
(cur) = (cur_next), (cur_next) = list_next_entry(cur, node_type, member))
90
94
#endif
common_def.h
LIST_POISON2
#define LIST_POISON2
Definition
list.h:16
LIST_POISON1
#define LIST_POISON1
Definition
list.h:15
list_head
Definition
list.h:18
list_head::prev
struct list_head * prev
Definition
list.h:19
list_head::next
struct list_head * next
Definition
list.h:19
src
middleware
utils
common_headers
list.h
由
William Goodspeed
维护 | E-mail: gongzl@stu.hebust.edu.cn | Wechat: a23333344 | ALSO CHECKOUT
WS63FLASH
!
生成于 2025年 一月 4日 星期六 17:47:12 , 为 WS63 SDK 文档使用
1.9.8