mirror of https://github.com/ARMmbed/mbed-os.git
mem pool size: Fix calculation of memory pool size for portability
Replace the hardcoded value calculation of the memory pool block size with the RTX preprocessor macro (via a shim layer). This is in preparation for the replacement of the direct access of RTX functionalities in Mbed OS with an access via CMSIS.pull/10706/head
parent
9cc1caa031
commit
4f8305ed95
|
@ -183,8 +183,7 @@ public:
|
|||
|
||||
private:
|
||||
osMemoryPoolId_t _id;
|
||||
/* osMemoryPoolNew requires that pool block size is a multiple of 4 bytes. */
|
||||
char _pool_mem[((sizeof(T) + 3) & ~3) * pool_sz];
|
||||
char _pool_mem[MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(pool_sz, sizeof(T))];
|
||||
mbed_rtos_storage_mem_pool_t _obj_mem;
|
||||
};
|
||||
/** @}*/
|
||||
|
@ -192,5 +191,3 @@ private:
|
|||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ typedef osRtxEventFlags_t mbed_rtos_storage_event_flags_t;
|
|||
typedef osRtxMessage_t mbed_rtos_storage_message_t;
|
||||
typedef osRtxTimer_t mbed_rtos_storage_timer_t;
|
||||
|
||||
#define MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(block_count, block_size) \
|
||||
osRtxMemoryPoolMemSize(block_count, block_size)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue