22
33 @file IntrOS: os_mem.h
44 @author Rajmund Szymanski
5- @date 29 .03.2017
5+ @date 30 .03.2017
66 @brief This file contains definitions for IntrOS.
77
88 ******************************************************************************
@@ -41,7 +41,7 @@ extern "C" {
4141 * *
4242 **********************************************************************************************************************/
4343
44- typedef struct __mem mem_t ;
44+ typedef struct __mem mem_t , * const mem_id ;
4545
4646struct __mem
4747{
@@ -51,8 +51,6 @@ struct __mem
5151 void * data; // pointer to memory pool buffer
5252};
5353
54- typedef struct __mem mem_id[];
55-
5654/* -------------------------------------------------------------------------- */
5755
5856#define MSIZE ( size ) \
@@ -109,9 +107,10 @@ typedef struct __mem mem_id[];
109107 * *
110108 **********************************************************************************************************************/
111109
112- #define OS_MEM ( mem, limit, size ) \
113- void *mem##__buf[limit * (1 + MSIZE(size))]; \
114- mem_t mem[1 ] = { _MEM_INIT ( limit, size, mem##__buf ) }
110+ #define OS_MEM ( mem, limit, size ) \
111+ void *mem##__buf[limit*(1 +MSIZE(size))]; \
112+ mem_t mem##__mem = _MEM_INIT( limit, size, mem##__buf ); \
113+ mem_t * const mem = & mem##__mem
115114
116115/* *********************************************************************************************************************
117116 * *
@@ -126,9 +125,10 @@ typedef struct __mem mem_id[];
126125 * *
127126 **********************************************************************************************************************/
128127
129- #define static_MEM ( mem, limit, size ) \
130- static void *mem##__buf[limit * (1 + MSIZE(size))]; \
131- static mem_t mem[1 ] = { _MEM_INIT ( limit, size, mem##__buf ) }
128+ #define static_MEM ( mem, limit, size ) \
129+ static void *mem##__buf[limit*(1 +MSIZE(size))]; \
130+ static mem_t mem##__mem = _MEM_INIT( limit, size, mem##__buf ); \
131+ static mem_t * const mem = & mem##__mem
132132
133133/* *********************************************************************************************************************
134134 * *
0 commit comments