diff --git a/inc/tlpbuf.h b/inc/tlpbuf.h index c799a03..15494d3 100644 --- a/inc/tlpbuf.h +++ b/inc/tlpbuf.h @@ -6,7 +6,6 @@ #include #include -#include #include @@ -91,7 +90,11 @@ void pbuf_pool_reset(pbuf_pool_t* pool); -void pbuf_dump_pool(pbuf_pool_t* pool); +#if DEBUG +void pbuf_pool_dump(pbuf_pool_t* pool); +else +static inline void pbuf_pool_dump(pbuf_pool_t* pool) {} +#endif static inline uint32_t pbuf_pool_get_available(pbuf_pool_t* pool) @@ -113,10 +116,8 @@ } -static inline pbuf_t* pbuf_alloc(pbuf_pool_t* pool) +static inline pbuf_t* pbuf_pool_alloc(pbuf_pool_t* pool) { - assert(pool); - pbuf_t* p = pool->free_list; if (p) @@ -131,7 +132,7 @@ } -static inline void pbuf_free(pbuf_t* p) +static inline void pbuf_pool_free(pbuf_t* p) { if (p) { @@ -145,7 +146,7 @@ } -static inline void pbuf_free_queue(pbuf_t* queue) +static inline void pbuf_queue_free(pbuf_t* queue) { while(queue) { diff --git a/src/tlpbuf.c b/src/tlpbuf.c index 3bb9f53..278b079 100644 --- a/src/tlpbuf.c +++ b/src/tlpbuf.c @@ -3,11 +3,6 @@ void pbuf_pool_create(pbuf_pool_t* pool, uint32_t pbuf_count, void* pbuf_memory, uint32_t pbuf_payload_capacity, void* pbuf_payload_memory) { - assert(pool); - assert(pbuf_count); - assert(pbuf_memory); - assert(pbuf_payload_memory); - pbuf_payload_capacity = (pbuf_payload_capacity + 3) & ~3; pool->pbuf_memory = (pbuf_t*)pbuf_memory; @@ -25,8 +20,6 @@ void pbuf_pool_reset(pbuf_pool_t* pool) { - assert(pool); - //initialize pbuf structures uint8_t *payload = pool->payload_memory; @@ -50,8 +43,12 @@ } -/* -void pbuf_dump_pool(pbuf_pool_t* pool) + +#if DEBUG + +#include + +void pbuf_pool_dump(pbuf_pool_t* pool) { debug_printf("\r\nPool %x, %u pbufs available\r\n", pool, pool->pbufs_available); @@ -64,4 +61,5 @@ debug_printf("\r\nEnd of dump\r\n"); } -*/ + +#endif