aboutsummaryrefslogtreecommitdiffstats
path: root/os/kernel/include/mempools.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/kernel/include/mempools.h')
-rw-r--r--os/kernel/include/mempools.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/os/kernel/include/mempools.h b/os/kernel/include/mempools.h
index 38279c388..d5e612426 100644
--- a/os/kernel/include/mempools.h
+++ b/os/kernel/include/mempools.h
@@ -40,14 +40,19 @@ struct pool_header {
* @brief Memory pool descriptor.
*/
typedef struct {
- struct pool_header *mp_next; /**< Pointer to the header.*/
- size_t mp_object_size; /**< Memory pool objects size.*/
+ struct pool_header *mp_next; /**< Pointer to the header. */
+ size_t mp_object_size; /**< Memory pool objects size. */
+#if CH_USE_MEMCORE
+ bool_t mp_usecore; /**< Feed from the memory code
+ allocator if empty. */
+#endif
} MemoryPool;
/**
* @brief Data part of a static memory pool initializer.
* @details This macro should be used when statically initializing a
* memory pool that is part of a bigger structure.
+ *
* @param name the name of the memory pool variable
* @param size size of the memory pool contained objects
*/
@@ -57,12 +62,25 @@ typedef struct {
* @brief Static memory pool initializer.
* @details Statically initialized memory pools require no explicit
* initialization using @p chPoolInit().
+ *
* @param name the name of the memory pool variable
* @param size size of the memory pool contained objects
*/
#define MEMORYPOOL_DECL(name, size) \
MemoryPool name = _MEMORYPOOL_DATA(name, size)
+#if CH_USE_MEMCORE || defined(__DOXYGEN__)
+/**
+ * @brief Enables or disables the hungry mode.
+ * @details If enabled, the hungry mode, makes an empty memory pool feed
+ * new objects from the core memory manager.
+ *
+ * @param[in] mp pointer to a @p MemoryPool structure
+ * @param[in] mode hungry mode flag
+ */
+#define chPoolSetHungryMode(mp, mode) ((mp)->mp_usecore = (mode))
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif