diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-16 14:49:41 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-16 14:49:41 +0000 |
commit | 53f1b747726d85020beca994f6fe67a5e9af7b8e (patch) | |
tree | 72bbc0235de15168314bc3b5c803464f2c16f667 /src/include/mempools.h | |
parent | b20088a8cb72e3f3e694e309671cd7f96fb552dc (diff) | |
download | ChibiOS-53f1b747726d85020beca994f6fe67a5e9af7b8e.tar.gz ChibiOS-53f1b747726d85020beca994f6fe67a5e9af7b8e.tar.bz2 ChibiOS-53f1b747726d85020beca994f6fe67a5e9af7b8e.zip |
Added static initializers for mailboxes and memory pools.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@978 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/include/mempools.h')
-rw-r--r-- | src/include/mempools.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/include/mempools.h b/src/include/mempools.h index 537ca3425..38e54b3d8 100644 --- a/src/include/mempools.h +++ b/src/include/mempools.h @@ -44,6 +44,25 @@ typedef struct { size_t mp_object_size; /**< Memory pool objects size.*/
} 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
+ */
+#define _MEMORYPOOL_DATA(name, size) {NULL, size}
+
+/**
+ * @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)
+
#ifdef __cplusplus
extern "C" {
#endif
|