TI-RTOS Drivers  tidrivers_full_2_20_00_08
List.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
115 #ifndef ti_drivers_utils_List__include
116 #define ti_drivers_utils_List__include
117 
118 #ifdef __cplusplus
119 extern "C" {
120 #endif
121 
122 #include <stdint.h>
123 #include <stdbool.h>
124 #include <stddef.h>
125 
126 typedef struct List_Elem {
127  struct List_Elem *next;
128  struct List_Elem *prev;
129 } List_Elem;
130 
131 typedef struct List_List {
134 } List_List;
135 
142 extern void List_clearList(List_List *list);
143 
151 extern bool List_empty(List_List *list);
152 
160 extern List_Elem *List_get(List_List *list);
161 
172 extern List_Elem *List_head(List_List *list);
173 
184 extern void List_insert(List_List *list, List_Elem *newElem,
185  List_Elem *curElem);
186 
197 extern List_Elem *List_next(List_Elem *elem);
198 
209 extern List_Elem *List_prev(List_Elem *elem);
210 
218 extern void List_put(List_List *list, List_Elem *elem);
219 
227 extern void List_putHead(List_List *list, List_Elem *elem);
228 
236 extern void List_remove(List_List *list, List_Elem *elem);
237 
248 extern List_Elem *List_tail(List_List *list);
249 
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
255 #endif /* ti_drivers_utils_List__include */
bool List_empty(List_List *list)
Function to test whether a linked list is empty.
List_Elem * tail
Definition: List.h:133
struct List_Elem * prev
Definition: List.h:128
Definition: List.h:131
void List_remove(List_List *list, List_Elem *elem)
Function to remove an elem from a linked list.
List_Elem * List_get(List_List *list)
Function to atomically get the first elem in a linked list.
List_Elem * List_prev(List_Elem *elem)
Function to return the prev elem in a linked list.
void List_insert(List_List *list, List_Elem *newElem, List_Elem *curElem)
Function to insert an elem into a linked list.
List_Elem * head
Definition: List.h:132
List_Elem * List_next(List_Elem *elem)
Function to return the next elem in a linked list.
void List_put(List_List *list, List_Elem *elem)
Function to atomically put an elem onto the end of a linked list.
struct List_Elem * next
Definition: List.h:127
List_Elem * List_head(List_List *list)
Function to return the head of a linked list.
struct List_List List_List
Definition: List.h:126
void List_clearList(List_List *list)
Function to initialize the contents of a List_List.
struct List_Elem List_Elem
void List_putHead(List_List *list, List_Elem *elem)
Function to atomically put an elem onto the head of a linked list.
List_Elem * List_tail(List_List *list)
Function to return the tail of a linked list.
Copyright 2016, Texas Instruments Incorporated