TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_list.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __TFM_LIST_H__
8 #define __TFM_LIST_H__
9 
10 /* List structure */
14 };
15 
21 __STATIC_INLINE void tfm_list_init(struct tfm_list_node_t *head)
22 {
23  head->next = head;
24  head->prev = head;
25 }
26 
33 __STATIC_INLINE void
35 {
36  head->prev->next = node;
37  node->prev = head->prev;
38  head->prev = node;
39  node->next = head;
40 }
41 
49 __STATIC_INLINE int32_t tfm_list_is_empty(struct tfm_list_node_t *head)
50 {
51  return (head->next == head);
52 }
53 
60 __STATIC_INLINE void
62  struct tfm_list_node_t *node)
63 {
64  node->next = head->next;
65  node->prev = head;
66  head->next->prev = node;
67  head->next = node;
68 }
69 
77 __STATIC_INLINE
79 {
80  return head->next;
81 }
82 
88 __STATIC_INLINE void tfm_list_del_node(struct tfm_list_node_t *node)
89 {
90  node->prev->next = node->next;
91  node->next->prev = node->prev;
92 }
93 
94 /* Go through each node of a list */
95 #define TFM_LIST_FOR_EACH(node, head) \
96  for (node = (head)->next; node != head; node = node->next)
97 
98 #endif
__STATIC_INLINE void tfm_list_del_node(struct tfm_list_node_t *node)
Delete one node from list.
Definition: tfm_list.h:88
struct tfm_list_node_t * next
Definition: tfm_list.h:13
__STATIC_INLINE struct tfm_list_node_t * tfm_list_first_node(struct tfm_list_node_t *head)
Retrieve the fist node from list.
Definition: tfm_list.h:78
__STATIC_INLINE void tfm_list_insert_first(struct tfm_list_node_t *head, struct tfm_list_node_t *node)
Insert one node to list head.
Definition: tfm_list.h:61
struct tfm_list_node_t * prev
Definition: tfm_list.h:12
__STATIC_INLINE void tfm_list_init(struct tfm_list_node_t *head)
Initialize list head.
Definition: tfm_list.h:21
__STATIC_INLINE int32_t tfm_list_is_empty(struct tfm_list_node_t *head)
Check if a list is empty.
Definition: tfm_list.h:49
__STATIC_INLINE void tfm_list_add_tail(struct tfm_list_node_t *head, struct tfm_list_node_t *node)
Add one node to list tail.
Definition: tfm_list.h:34