From 95daf92ee42b93928cfc9e026353077ff4c6dece Mon Sep 17 00:00:00 2001 From: Vishnuchander90 <56954612+Vishnuchander90@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:54:52 +0530 Subject: [PATCH] Adding the byte allocation API's --- CMSIS/RTOS2/Include/cmsis_os2.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/CMSIS/RTOS2/Include/cmsis_os2.h b/CMSIS/RTOS2/Include/cmsis_os2.h index 76612e2929..d86d417c82 100644 --- a/CMSIS/RTOS2/Include/cmsis_os2.h +++ b/CMSIS/RTOS2/Include/cmsis_os2.h @@ -686,7 +686,26 @@ uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id); /// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew. /// \return status code that indicates the execution status of the function. osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id); - + +// ==== Memory Pool Management Functions - Byte Allocation ==== + +/// Create and Initialize a Memory Pool object for byte allocation. +/// \param[in] attr memory pool attributes; NULL: default values. +/// \return memory pool ID for reference by other functions or NULL in case of error. +osMemoryPoolId_t osByteMemoryPoolNew(const osMemoryPoolAttr_t *attr); + +/// Allocate requested memory size from the Memory Pool. +/// \param[in] mp_id memory pool ID obtained by \ref osByteMemoryPoolNew. +/// \param[in] size memory size in bytes. +/// \return address of the allocated memory block or NULL in case of no memory is available. +void * osByteMemoryPoolAlloc(osMemoryPoolId_t mp_id, const uint32_t size); + +/// Free an allocated memory block from the Memory Pool and keep it available. +/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew. +/// \param[in] block address of the allocated memory block to be returned to the memory pool. +/// \return status code that indicates the execution status of the function. +osStatus_t osByteMemoryPoolFree(osMemoryPoolId_t mp_id, void *block ); + // ==== Message Queue Management Functions ====