From 7abee7168a90b07f3746779e338b4523d48724b0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Apr 2012 13:13:25 +0000 Subject: Added new function chPoolLoadArray(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4088 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chmempools.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'os/kernel/include') diff --git a/os/kernel/include/chmempools.h b/os/kernel/include/chmempools.h index 8a0d6f47d..a920e2579 100644 --- a/os/kernel/include/chmempools.h +++ b/os/kernel/include/chmempools.h @@ -75,10 +75,50 @@ typedef struct { #define MEMORYPOOL_DECL(name, size, provider) \ MemoryPool name = _MEMORYPOOL_DATA(name, size, provider) +/** + * @name Macro Functions + * @{ + */ +/** + * @brief Adds an object to a memory pool. + * @pre The memory pool must be already been initialized. + * @pre The added object must be of the right size for the specified + * memory pool. + * @pre The added object must be memory aligned to the size of + * @p stkalign_t type. + * @note This function is just an alias for @p chPoolFree() and has been + * added for clarity. + * + * @param[in] mp pointer to a @p MemoryPool structure + * @param[in] objp the pointer to the object to be added + * + * @api + */ +#define chPoolAdd(mp, objp) chPoolFree(mp, objp) + +/** + * @brief Adds an object to a memory pool. + * @pre The memory pool must be already been initialized. + * @pre The added object must be of the right size for the specified + * memory pool. + * @pre The added object must be memory aligned to the size of + * @p stkalign_t type. + * @note This function is just an alias for @p chPoolFree() and has been + * added for clarity. + * + * @param[in] mp pointer to a @p MemoryPool structure + * @param[in] objp the pointer to the object to be added + * + * @iclass + */ +#define chPoolAddI(mp, objp) chPoolFreeI(mp, objp) +/** @} */ + #ifdef __cplusplus extern "C" { #endif void chPoolInit(MemoryPool *mp, size_t size, memgetfunc_t provider); + void chPoolLoadArray(MemoryPool *mp, void *p, size_t n); void *chPoolAllocI(MemoryPool *mp); void *chPoolAlloc(MemoryPool *mp); void chPoolFreeI(MemoryPool *mp, void *objp); -- cgit v1.2.3