00001 00018 #ifndef _CO_POOL_H_ 00019 #define _CO_POOL_H_ 00020 00021 00041 /* 00042 * INCLUDE FILES 00043 **************************************************************************************** 00044 */ 00045 #include "co_int.h" 00046 00047 00048 /* 00049 * STRUCTURE DECLARATIONS 00050 **************************************************************************************** 00051 */ 00059 struct co_pool_hdr 00060 { 00062 struct co_pool_hdr *next; 00064 void *element; 00065 }; 00066 00067 00070 struct co_pool 00071 { 00073 struct co_pool_hdr *first_ptr; 00075 uint32_t freecnt; 00076 }; 00077 00078 /* 00079 * FUNCTION DECLARATIONS 00080 **************************************************************************************** 00081 */ 00097 void co_pool_init(struct co_pool *pool, 00098 struct co_pool_hdr *pool_hdr, 00099 void *elements, 00100 uint32_t elem_size, 00101 uint32_t elem_cnt); 00102 00114 struct co_pool_hdr *co_pool_alloc(struct co_pool *pool, 00115 uint32_t nbelem); 00116 00127 void co_pool_free(struct co_pool *pool, 00128 struct co_pool_hdr *elements, 00129 uint32_t nbelem); 00130 00131 00134 00135 00136 #endif // _CO_POOL_H_ 00137
1.6.1