00001 00013 #ifndef _CO_DLIST_H_ 00014 #define _CO_DLIST_H_ 00015 00027 /* 00028 * INCLUDE FILES 00029 **************************************************************************************** 00030 */ 00031 // standard includes 00032 #include "co_int.h" 00033 #include "co_bool.h" 00034 // for NULL and size_t 00035 #include <stddef.h> 00036 00037 // for target dependent directives 00038 #include "rwnx_config.h" 00039 00040 // for __INLINE 00041 #include "compiler.h" 00042 00043 00044 /* 00045 * STRUCTURE DECLARATIONS 00046 **************************************************************************************** 00047 */ 00049 struct co_dlist_hdr 00050 { 00052 struct co_dlist_hdr *next; 00054 struct co_dlist_hdr *prev; 00055 }; 00056 00058 struct co_dlist 00059 { 00061 struct co_dlist_hdr *first; 00063 struct co_dlist_hdr *last; 00065 uint32_t cnt; 00066 00067 #if NX_DEBUG 00069 uint32_t maxcnt; 00071 uint32_t mincnt; 00072 #endif // NX_DEBUG 00073 }; 00074 00075 00076 /* 00077 * FUNCTION DECLARATIONS 00078 **************************************************************************************** 00079 */ 00086 void co_dlist_init(struct co_dlist *list); 00087 00096 void co_dlist_push_back(struct co_dlist *list, 00097 struct co_dlist_hdr *list_hdr); 00098 00107 void co_dlist_push_front(struct co_dlist *list, 00108 struct co_dlist_hdr *list_hdr); 00109 00119 struct co_dlist_hdr* co_dlist_pop_front(struct co_dlist *list); 00120 00129 void co_dlist_extract(struct co_dlist *list, 00130 struct co_dlist_hdr const *list_hdr); 00131 00141 __INLINE bool co_dlist_is_empty(struct co_dlist const * list) 00142 { 00143 bool listempty; 00144 listempty = (list->first == NULL); 00145 return (listempty); 00146 } 00147 00157 __INLINE uint32_t co_dlist_cnt(struct co_dlist const * list) 00158 { 00159 return(list->cnt); 00160 } 00161 00171 __INLINE struct co_dlist_hdr *co_dlist_pick(struct co_dlist const * list) 00172 { 00173 return(list->first); 00174 } 00175 00176 00186 __INLINE struct co_dlist_hdr *co_dlist_next(struct co_dlist_hdr const * list_hdr) 00187 { 00188 return(list_hdr->next); 00189 } 00190 00192 00193 00194 #endif // _CO_DLIST_H_
1.6.1