31 #if (CH_CFG_USE_MEMPOOLS == TRUE) || defined(__DOXYGEN__) 45 #if CH_CFG_USE_MEMCORE == FALSE 46 #error "CH_CFG_USE_MEMPOOLS requires CH_CFG_USE_MEMCORE" 73 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__) 98 #define _MEMORYPOOL_DATA(name, size, align, provider) \ 99 {NULL, size, align, provider} 112 #define MEMORYPOOL_DECL(name, size, align, provider) \ 113 memory_pool_t name = _MEMORYPOOL_DATA(name, size, align, provider) 115 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__) 125 #define _GUARDEDMEMORYPOOL_DATA(name, size, align) { \ 126 _SEMAPHORE_DATA(name.sem, (cnt_t)0), \ 127 _MEMORYPOOL_DATA(NULL, size, align, NULL) \ 139 #define GUARDEDMEMORYPOOL_DECL(name, size, align) \ 140 guarded_memory_pool_t name = _GUARDEDMEMORYPOOL_DATA(name, size, align) 157 #if CH_CFG_USE_SEMAPHORES == TRUE 234 #if (CH_CFG_USE_SEMAPHORES == TRUE) || defined(__DOXYGEN__) 282 "semaphore out of sync");
void chGuardedPoolFree(guarded_memory_pool_t *gmp, void *objp)
Releases an object into a guarded memory pool.
uint64_t sysinterval_t
Type of time interval.
void chPoolFreeI(memory_pool_t *mp, void *objp)
Releases an object into a memory pool.
static void chPoolObjectInit(memory_pool_t *mp, size_t size, memgetfunc_t provider)
Initializes an empty memory pool.
void * chGuardedPoolAllocTimeout(guarded_memory_pool_t *gmp, sysinterval_t timeout)
Allocates an object from a guarded memory pool.
memgetfunc_t provider
Memory blocks provider for this pool.
static void chSemFastWaitI(semaphore_t *sp)
Decreases the semaphore counter.
void chPoolFree(memory_pool_t *mp, void *objp)
Releases an object into a memory pool.
unsigned align
Required alignment.
memory_pool_t pool
The memory pool itself.
static void * chGuardedPoolAllocI(guarded_memory_pool_t *gmp)
Allocates an object from a guarded memory pool.
void *(* memgetfunc_t)(size_t size, unsigned align)
Memory get function.
static void chPoolAddI(memory_pool_t *mp, void *objp)
Adds an object to a memory pool.
size_t object_size
Memory pool objects size.
void chSchRescheduleS(void)
Performs a reschedule if a higher priority thread is runnable.
static void chGuardedPoolFreeS(guarded_memory_pool_t *gmp, void *objp)
Releases an object into a guarded memory pool.
static void chGuardedPoolAdd(guarded_memory_pool_t *gmp, void *objp)
Adds an object to a guarded memory pool.
static void chGuardedPoolObjectInit(guarded_memory_pool_t *gmp, size_t size)
Initializes an empty guarded memory pool.
struct pool_header * next
Pointer to the header.
void * chPoolAlloc(memory_pool_t *mp)
Allocates an object from a memory pool.
static void chGuardedPoolFreeI(guarded_memory_pool_t *gmp, void *objp)
Releases an object into a guarded memory pool.
void chPoolLoadArray(memory_pool_t *mp, void *p, size_t n)
Loads a memory pool with an array of static objects.
semaphore_t sem
Counter semaphore guarding the memory pool.
void * chPoolAllocI(memory_pool_t *mp)
Allocates an object from a memory pool.
static void chGuardedPoolAddI(guarded_memory_pool_t *gmp, void *objp)
Adds an object to a guarded memory pool.
void * chGuardedPoolAllocTimeoutS(guarded_memory_pool_t *gmp, sysinterval_t timeout)
Allocates an object from a guarded memory pool.
void chPoolObjectInitAligned(memory_pool_t *mp, size_t size, unsigned align, memgetfunc_t provider)
Initializes an empty memory pool.
#define chDbgAssert(c, r)
Condition assertion.
void chGuardedPoolObjectInitAligned(guarded_memory_pool_t *gmp, size_t size, unsigned align)
Initializes an empty guarded memory pool.
static void chPoolAdd(memory_pool_t *mp, void *objp)
Adds an object to a memory pool.
Guarded memory pool descriptor.
static cnt_t chSemGetCounterI(const semaphore_t *sp)
Returns the semaphore counter current value.
void chSemSignalI(semaphore_t *sp)
Performs a signal operation on a semaphore.
void chGuardedPoolLoadArray(guarded_memory_pool_t *gmp, void *p, size_t n)
Loads a guarded memory pool with an array of static objects.
static cnt_t chGuardedPoolGetCounterI(guarded_memory_pool_t *gmp)
Gets the count of objects in a guarded memory pool.
static void chGuardedPoolAddS(guarded_memory_pool_t *gmp, void *objp)
Adds an object to a guarded memory pool.