pool_create, pool_destroy, pool_alloc, pool_free
- memory
allocation
#include <sys.h>
pool_alloc() and pool_free() are callable from an ISR.
Memory pools are used for dynamic allocation of variable size buffers. Up to 8 memory pools may be created. Valid poolno values are 0 through 7 inclusive.
A memory pool is created with a call to pool_create(). startaddr and endaddr indicated the pool limits. It is up to the caller to provide a contiguous block of memory for the memory pool. poolno is a handle which will be used to access the pool. Memory pool poolno can be destroyed with a call to pool_destroy. pool_alloc returns a pointer to a dynamically allocated block of size bytes from memory pool poolno. pool_free returns the block of memory, allocated with a call to pool_alloc, to memory pool poolno.
pool_create() and pool_destroy() return 0 if sucessfull. If they fail, they set errno and return -1.
pool_alloc() returns 0 on failure and a pointer to the allocated buffer if successfull.
pool_create() will set the following errors:
pool_destroy() will set the following errors: