Skip to content

Commit

Permalink
Merge pull request #1379 from jphickey/fix-1317-pool-memtype
Browse files Browse the repository at this point in the history
Fix #1317, memory pool pointer type
  • Loading branch information
astrogeco authored Apr 28, 2021
2 parents 73c338d + 24b9a3b commit ef9ab99
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
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 @@ -1184,10 +1184,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 @@ -1196,7 +1198,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 @@ -1214,10 +1216,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 @@ -1226,7 +1230,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 @@ -1240,14 +1244,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 @@ -1266,7 +1271,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

0 comments on commit ef9ab99

Please sign in to comment.