generic_list.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-2020 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _GENERIC_LIST_H_
10 #define _GENERIC_LIST_H_
11 
12 #include "fsl_common.h"
18 /*!*********************************************************************************
19 *************************************************************************************
20 * Include
21 *************************************************************************************
22 ********************************************************************************** */
23 
29 #ifndef GENERIC_LIST_LIGHT
30 #define GENERIC_LIST_LIGHT (0)
31 #endif
32 
38 typedef enum _list_status
39 {
47 
49 typedef struct list_label
50 {
53  uint16_t size;
54  uint16_t max;
56 #if (defined(GENERIC_LIST_LIGHT) && (GENERIC_LIST_LIGHT > 0U))
57 
58 typedef struct list_element_tag
59 {
60  struct list_element_tag *next;
61  struct list_label *list;
63 #else
64 
65 typedef struct list_element_tag
66 {
69  struct list_label *list;
71 #endif
72 
77 /*******************************************************************************
78  * API
79  ******************************************************************************/
80 
81 #if defined(__cplusplus)
82 extern "C" {
83 #endif /* _cplusplus */
84 
92 void LIST_Init(list_handle_t list, uint32_t max);
93 
102 
111 
120 
129 
138 
147 
156 
166 
178 
186 uint32_t LIST_GetSize(list_handle_t list);
187 
195 uint32_t LIST_GetAvailableSize(list_handle_t list);
196 
197 /* @} */
198 
199 #if defined(__cplusplus)
200 }
201 #endif
202 
203 #endif /*_GENERIC_LIST_H_*/
list_element_tag
The list element.
Definition: generic_list.h:65
fsl_common.h
list_element_tag::next
struct list_element_tag * next
Definition: generic_list.h:67
kLIST_DuplicateError
@ kLIST_DuplicateError
Definition: generic_list.h:41
LIST_GetSize
uint32_t LIST_GetSize(list_handle_t list)
Gets the current size of a list.
Definition: generic_list.c:453
list_label::max
uint16_t max
Definition: generic_list.h:54
LIST_Init
void LIST_Init(list_handle_t list, uint32_t max)
Initialize the list.
Definition: generic_list.c:62
kLIST_Full
@ kLIST_Full
Definition: generic_list.h:42
list_status_t
enum _list_status list_status_t
The list status.
list_element_t
struct list_element_tag list_element_t
The list element.
MAKE_STATUS
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:43
list_element_tag::list
struct list_label * list
Definition: generic_list.h:69
LIST_GetHead
list_element_handle_t LIST_GetHead(list_handle_t list)
Gets head element handle.
Definition: generic_list.c:246
kStatusGroup_LIST
@ kStatusGroup_LIST
Definition: fsl_common.h:161
LIST_GetList
list_handle_t LIST_GetList(list_element_handle_t element)
Gets the list that contains the given element.
Definition: generic_list.c:85
LIST_RemoveElement
list_status_t LIST_RemoveElement(list_element_handle_t element)
Unlinks an element from its list.
Definition: generic_list.c:310
LIST_AddTail
list_status_t LIST_AddTail(list_handle_t list, list_element_handle_t element)
Links element to the tail of the list.
Definition: generic_list.c:106
list_label::tail
struct list_element_tag * tail
Definition: generic_list.h:52
LIST_GetPrev
list_element_handle_t LIST_GetPrev(list_element_handle_t element)
Gets previous element handle for given element handle.
Definition: generic_list.c:286
list_handle_t
struct list_label * list_handle_t
list_label::head
struct list_element_tag * head
Definition: generic_list.h:51
kLIST_OrphanElement
@ kLIST_OrphanElement
Definition: generic_list.h:44
kLIST_Empty
@ kLIST_Empty
Definition: generic_list.h:43
LIST_AddHead
list_status_t LIST_AddHead(list_handle_t list, list_element_handle_t element)
Links element to the head of the list.
Definition: generic_list.c:152
kLIST_Ok
@ kLIST_Ok
Definition: generic_list.h:40
kLIST_NotSupport
@ kLIST_NotSupport
Definition: generic_list.h:45
list_element_handle_t
struct list_element_tag * list_element_handle_t
list_label::size
uint16_t size
Definition: generic_list.h:53
list_element_tag::prev
struct list_element_tag * prev
Definition: generic_list.h:68
LIST_RemoveHead
list_element_handle_t LIST_RemoveHead(list_handle_t list)
Unlinks element from the head of the list.
Definition: generic_list.c:198
list_label
The list structure.
Definition: generic_list.h:49
_list_status
_list_status
The list status.
Definition: generic_list.h:38
kStatus_Success
@ kStatus_Success
Definition: fsl_common.h:179
list_label_t
struct list_label list_label_t
The list structure.
LIST_GetAvailableSize
uint32_t LIST_GetAvailableSize(list_handle_t list)
Gets the number of free places in the list.
Definition: generic_list.c:472
LIST_GetNext
list_element_handle_t LIST_GetNext(list_element_handle_t element)
Gets next element handle for given element handle.
Definition: generic_list.c:266
LIST_AddPrevElement
list_status_t LIST_AddPrevElement(list_element_handle_t element, list_element_handle_t newElement)
Links an element in the previous position relative to a given member of a list.
Definition: generic_list.c:381


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56