Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1317, memory pool pointer type #1379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions modules/core_api/fsw/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -1178,10 +1178,12 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
** PoolID is the memory pool handle.
**
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be on a 32-bit boundary.
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
** macro may be used to assist in creating properly aligned memory pools.
**
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words.
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
** memory alignment of the processor architecture.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -1190,7 +1192,7 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size);
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size);

/*****************************************************************************/
/**
Expand All @@ -1208,10 +1210,12 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
** PoolID is the memory pool handle.
**
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be on a 32-bit boundary.
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
** macro may be used to assist in creating properly aligned memory pools.
**
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words.
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
** memory alignment of the processor architecture.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -1220,7 +1224,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
** \sa #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size);
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size);

/*****************************************************************************/
/**
Expand All @@ -1234,14 +1238,15 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
** -# The start address of the pool must be 32-bit aligned
** -# 168 bytes are used for internal bookkeeping, therefore, they will not be available for allocation.
**
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
** PoolID is the memory pool handle.
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
** PoolID is the memory pool handle.
**
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be on a 32-bit boundary.
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
** macro may be used to assist in creating properly aligned memory pools.
**
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit
** words.
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
** memory alignment of the processor architecture.
**
** \param[in] NumBlockSizes The number of different block sizes specified in the \c BlockSizes array. If set equal to
** zero or if greater than 17, then default block sizes are used.
Expand All @@ -1260,7 +1265,7 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes,
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size, uint16 NumBlockSizes,
const size_t *BlockSizes, bool UseMutex);

/*****************************************************************************/
Expand Down
6 changes: 3 additions & 3 deletions modules/core_api/ut-stubs/src/ut_es_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID,
** Returns either a user-defined status flag or OS_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), PoolID);
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), MemPtr);
Expand Down Expand Up @@ -568,7 +568,7 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
** Returns OS_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), PoolID);
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), MemPtr);
Expand Down Expand Up @@ -606,7 +606,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
** Returns either a user-defined status flag or CFE_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes,
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size, uint16 NumBlockSizes,
const size_t *BlockSizes, bool UseMutex)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), PoolID);
Expand Down
6 changes: 3 additions & 3 deletions modules/es/fsw/src/cfe_es_mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ CFE_ES_MemPoolRecord_t *CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID
/*
** CFE_ES_PoolCreateNoSem will initialize a pre-allocated memory pool without using a mutex.
*/
int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0],
CFE_ES_NO_MUTEX);
Expand All @@ -143,13 +143,13 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t S
/*
** CFE_ES_PoolCreate will initialize a pre-allocated memory pool while using a mutex.
*/
int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0],
CFE_ES_USE_MUTEX);
}

int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes,
int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size, uint16 NumBlockSizes,
const size_t *BlockSizes, bool UseMutex)
{
int32 Status;
Expand Down