EtherLib/dynmem.h
Wiesner András ac5fc9c529 -IP reassembler added
-PcktSieve special return functionality added
-ARP multicast learning bug fixed
-include guards have been refactored
-Doxygen style tweaked
2023-02-04 11:04:26 +01:00

42 lines
979 B
C

#ifndef ETHERLIB_DYNMEM_H
#define ETHERLIB_DYNMEM_H
#include <stdint.h>
#ifdef DYNMEM_DEBUG
#include <stdio.h>
#endif
/**
* Initialize EtherLib dynamic memory management subsystem,
* based on heap pointer and size given in etherlib_options.h
*/
void dynmem_init();
/**
* Dynamically allocate memory from EtherLib's pool.
* @param size requested size
* @return pointer to allocated area or NULL on failure
*/
void * dynmem_alloc_(uint32_t size);
#ifdef DYNMEM_DEBUG
#define dynmem_alloc(size) dynmem_alloc_(size); MSG("ALLOC: %d %s() in %s:%d\n", size, __FUNCTION__, __FILE__, __LINE__)
#else
#define dynmem_alloc(size) dynmem_alloc_(size)
#endif
/**
* Release allocated block.
* @param ptr pointer to allocated area
*/
void dynmem_free_(void * ptr);
#ifdef DYNMEM_DEBUG
#define dynmem_free(ptr) MSG("FREE: %s() in %s:%d\n", __FUNCTION__, __FILE__, __LINE__), dynmem_free_(ptr)
#else
#define dynmem_free(ptr) dynmem_free_(ptr)
#endif
#endif //ETHERLIB_DYNMEM_H