diff --git a/fsw/cfe-core/src/es/cfe_es_api.c b/fsw/cfe-core/src/es/cfe_es_api.c index a27c32376..54d3b24b8 100644 --- a/fsw/cfe-core/src/es/cfe_es_api.c +++ b/fsw/cfe-core/src/es/cfe_es_api.c @@ -848,7 +848,7 @@ int32 CFE_ES_GetTaskID(CFE_ES_ResourceID_t *TaskIdPtr) /* ** Function: CFE_ES_GetAppName - See API and header file for details */ -int32 CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, uint32 BufferLength) +int32 CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, size_t BufferLength) { int32 Result; CFE_ES_AppRecord_t *AppRecPtr; @@ -890,7 +890,7 @@ int32 CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, uint32 BufferL /* ** Function: CFE_ES_GetLibName - See API and header file for details */ -int32 CFE_ES_GetLibName(char *LibName, CFE_ES_ResourceID_t LibId, uint32 BufferLength) +int32 CFE_ES_GetLibName(char *LibName, CFE_ES_ResourceID_t LibId, size_t BufferLength) { int32 Result; CFE_ES_LibRecord_t *LibRecPtr; @@ -932,7 +932,7 @@ int32 CFE_ES_GetLibName(char *LibName, CFE_ES_ResourceID_t LibId, uint32 BufferL /* ** Function: CFE_ES_GetTaskName - See API and header file for details */ -int32 CFE_ES_GetTaskName(char *TaskName, CFE_ES_ResourceID_t TaskId, uint32 BufferLength) +int32 CFE_ES_GetTaskName(char *TaskName, CFE_ES_ResourceID_t TaskId, size_t BufferLength) { int32 Result; osal_id_t OsalId; @@ -1217,9 +1217,9 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_ResourceID_t TaskId int32 CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr, const char *TaskName, CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - uint32 *StackPtr, - uint32 StackSize, - uint32 Priority, + CFE_ES_StackPointer_t StackPtr, + size_t StackSize, + CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags) { @@ -1283,14 +1283,6 @@ int32 CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr, ParentTaskId = AppRecPtr->MainTaskId; if ( CFE_ES_ResourceID_Equal(TaskId, ParentTaskId) ) { - /* - ** Truncate the priority if needed - */ - if ( Priority > 255 ) - { - Priority = 255; - } - /* ** Step 2: Create the new task using the OS API call */ @@ -1614,7 +1606,7 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) /* ** Function: CFE_ES_CalculateCRC - See API and header file for details */ -uint32 CFE_ES_CalculateCRC(const void *DataPtr, uint32 DataLength, uint32 InputCRC, uint32 TypeCRC) +uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC) { uint32 i; int16 Index; @@ -1701,7 +1693,7 @@ uint32 CFE_ES_CalculateCRC(const void *DataPtr, uint32 DataLength, uint32 InputC ** Purpose: Allocate a data block for a Critical Data Store. ** */ -int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, CFE_ES_CDS_Offset_t BlockSize, const char *Name) +int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, const char *Name) { int32 Status; size_t NameLen; @@ -1821,7 +1813,7 @@ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_ResourceID_t *BlockIdPtr, const c * Purpose: Obtain CDS Block Name from ID * See full API description in header file */ -CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_ResourceID_t BlockId, uint32 BufferLength) +CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_ResourceID_t BlockId, size_t BufferLength) { CFE_Status_t Status; CFE_ES_CDS_RegRec_t *RegRecPtr; @@ -2072,7 +2064,7 @@ int32 CFE_ES_GetGenCounterIDByName(CFE_ES_ResourceID_t *CounterIdPtr, const char * Purpose: Obtain Counter Name from ID * See full API description in header file */ -CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_ResourceID_t CounterId, uint32 BufferLength) +CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_ResourceID_t CounterId, size_t BufferLength) { CFE_ES_GenCounterRecord_t *CountRecPtr; CFE_Status_t Status; @@ -2137,6 +2129,7 @@ int32 CFE_ES_LibID_ToIndex(CFE_ES_ResourceID_t LibId, uint32 *Idx) int32 CFE_ES_TaskID_ToIndex(CFE_ES_ResourceID_t TaskID, uint32 *Idx) { osal_id_t OsalID; + osal_index_t OsalIndex; if (!CFE_ES_ResourceID_IsDefined(TaskID)) { @@ -2144,11 +2137,13 @@ int32 CFE_ES_TaskID_ToIndex(CFE_ES_ResourceID_t TaskID, uint32 *Idx) } OsalID = CFE_ES_ResourceID_ToOSAL(TaskID); - if (OS_ObjectIdToArrayIndex(OS_OBJECT_TYPE_OS_TASK, OsalID, Idx) != OS_SUCCESS) + if (OS_ObjectIdToArrayIndex(OS_OBJECT_TYPE_OS_TASK, OsalID, &OsalIndex) != OS_SUCCESS) { return CFE_ES_ERR_RESOURCEID_NOT_VALID; } + *Idx = OsalIndex; + return CFE_SUCCESS; } diff --git a/fsw/cfe-core/src/es/cfe_es_apps.c b/fsw/cfe-core/src/es/cfe_es_apps.c index d0b1bbb0d..eeaa5350e 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.c +++ b/fsw/cfe-core/src/es/cfe_es_apps.c @@ -267,9 +267,9 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) const char *AppName; const char *EntryPoint; const char *EntryType; - unsigned int Priority; - unsigned int StackSize; - unsigned int ExceptionAction; + unsigned long PriorityIn; + unsigned long StackSizeIn; + unsigned long ExceptionActionIn; CFE_ES_ResourceID_t ApplicationId; int32 CreateStatus = CFE_ES_ERR_APP_CREATE; @@ -298,10 +298,13 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) * * This permissive parsing should not be relied upon, as it may become more strict again in * future CFE revisions. + * + * Also note that this uses "unsigned long" as that is the defined output type of strtoul(). + * It will be converted to the correct type later. */ - Priority = strtoul(TokenList[4], NULL, 0); - StackSize = strtoul(TokenList[5], NULL, 0); - ExceptionAction = strtoul(TokenList[7], NULL, 0); + PriorityIn = strtoul(TokenList[4], NULL, 0); + StackSizeIn = strtoul(TokenList[5], NULL, 0); + ExceptionActionIn = strtoul(TokenList[7], NULL, 0); if(strcmp(EntryType,"CFE_APP")==0) { @@ -314,14 +317,27 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens) ** 1 ( Processor reset ). If it's non-zero, assume it means ** reset CPU. */ - if ( ExceptionAction > CFE_ES_ExceptionAction_RESTART_APP ) - ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; + if ( ExceptionActionIn > CFE_ES_ExceptionAction_RESTART_APP ) + { + ExceptionActionIn = CFE_ES_ExceptionAction_PROC_RESTART; + } + + /* + * Task priority cannot be bigger than OS_MAX_TASK_PRIORITY + */ + if ( PriorityIn > OS_MAX_TASK_PRIORITY ) + { + PriorityIn = OS_MAX_TASK_PRIORITY; + } + /* ** Now create the application */ CreateStatus = CFE_ES_AppCreate(&ApplicationId, FileName, - EntryPoint, AppName, (uint32) Priority, - (uint32) StackSize, (uint32) ExceptionAction ); + EntryPoint, AppName, + PriorityIn, + StackSizeIn, + ExceptionActionIn); } else if(strcmp(EntryType,"CFE_LIB")==0) { @@ -522,7 +538,7 @@ int32 CFE_ES_StartAppTask(const CFE_ES_AppStartParams_t* StartParams, CFE_ES_Res StatusCode = OS_TaskCreate(&OsalTaskId, /* task id */ StartParams->BasicInfo.Name, /* task name */ CFE_ES_AppEntryPoint, /* task function pointer */ - NULL, /* stack pointer (allocate) */ + OSAL_TASK_STACK_ALLOCATE, /* stack pointer (allocate) */ StartParams->StackSize, /* stack size */ StartParams->Priority, /* task priority */ OS_FP_ENABLED); /* task options */ @@ -589,9 +605,9 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr, const char *FileName, const char *EntryPointName, const char *AppName, - uint32 Priority, - uint32 StackSize, - uint32 ExceptionAction) + CFE_ES_TaskPriority_Atom_t Priority, + size_t StackSize, + CFE_ES_ExceptionAction_Enum_t ExceptionAction) { CFE_Status_t Status; CFE_ES_ResourceID_t MainTaskId; @@ -1556,7 +1572,7 @@ void CFE_ES_CleanupObjectCallback(osal_id_t ObjectId, void *arg) { CFE_ES_CleanupState_t *CleanState; int32 Status; - uint32 ObjType; + osal_objtype_t ObjType; bool ObjIsValid; CleanState = (CFE_ES_CleanupState_t *)arg; @@ -1750,7 +1766,7 @@ void CFE_ES_CopyModuleBasicInfo(const CFE_ES_ModuleLoadParams_t *ParamsPtr, CFE_ void CFE_ES_CopyModuleStatusInfo(const CFE_ES_ModuleLoadStatus_t *StatusPtr, CFE_ES_AppInfo_t *AppInfoPtr) { AppInfoPtr->ModuleId = StatusPtr->ModuleId; - CFE_SB_SET_MEMADDR(AppInfoPtr->StartAddress, StatusPtr->EntryAddress); + AppInfoPtr->StartAddress = CFE_ES_MEMADDRESS_C(StatusPtr->EntryAddress); } /* @@ -1781,12 +1797,16 @@ void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoP memset(&ModuleInfo, 0, sizeof(ModuleInfo)); } - CFE_SB_SET_MEMADDR(AppInfoPtr->CodeAddress, ModuleInfo.addr.code_address); - CFE_SB_SET_MEMADDR(AppInfoPtr->CodeSize, ModuleInfo.addr.code_size); - CFE_SB_SET_MEMADDR(AppInfoPtr->DataAddress, ModuleInfo.addr.data_address); - CFE_SB_SET_MEMADDR(AppInfoPtr->DataSize, ModuleInfo.addr.data_size); - CFE_SB_SET_MEMADDR(AppInfoPtr->BSSAddress, ModuleInfo.addr.bss_address); - CFE_SB_SET_MEMADDR(AppInfoPtr->BSSSize, ModuleInfo.addr.bss_size); + /* + * Convert the internal size and address to the telemetry format. + * (The telemetry format may be a different bitwidth than the native processor) + */ + AppInfoPtr->CodeAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.code_address); + AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.code_size); + AppInfoPtr->DataAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.data_address); + AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.data_size); + AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_C(ModuleInfo.addr.bss_address); + AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_C(ModuleInfo.addr.bss_size); } diff --git a/fsw/cfe-core/src/es/cfe_es_apps.h b/fsw/cfe-core/src/es/cfe_es_apps.h index e9aaa7562..3be90f7cd 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.h +++ b/fsw/cfe-core/src/es/cfe_es_apps.h @@ -117,8 +117,8 @@ typedef struct /* * Extra information the pertains to applications only, not libraries. */ - cpusize StackSize; - uint16 Priority; + size_t StackSize; + CFE_ES_TaskPriority_Atom_t Priority; CFE_ES_ExceptionAction_Enum_t ExceptionAction; } CFE_ES_AppStartParams_t; @@ -227,9 +227,9 @@ int32 CFE_ES_AppCreate(CFE_ES_ResourceID_t *ApplicationIdPtr, const char *FileName, const char *EntryPointName, const char *AppName, - uint32 Priority, - uint32 StackSize, - uint32 ExceptionAction); + CFE_ES_TaskPriority_Atom_t Priority, + size_t StackSize, + CFE_ES_ExceptionAction_Enum_t ExceptionAction); /* ** Internal function to load a a new cFE shared Library */ diff --git a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c index 0f111a810..28653956c 100644 --- a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c +++ b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c @@ -43,7 +43,7 @@ #define CFE_ES_BACKGROUND_SEM_NAME "ES_BG_SEM" #define CFE_ES_BACKGROUND_CHILD_NAME "ES_BG_TASK" -#define CFE_ES_BACKGROUND_CHILD_STACK_PTR NULL +#define CFE_ES_BACKGROUND_CHILD_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE #define CFE_ES_BACKGROUND_CHILD_STACK_SIZE CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE #define CFE_ES_BACKGROUND_CHILD_PRIORITY CFE_PLATFORM_ES_PERF_CHILD_PRIORITY #define CFE_ES_BACKGROUND_CHILD_FLAGS 0 diff --git a/fsw/cfe-core/src/es/cfe_es_cds.c b/fsw/cfe-core/src/es/cfe_es_cds.c index 618e379a4..6d1485f81 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds.c +++ b/fsw/cfe-core/src/es/cfe_es_cds.c @@ -61,7 +61,8 @@ int32 CFE_ES_CDS_EarlyInit(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_Offset_t MinRequiredSize; + uint32 PlatformSize; + size_t MinRequiredSize; int32 Status; CFE_ES_Global.CDSIsAvailable = false; @@ -77,8 +78,9 @@ int32 CFE_ES_CDS_EarlyInit(void) CDS->LastCDSBlockId = CFE_ES_ResourceID_FromInteger(CFE_ES_CDSBLOCKID_BASE); - /* Get CDS size from OS BSP */ - Status = CFE_PSP_GetCDSSize(&CDS->TotalSize); + /* Get CDS size from PSP. Note that the PSP interface + * uses "uint32" for size here. */ + Status = CFE_PSP_GetCDSSize(&PlatformSize); if (Status != CFE_PSP_SUCCESS) { /* Error getting the size of the CDS from the BSP */ @@ -87,7 +89,7 @@ int32 CFE_ES_CDS_EarlyInit(void) } /* Always truncate the size to the nearest 4 byte boundary */ - CDS->TotalSize &= 0xfffffffc; + CDS->TotalSize = PlatformSize & 0xfffffffc; /* Compute the minimum size required for the CDS with the current configuration of the cFE */ MinRequiredSize = CDS_RESERVED_MIN_SIZE; @@ -200,8 +202,7 @@ CFE_ES_CDS_RegRec_t* CFE_ES_LocateCDSBlockRecordByID(CFE_ES_ResourceID_t BlockID * NOTE: For complete prolog information, see 'cfe_es_cds.h' */ /*******************************************************************/ -int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, - CFE_ES_CDS_Offset_t Offset, CFE_ES_CDS_Offset_t Size) +int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, size_t Offset, size_t Size) { int32 Status; @@ -269,7 +270,7 @@ int32 CFE_ES_CDS_CacheFlush(CFE_ES_CDS_AccessCache_t *Cache) * NOTE: For complete prolog information, see 'cfe_es_cds.h' */ /*******************************************************************/ -int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Source, CFE_ES_CDS_Offset_t Offset, CFE_ES_CDS_Offset_t Size) +int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Source, size_t Offset, size_t Size) { int32 Status; @@ -305,15 +306,15 @@ int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Sourc ** NOTE: For complete prolog information, see 'cfe_es_cds.h' ********************************************************************/ -int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, CFE_ES_CDS_Offset_t UserBlockSize, const char *Name, bool CriticalTbl) +int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, const char *Name, bool CriticalTbl) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; int32 Status; int32 RegUpdateStatus; CFE_ES_CDS_RegRec_t *RegRecPtr; - CFE_ES_MemOffset_t BlockOffset; - CFE_ES_MemOffset_t OldBlockSize; - CFE_ES_MemOffset_t NewBlockSize; + size_t BlockOffset; + size_t OldBlockSize; + size_t NewBlockSize; CFE_ES_ResourceID_t PendingBlockId; bool IsNewEntry; bool IsNewOffset; @@ -469,8 +470,8 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, CFE_ES_CDS_Offset_t Us int32 CFE_ES_ValidateCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_Offset_t TrailerOffset; - const CFE_ES_CDS_Offset_t SIG_CDS_SIZE = { CFE_ES_CDS_SIGNATURE_LEN }; + size_t TrailerOffset; + const size_t SIG_CDS_SIZE = { CFE_ES_CDS_SIGNATURE_LEN }; int32 Status; /* Perform 2 checks to validate the CDS Memory Pool */ @@ -519,7 +520,7 @@ int32 CFE_ES_ValidateCDS(void) int32 CFE_ES_ClearCDS(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_Offset_t RemainSize; + size_t RemainSize; int32 Status; /* Clear the CDS to ensure everything is gone */ @@ -564,7 +565,7 @@ int32 CFE_ES_ClearCDS(void) int32 CFE_ES_InitCDSSignatures(void) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; - CFE_ES_CDS_Offset_t SigOffset; + size_t SigOffset; int32 Status; /* Initialize the Validity Check strings */ @@ -844,7 +845,7 @@ int32 CFE_ES_DeleteCDS(const char *CDSName, bool CalledByTblServices) CFE_ES_ResourceID_t AppId; uint32 i; char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; - CFE_ES_MemOffset_t OldBlockSize; + size_t OldBlockSize; LogMessage[0] = 0; diff --git a/fsw/cfe-core/src/es/cfe_es_cds.h b/fsw/cfe-core/src/es/cfe_es_cds.h index 2f3ac1a63..5b6ff3132 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds.h +++ b/fsw/cfe-core/src/es/cfe_es_cds.h @@ -89,9 +89,12 @@ /* * Absolute Maximum Block size conceivably supportable by the implementation. * User-defined platform limits (in cfe_platform_cfg.h) may be lower, - * but this is a hard limit to avoid overflow of CFE_ES_CDS_Offset_t. + * but this is a hard limit to avoid overflow of a 32 bit integer. + * + * This ensures the size is safe for a PSP that uses 32 bit CDS offsets. + * (It is not anticipated that a CDS would need to exceed this size) */ -#define CDS_ABS_MAX_BLOCK_SIZE ((1 << ((8 * sizeof(CFE_ES_CDS_Offset_t))-2)) - sizeof(CFE_ES_CDS_BlockHeader_t)) +#define CDS_ABS_MAX_BLOCK_SIZE ((size_t)(1 << 30) - sizeof(CFE_ES_CDS_BlockHeader_t)) @@ -113,8 +116,8 @@ typedef struct * less than this. */ CFE_ES_ResourceID_t BlockID; /**< Abstract ID associated with this CDS block */ - CFE_ES_CDS_Offset_t BlockOffset; /**< Start offset of the block in CDS memory */ - CFE_ES_CDS_Offset_t BlockSize; /**< Size, in bytes, of the CDS memory block */ + size_t BlockOffset; /**< Start offset of the block in CDS memory */ + size_t BlockSize; /**< Size, in bytes, of the CDS memory block */ char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ } CFE_ES_CDS_RegRec_t; @@ -140,10 +143,10 @@ typedef union CFE_ES_CDS_AccessCacheData typedef struct CFE_ES_CDS_AccessCache { - CFE_ES_CDS_AccessCacheData_t Data; /**< Cached data (varies in size) */ - CFE_ES_CDS_Offset_t Offset; /**< The offset where Data is cached from */ - CFE_ES_CDS_Offset_t Size; /**< The size of cached Data */ - int32 AccessStatus; /**< The PSP status of the last read/write from CDS memory */ + CFE_ES_CDS_AccessCacheData_t Data; /**< Cached data (varies in size) */ + size_t Offset; /**< The offset where Data is cached from */ + size_t Size; /**< The size of cached Data */ + int32 AccessStatus; /**< The PSP status of the last read/write from CDS memory */ } CFE_ES_CDS_AccessCache_t; /** @@ -168,8 +171,8 @@ typedef struct CFE_ES_CDS_AccessCache_t Cache; osal_id_t GenMutex; /**< \brief Mutex that controls access to CDS and registry */ - CFE_ES_CDS_Offset_t TotalSize; /**< \brief Total size of the CDS as reported by BSP */ - CFE_ES_CDS_Offset_t DataSize; /**< \brief Size of actual user data pool */ + size_t TotalSize; /**< \brief Total size of the CDS as reported by BSP */ + size_t DataSize; /**< \brief Size of actual user data pool */ CFE_ES_ResourceID_t LastCDSBlockId; /**< \brief Last issued CDS block ID */ CFE_ES_CDS_RegRec_t Registry[CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES]; /**< \brief CDS Registry (Local Copy) */ } CFE_ES_CDS_Instance_t; @@ -221,7 +224,7 @@ typedef struct CFE_ES_CDS_PersistentTrailer * @returns #CFE_SUCCESS on success, or appropriate error code. */ int32 CFE_ES_CDS_CacheFetch(CFE_ES_CDS_AccessCache_t *Cache, - CFE_ES_CDS_Offset_t Offset, CFE_ES_CDS_Offset_t Size); + size_t Offset, size_t Size); /** @@ -264,7 +267,7 @@ int32 CFE_ES_CDS_CacheFlush(CFE_ES_CDS_AccessCache_t *Cache); * @returns #CFE_SUCCESS on success, or appropriate error code. */ int32 CFE_ES_CDS_CachePreload(CFE_ES_CDS_AccessCache_t *Cache, const void *Source, - CFE_ES_CDS_Offset_t Offset, CFE_ES_CDS_Offset_t Size); + size_t Offset, size_t Size); /** * @brief Get the registry array index correlating with a CDS block ID @@ -383,7 +386,7 @@ static inline bool CFE_ES_CDSBlockRecordIsMatch(const CFE_ES_CDS_RegRec_t *CDSBl * @param[in] CDSBlockRecPtr pointer to registry table entry * @returns Usable size of the CDS */ -static inline CFE_ES_MemOffset_t CFE_ES_CDSBlockRecordGetUserSize(const CFE_ES_CDS_RegRec_t *CDSBlockRecPtr) +static inline size_t CFE_ES_CDSBlockRecordGetUserSize(const CFE_ES_CDS_RegRec_t *CDSBlockRecPtr) { return (CDSBlockRecPtr->BlockSize - sizeof(CFE_ES_CDS_BlockHeader_t)); } diff --git a/fsw/cfe-core/src/es/cfe_es_cds_mempool.c b/fsw/cfe-core/src/es/cfe_es_cds_mempool.c index 53b9bf51c..a3acfc3a9 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds_mempool.c +++ b/fsw/cfe-core/src/es/cfe_es_cds_mempool.c @@ -58,7 +58,7 @@ -const CFE_ES_MemOffset_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = +const size_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = { CFE_PLATFORM_ES_CDS_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_CDS_MEM_BLOCK_SIZE_16, @@ -90,19 +90,14 @@ const CFE_ES_MemOffset_t CFE_ES_CDSMemPoolDefSize[CFE_ES_CDS_NUM_BLOCK_SIZES] = ** This is a bridge between the generic pool implementation and the CDS cache. */ int32 CFE_ES_CDS_PoolRetrieve(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, - CFE_ES_MemOffset_t Offset, + size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { CFE_ES_CDS_Instance_t *CDS = (CFE_ES_CDS_Instance_t *)GenPoolRecPtr; - CFE_ES_CDS_Offset_t CDSOffset; - CFE_ES_CDS_Offset_t CDSSize; - /* Type conversions */ - CDSOffset = Offset; - CDSSize = sizeof(CFE_ES_GenPoolBD_t); *BdPtr = &CDS->Cache.Data.Desc; - return CFE_ES_CDS_CacheFetch(&CDS->Cache, CDSOffset, CDSSize); + return CFE_ES_CDS_CacheFetch(&CDS->Cache, Offset, sizeof(CFE_ES_GenPoolBD_t)); } /* @@ -111,13 +106,12 @@ int32 CFE_ES_CDS_PoolRetrieve(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, ** This is a bridge between the generic pool implementation and the CDS cache. */ int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, - CFE_ES_MemOffset_t Offset, + size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { CFE_ES_CDS_Instance_t *CDS = (CFE_ES_CDS_Instance_t *)GenPoolRecPtr; - CFE_ES_CDS_CachePreload(&CDS->Cache, BdPtr, Offset, - sizeof(CFE_ES_GenPoolBD_t)); + CFE_ES_CDS_CachePreload(&CDS->Cache, BdPtr, Offset, sizeof(CFE_ES_GenPoolBD_t)); return CFE_ES_CDS_CacheFlush(&CDS->Cache); } @@ -131,12 +125,12 @@ int32 CFE_ES_CDS_PoolCommit(CFE_ES_GenPoolRecord_t *GenPoolRecPtr, ** where it is not possible to have contention writing into the syslog. ** Therefore the use of CFE_ES_SysLogWrite_Unsync() is acceptable */ -int32 CFE_ES_CreateCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t StartOffset) +int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; int32 Status; - CFE_ES_MemOffset_t SizeCheck; - CFE_ES_MemOffset_t ActualSize; + size_t SizeCheck; + size_t ActualSize; SizeCheck = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, 1); ActualSize = CDSPoolSize; @@ -173,7 +167,7 @@ int32 CFE_ES_CreateCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t ** where it is not possible to have contention writing into the syslog. ** Therefore the use of CFE_ES_SysLogWrite_Unsync() is acceptable */ -int32 CFE_ES_RebuildCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t StartOffset) +int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset) { CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; int32 Status; @@ -212,9 +206,9 @@ int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite) CFE_ES_CDS_Instance_t *CDS = &CFE_ES_Global.CDSVars; char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; int32 Status; - CFE_ES_MemOffset_t BlockSize; - CFE_ES_CDS_Offset_t UserDataSize; - CFE_ES_CDS_Offset_t UserDataOffset; + size_t BlockSize; + size_t UserDataSize; + size_t UserDataOffset; CFE_ES_CDS_RegRec_t *CDSRegRecPtr; /* Ensure the the log message is an empty string in case it is never written to */ @@ -311,9 +305,9 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) char LogMessage[CFE_ES_MAX_SYSLOG_MSG_SIZE]; int32 Status; uint32 CrcOfCDSData; - CFE_ES_MemOffset_t BlockSize; - CFE_ES_CDS_Offset_t UserDataSize; - CFE_ES_CDS_Offset_t UserDataOffset; + size_t BlockSize; + size_t UserDataSize; + size_t UserDataOffset; CFE_ES_CDS_RegRec_t *CDSRegRecPtr; /* Validate the handle before doing anything */ @@ -352,7 +346,7 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) /* Read the header */ Status = CFE_ES_CDS_CacheFetch(&CDS->Cache, CDSRegRecPtr->BlockOffset, - (CFE_ES_CDS_Offset_t){sizeof(CFE_ES_CDS_BlockHeader_t)} ); + sizeof(CFE_ES_CDS_BlockHeader_t)); if (Status == CFE_SUCCESS) { @@ -400,10 +394,14 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) ** Purpose: ** */ -uint32 CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport) +size_t CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport) { - return CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, + size_t ReqSize; + + ReqSize = CFE_ES_GenPoolCalcMinSize(CFE_ES_CDS_NUM_BLOCK_SIZES, CFE_ES_CDSMemPoolDefSize, MaxNumBlocksToSupport); + + return ReqSize; } diff --git a/fsw/cfe-core/src/es/cfe_es_cds_mempool.h b/fsw/cfe-core/src/es/cfe_es_cds_mempool.h index cbe0bcb11..abacf5a7e 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds_mempool.h +++ b/fsw/cfe-core/src/es/cfe_es_cds_mempool.h @@ -69,15 +69,14 @@ ** \return #CFE_SUCCESS \copydoc CFE_SUCCESS ** ******************************************************************************/ -int32 CFE_ES_CreateCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t StartOffset); +int32 CFE_ES_CreateCDSPool(size_t CDSPoolSize, size_t StartOffset); - -int32 CFE_ES_RebuildCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t StartOffset); +int32 CFE_ES_RebuildCDSPool(size_t CDSPoolSize, size_t StartOffset); int32 CFE_ES_CDSBlockWrite(CFE_ES_CDSHandle_t Handle, const void *DataToWrite); int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle); -uint32 CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport); +size_t CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport); #endif /* _cfe_es_cds_mempool_ */ diff --git a/fsw/cfe-core/src/es/cfe_es_generic_pool.c b/fsw/cfe-core/src/es/cfe_es_generic_pool.c index cbf451cbf..d8b76bcb1 100644 --- a/fsw/cfe-core/src/es/cfe_es_generic_pool.c +++ b/fsw/cfe-core/src/es/cfe_es_generic_pool.c @@ -60,7 +60,7 @@ ** Local Helper function to find the appropriate bucket given a requested block size **--------------------------------------------------------------------------------------- */ -uint16 CFE_ES_GenPoolFindBucket(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t ReqSize) +uint16 CFE_ES_GenPoolFindBucket(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t ReqSize) { uint16 Index; @@ -110,12 +110,12 @@ CFE_ES_GenPoolBucket_t *CFE_ES_GenPoolGetBucketState(CFE_ES_GenPoolRecord_t *Poo **--------------------------------------------------------------------------------------- */ int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - CFE_ES_MemOffset_t NewSize, CFE_ES_MemOffset_t *BlockOffsetPtr) + size_t NewSize, size_t *BlockOffsetPtr) { CFE_ES_GenPoolBucket_t *BucketPtr; - CFE_ES_MemOffset_t DescOffset; - CFE_ES_MemOffset_t BlockOffset; - CFE_ES_MemOffset_t NextOffset; + size_t DescOffset; + size_t BlockOffset; + size_t NextOffset; CFE_ES_GenPoolBD_t *BdPtr; uint16 RecycleBucketId; int32 Status; @@ -174,12 +174,12 @@ int32 CFE_ES_GenPoolRecyclePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 **--------------------------------------------------------------------------------------- */ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 BucketId, - CFE_ES_MemOffset_t NewSize, CFE_ES_MemOffset_t *BlockOffsetPtr) + size_t NewSize, size_t *BlockOffsetPtr) { CFE_ES_GenPoolBucket_t *BucketPtr; - CFE_ES_MemOffset_t DescOffset; - CFE_ES_MemOffset_t BlockOffset; - CFE_ES_MemOffset_t NextTailPosition; + size_t DescOffset; + size_t BlockOffset; + size_t NextTailPosition; CFE_ES_GenPoolBD_t *BdPtr; int32 Status; @@ -253,11 +253,11 @@ int32 CFE_ES_GenPoolCreatePoolBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 B */ int32 CFE_ES_GenPoolInitialize( CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t StartOffset, - CFE_ES_MemOffset_t PoolSize, - CFE_ES_MemOffset_t AlignSize, + size_t StartOffset, + size_t PoolSize, + size_t AlignSize, uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizeList, + const size_t *BlockSizeList, CFE_ES_PoolRetrieve_Func_t RetrieveFunc, CFE_ES_PoolCommit_Func_t CommitFunc) { @@ -350,12 +350,12 @@ int32 CFE_ES_GenPoolInitialize( ** ES Internal API - See Prototype for full API description **--------------------------------------------------------------------------------------- */ -CFE_ES_MemOffset_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizeList, +size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, + const size_t *BlockSizeList, uint32 NumBlocks) { uint16 BucketId; - CFE_ES_MemOffset_t MinBlockSize; + size_t MinBlockSize; MinBlockSize = 0; @@ -386,8 +386,8 @@ CFE_ES_MemOffset_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, **--------------------------------------------------------------------------------------- */ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockOffsetPtr, - CFE_ES_MemOffset_t ReqSize ) + size_t *BlockOffsetPtr, + size_t ReqSize ) { int32 Status; uint16 BucketId; @@ -421,10 +421,10 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, **--------------------------------------------------------------------------------------- */ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockSizePtr, - CFE_ES_MemOffset_t BlockOffset) + size_t *BlockSizePtr, + size_t BlockOffset) { - CFE_ES_MemOffset_t DescOffset; + size_t DescOffset; CFE_ES_GenPoolBucket_t *BucketPtr; CFE_ES_GenPoolBD_t *BdPtr; int32 Status; @@ -470,10 +470,10 @@ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, **--------------------------------------------------------------------------------------- */ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockSizePtr, - CFE_ES_MemOffset_t BlockOffset) + size_t *BlockSizePtr, + size_t BlockOffset) { - CFE_ES_MemOffset_t DescOffset; + size_t DescOffset; CFE_ES_GenPoolBucket_t *BucketPtr; CFE_ES_GenPoolBD_t *BdPtr; int32 Status; @@ -530,8 +530,8 @@ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr) { int32 Status; - CFE_ES_MemOffset_t DescOffset; - CFE_ES_MemOffset_t BlockOffset; + size_t DescOffset; + size_t BlockOffset; CFE_ES_GenPoolBucket_t *BucketPtr; CFE_ES_GenPoolBD_t *BdPtr; uint16 BucketId; @@ -660,11 +660,11 @@ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, { if (TotalSizeBuf != NULL) { - *TotalSizeBuf = PoolRecPtr->PoolTotalSize; + *TotalSizeBuf = CFE_ES_MEMOFFSET_C(PoolRecPtr->PoolTotalSize); } if (FreeSizeBuf != NULL) { - *FreeSizeBuf = PoolRecPtr->PoolMaxOffset - PoolRecPtr->TailPosition; + *FreeSizeBuf = CFE_ES_MEMOFFSET_C(PoolRecPtr->PoolMaxOffset - PoolRecPtr->TailPosition); } } @@ -718,7 +718,7 @@ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 Buc if (BlockStatsBuf != NULL) { BlockStatsBuf->NumCreated = BucketPtr->AllocationCount; - BlockStatsBuf->BlockSize = BucketPtr->BlockSize; + BlockStatsBuf->BlockSize = CFE_ES_MEMOFFSET_C(BucketPtr->BlockSize); BlockStatsBuf->NumFree = BucketPtr->ReleaseCount - BucketPtr->RecycleCount; } } diff --git a/fsw/cfe-core/src/es/cfe_es_generic_pool.h b/fsw/cfe-core/src/es/cfe_es_generic_pool.h index 6439f686c..2796ed1eb 100644 --- a/fsw/cfe-core/src/es/cfe_es_generic_pool.h +++ b/fsw/cfe-core/src/es/cfe_es_generic_pool.h @@ -62,15 +62,15 @@ typedef struct CFE_ES_GenPoolBD { uint16 CheckBits; /**< Set to a fixed bit pattern after init */ uint16 Allocated; /**< Set to a bit pattern depending on allocation state */ - CFE_ES_MemOffset_t ActualSize; /**< The actual requested size of the block */ - CFE_ES_MemOffset_t NextOffset; /**< The offset of the next descriptor in the free stack */ + size_t ActualSize; /**< The actual requested size of the block */ + size_t NextOffset; /**< The offset of the next descriptor in the free stack */ } CFE_ES_GenPoolBD_t; typedef struct CFE_ES_GenPoolBucket { - CFE_ES_MemOffset_t BlockSize; - CFE_ES_MemOffset_t FirstOffset; /**< Top of the "free stack" of buffers which have been returned */ + size_t BlockSize; + size_t FirstOffset; /**< Top of the "free stack" of buffers which have been returned */ uint32 AllocationCount; /**< Total number of buffers of this block size that exist (initial get) */ uint32 ReleaseCount; /**< Total number of buffers that have been released (put back) */ uint32 RecycleCount; /**< Total number of buffers that have been recycled (get after put) */ @@ -90,8 +90,7 @@ typedef struct CFE_ES_GenPoolRecord CFE_ES_GenPoolRecord_t; * pointer to the data instead of copying it. */ typedef int32 (*CFE_ES_PoolRetrieve_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t Offset, - CFE_ES_GenPoolBD_t **BdPtr); + size_t Offset, CFE_ES_GenPoolBD_t **BdPtr); /** * \brief Function to commit a buffer descriptor to the pool storage @@ -101,8 +100,7 @@ typedef int32 (*CFE_ES_PoolRetrieve_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, * storage. It may be a no-op for memory mapped pools. */ typedef int32 (*CFE_ES_PoolCommit_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t Offset, - const CFE_ES_GenPoolBD_t *BdPtr); + size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr); /** @@ -110,10 +108,10 @@ typedef int32 (*CFE_ES_PoolCommit_Func_t)(CFE_ES_GenPoolRecord_t *PoolRecPtr, */ struct CFE_ES_GenPoolRecord { - CFE_ES_MemOffset_t PoolTotalSize; /**< Total size of the pool area, in bytes */ - CFE_ES_MemOffset_t PoolMaxOffset; /**< End offset (position) of the pool */ - CFE_ES_MemOffset_t AlignMask; /**< Alignment mask applied to all new allocations */ - CFE_ES_MemOffset_t TailPosition; /**< Current high watermark of the pool, end of last allocation */ + size_t PoolTotalSize; /**< Total size of the pool area, in bytes */ + size_t PoolMaxOffset; /**< End offset (position) of the pool */ + size_t AlignMask; /**< Alignment mask applied to all new allocations */ + size_t TailPosition; /**< Current high watermark of the pool, end of last allocation */ CFE_ES_PoolRetrieve_Func_t Retrieve; /**< Function to access a buffer descriptor in the pool storage */ CFE_ES_PoolCommit_Func_t Commit; /**< Function to commit a buffer descriptor to the pool storage */ @@ -148,11 +146,11 @@ struct CFE_ES_GenPoolRecord * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t StartOffset, - CFE_ES_MemOffset_t PoolSize, - CFE_ES_MemOffset_t AlignSize, + size_t StartOffset, + size_t PoolSize, + size_t AlignSize, uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizeList, + const size_t *BlockSizeList, CFE_ES_PoolRetrieve_Func_t RetrieveFunc, CFE_ES_PoolCommit_Func_t CommitFunc); @@ -169,8 +167,8 @@ int32 CFE_ES_GenPoolInitialize(CFE_ES_GenPoolRecord_t *PoolRecPtr, * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockOffsetPtr, - CFE_ES_MemOffset_t ReqSize); + size_t *BlockOffsetPtr, + size_t ReqSize); /** * \brief Returns a block to the pool @@ -185,8 +183,8 @@ int32 CFE_ES_GenPoolGetBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ int32 CFE_ES_GenPoolPutBlock(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockSizePtr, - CFE_ES_MemOffset_t BlockOffset); + size_t *BlockSizePtr, + size_t BlockOffset); /** * \brief Rebuild list of free blocks in pool @@ -221,8 +219,8 @@ int32 CFE_ES_GenPoolRebuild(CFE_ES_GenPoolRecord_t *PoolRecPtr); * \return #CFE_SUCCESS, or error code \ref CFEReturnCodes */ int32 CFE_ES_GenPoolGetBlockSize(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *BlockSizePtr, - CFE_ES_MemOffset_t BlockOffset); + size_t *BlockSizePtr, + size_t BlockOffset); /** * \brief Validate a pool structure @@ -238,9 +236,16 @@ bool CFE_ES_GenPoolValidateState(const CFE_ES_GenPoolRecord_t *PoolRecPtr); /** * \brief Query basic usage of the pool structure * + * Obtain basic pool usage info for telemetry/statistics reporting. + * * \param[in] PoolRecPtr Pointer to pool structure * \param[out] FreeSizeBuf Buffer to store free size * \param[out] TotalSizeBuf Buffer to store total size + * + * \note This function is intended for telemetry purposes, so it + * uses the message size type (CFE_ES_MemOffset_t) rather + * than size_t, to be compatible with the type used in telemetry + * messages. */ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t *FreeSizeBuf, @@ -248,6 +253,8 @@ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, /** * \brief Query counters associated with the pool structure + * + * Obtain pool counters for telemetry/statistics reporting. * * \param[in] PoolRecPtr Pointer to pool structure * \param[out] NumBucketsBuf Buffer to store bucket count @@ -262,6 +269,8 @@ void CFE_ES_GenPoolGetCounts(CFE_ES_GenPoolRecord_t *PoolRecPtr, /** * \brief Query bucket-specific usage of the pool structure * + * Obtain pool per-bucket stats for telemetry/statistics reporting. + * * If the bucket number is not valid, this sets all output values to zero. * * \param[in] PoolRecPtr Pointer to pool structure @@ -288,8 +297,8 @@ void CFE_ES_GenPoolGetBucketUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, uint16 Buc * * \return Minimum size required for requested number of blocks. */ -CFE_ES_MemOffset_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizeList, +size_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, + const size_t *BlockSizeList, uint32 NumBlocks); #endif /* _cfe_es_generic_pool_ */ diff --git a/fsw/cfe-core/src/es/cfe_es_mempool.c b/fsw/cfe-core/src/es/cfe_es_mempool.c index d1d4d8042..9ccda8337 100644 --- a/fsw/cfe-core/src/es/cfe_es_mempool.c +++ b/fsw/cfe-core/src/es/cfe_es_mempool.c @@ -61,7 +61,7 @@ ** Type Definitions */ -const CFE_ES_MemOffset_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = +const size_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { CFE_PLATFORM_ES_MAX_BLOCK_SIZE, CFE_PLATFORM_ES_MEM_BLOCK_SIZE_16, @@ -87,7 +87,7 @@ const CFE_ES_MemOffset_t CFE_ES_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] ** Functions */ -int32 CFE_ES_MemPoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 CFE_ES_MemPoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { cpuaddr DataAddress; @@ -99,7 +99,7 @@ int32 CFE_ES_MemPoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_Me return CFE_SUCCESS; } -int32 CFE_ES_MemPoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 CFE_ES_MemPoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_SUCCESS; @@ -136,7 +136,7 @@ CFE_ES_MemPoolRecord_t* CFE_ES_LocateMemPoolRecordByID(CFE_ES_MemHandle_t PoolID */ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, - CFE_ES_MemOffset_t Size ) + size_t Size ) { return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0],CFE_ES_NO_MUTEX); @@ -147,7 +147,7 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, */ int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, - CFE_ES_MemOffset_t Size ) + size_t Size ) { return CFE_ES_PoolCreateEx(PoolID, MemPtr, Size, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, &CFE_ES_MemPoolDefSize[0],CFE_ES_USE_MUTEX); @@ -156,16 +156,16 @@ int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, - CFE_ES_MemOffset_t Size, + size_t Size, uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizes, - uint16 UseMutex ) + const size_t *BlockSizes, + bool UseMutex ) { int32 Status; CFE_ES_MemHandle_t PendingID; CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t Alignment; - CFE_ES_MemOffset_t MinimumSize; + size_t Alignment; + size_t MinimumSize; char MutexName[OS_MAX_API_NAME]; /* Sanity Check inputs */ @@ -182,13 +182,6 @@ int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, return(CFE_ES_BAD_ARGUMENT); } - if ((UseMutex != CFE_ES_USE_MUTEX) && (UseMutex != CFE_ES_NO_MUTEX)) - { - CFE_ES_WriteToSysLog("CFE_ES:poolCreate Invalid Mutex Usage Option (%d), must be %d or %d\n", - UseMutex, CFE_ES_NO_MUTEX, CFE_ES_USE_MUTEX); - return(CFE_ES_BAD_ARGUMENT); - } - /* * Use default block sizes if not specified */ @@ -399,12 +392,12 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID) */ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t Handle, - CFE_ES_MemOffset_t Size ) + size_t Size ) { int32 Status; CFE_ES_MemHandle_t AppId; CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t DataOffset; + size_t DataOffset; PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(Handle); @@ -466,8 +459,8 @@ int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, { int32 Status; CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t DataOffset; - CFE_ES_MemOffset_t DataSize; + size_t DataOffset; + size_t DataSize; PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(Handle); @@ -519,8 +512,8 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, uint32 * BufPtr) { CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t DataSize; - CFE_ES_MemOffset_t DataOffset; + size_t DataSize; + size_t DataOffset; int32 Status; PoolRecPtr = CFE_ES_LocateMemPoolRecordByID(Handle); diff --git a/fsw/cfe-core/src/es/cfe_es_perf.c b/fsw/cfe-core/src/es/cfe_es_perf.c index 6fce91de9..518e4b55f 100644 --- a/fsw/cfe-core/src/es/cfe_es_perf.c +++ b/fsw/cfe-core/src/es/cfe_es_perf.c @@ -274,7 +274,7 @@ bool CFE_ES_RunPerfLogDump(uint32 ElapsedTime, void *Arg) CFE_ES_PerfDumpGlobal_t *State = (CFE_ES_PerfDumpGlobal_t *)Arg; int32 Status; CFE_FS_Header_t FileHdr; - uint32 BlockSize; + size_t BlockSize; /* * each time this background job is re-entered after a time delay, diff --git a/fsw/cfe-core/src/es/cfe_es_perf.h b/fsw/cfe-core/src/es/cfe_es_perf.h index 38e53d848..74cd370e6 100644 --- a/fsw/cfe-core/src/es/cfe_es_perf.h +++ b/fsw/cfe-core/src/es/cfe_es_perf.h @@ -114,7 +114,7 @@ typedef struct uint32 WorkCredit; /* accumulator based on the passage of time */ uint32 StateCounter; /* number of blocks/items left in current state */ uint32 DataPos; /* last position within the Perf Log */ - uint32 FileSize; /* Total file size, for progress reporing in telemetry */ + size_t FileSize; /* Total file size, for progress reporing in telemetry */ } CFE_ES_PerfDumpGlobal_t; /* diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index 5f1f6e5dd..eeb0669d6 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -664,8 +664,8 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) CFE_ES_TaskData.HkPacket.Payload.CommandCounter = CFE_ES_TaskData.CommandCounter; CFE_ES_TaskData.HkPacket.Payload.CommandErrorCounter = CFE_ES_TaskData.CommandErrorCounter; - CFE_ES_TaskData.HkPacket.Payload.SysLogBytesUsed = CFE_ES_ResetDataPtr->SystemLogEndIdx; - CFE_ES_TaskData.HkPacket.Payload.SysLogSize = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; + CFE_ES_TaskData.HkPacket.Payload.SysLogBytesUsed = CFE_ES_MEMOFFSET_C(CFE_ES_ResetDataPtr->SystemLogEndIdx); + CFE_ES_TaskData.HkPacket.Payload.SysLogSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE); CFE_ES_TaskData.HkPacket.Payload.SysLogEntries = CFE_ES_ResetDataPtr->SystemLogEntryNum; CFE_ES_TaskData.HkPacket.Payload.SysLogMode = CFE_ES_ResetDataPtr->SystemLogMode; @@ -729,19 +729,20 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) stat = OS_HeapGetInfo(&HeapProp); - if(stat == OS_SUCCESS) - { - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = HeapProp.free_bytes; - CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = HeapProp.free_blocks; - CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = HeapProp.largest_free_block; - } - else + /* + * If retrieving info from OSAL was not successful, + * zero out the property struct, so all sizes will + * in turn be reported in telemetry as 0. + */ + if(stat != OS_SUCCESS) { - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = 0; - CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = 0; - CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = 0; + memset(&HeapProp, 0, sizeof(HeapProp)); } + CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_C(HeapProp.free_bytes); + CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_C(HeapProp.free_blocks); + CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = CFE_ES_MEMOFFSET_C(HeapProp.largest_free_block); + /* ** Send housekeeping telemetry packet. */ @@ -1646,10 +1647,10 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLog_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, size_t ExpectedLength) { bool result = true; - uint16 ActualLength = CFE_SB_GetTotalMsgLength(Msg); + size_t ActualLength = CFE_SB_GetTotalMsgLength(Msg); /* ** Verify the command packet length @@ -1880,7 +1881,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data) { /* Fill CDS Registry Dump Record with relevant information */ memset(&DumpRecord, 0, sizeof(DumpRecord)); - DumpRecord.Size = CFE_ES_CDSBlockRecordGetUserSize(RegRecPtr); + DumpRecord.Size = CFE_ES_MEMOFFSET_C(CFE_ES_CDSBlockRecordGetUserSize(RegRecPtr)); DumpRecord.Handle = CFE_ES_CDSBlockRecordGetID(RegRecPtr); DumpRecord.Table = RegRecPtr->Table; strncpy(DumpRecord.Name, RegRecPtr->Name, sizeof(DumpRecord.Name)-1); @@ -1954,7 +1955,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data) /* a byte count discrepancy has been*/ /* detected during the file write */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual) +void CFE_ES_FileWriteByteCntErr(const char *Filename,size_t Requested,size_t Actual) { CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID,CFE_EVS_EventType_ERROR, diff --git a/fsw/cfe-core/src/es/cfe_es_task.h b/fsw/cfe-core/src/es/cfe_es_task.h index 83e142ac8..199da59c2 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.h +++ b/fsw/cfe-core/src/es/cfe_es_task.h @@ -204,8 +204,8 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data); ** Message Handler Helper Functions */ bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle); -bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t msg, uint16 ExpectedLength); -void CFE_ES_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual); +bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t msg, size_t ExpectedLength); +void CFE_ES_FileWriteByteCntErr(const char *Filename,size_t Requested,size_t Actual); /*************************************************************************/ diff --git a/fsw/cfe-core/src/inc/cfe_es.h b/fsw/cfe-core/src/inc/cfe_es.h index 3e35221a3..28457d0bf 100644 --- a/fsw/cfe-core/src/inc/cfe_es.h +++ b/fsw/cfe-core/src/inc/cfe_es.h @@ -115,8 +115,22 @@ #define CFE_ES_CDS_BAD_HANDLE CFE_ES_RESOURCEID_UNDEFINED /** \} */ -#define CFE_ES_NO_MUTEX 0 /**< \brief Indicates that the memory pool selection will not use a semaphore */ -#define CFE_ES_USE_MUTEX 1 /**< \brief Indicates that the memory pool selection will use a semaphore */ +#define CFE_ES_NO_MUTEX false /**< \brief Indicates that the memory pool selection will not use a semaphore */ +#define CFE_ES_USE_MUTEX true /**< \brief Indicates that the memory pool selection will use a semaphore */ + +/** \name Task Stack Constants */ +/** \{ */ + +/** + * \brief Indicates that the stack for the child task should be dynamically allocated. + * + * This value may be supplied as the Stack Pointer argument to CFE_ES_ChildTaskCreate() + * to indicate that the stack should be dynamically allocated. + */ +#define CFE_ES_TASK_STACK_ALLOCATE NULL /* aka OS_TASK_STACK_ALLOCATE in proposed OSAL change */ +/** \} */ + + /*****************************************************************************/ @@ -130,6 +144,13 @@ typedef void (*CFE_ES_ChildTaskMainFuncPtr_t)(void); /**< \brief Required Prototype of Child Task Main Functions */ typedef int32 (*CFE_ES_LibraryEntryFuncPtr_t)(CFE_ES_ResourceID_t LibId); /**< \brief Required Prototype of Library Initialization Functions */ +/** + * @brief Type for the stack pointer of tasks. + * + * This type is used in the CFE ES task API. + */ +typedef void* CFE_ES_StackPointer_t; /* aka osal_stackptr_t in proposed OSAL change */ + /** * \brief Pool Alignement * @@ -782,7 +803,7 @@ CFE_Status_t CFE_ES_GetLibIDByName(CFE_ES_ResourceID_t *LibIdPtr, const char *Li ** \sa #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppInfo ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, uint32 BufferLength); +CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, size_t BufferLength); /*****************************************************************************/ /** @@ -812,7 +833,7 @@ CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, uint32 ** \sa #CFE_ES_GetLibIDByName ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetLibName(char *LibName, CFE_ES_ResourceID_t LibId, uint32 BufferLength); +CFE_Status_t CFE_ES_GetLibName(char *LibName, CFE_ES_ResourceID_t LibId, size_t BufferLength); /*****************************************************************************/ /** @@ -984,6 +1005,8 @@ CFE_Status_t CFE_ES_RegisterChildTask(void); ** ** \param[in] StackPtr A pointer to the location where the child task's stack pointer should start. ** NOTE: Not all underlying operating systems support this parameter. +** The CFE_ES_TASK_STACK_ALLOCATE constant may be passed to indicate that the +** stack should be dynamically allocated. ** ** \param[in] StackSize The number of bytes to allocate for the new task's stack. ** @@ -1003,9 +1026,9 @@ CFE_Status_t CFE_ES_RegisterChildTask(void); CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr, const char *TaskName, CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - uint32 *StackPtr, - uint32 StackSize, - uint32 Priority, + CFE_ES_StackPointer_t StackPtr, + size_t StackSize, + CFE_ES_TaskPriority_Atom_t Priority, uint32 Flags); /*****************************************************************************/ @@ -1061,7 +1084,7 @@ CFE_Status_t CFE_ES_GetTaskIDByName(CFE_ES_ResourceID_t *TaskIdPtr, const char * ** \sa #CFE_ES_GetTaskIDByName ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_ResourceID_t TaskId, uint32 BufferLength); +CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_ResourceID_t TaskId, size_t BufferLength); /*****************************************************************************/ /** @@ -1161,7 +1184,7 @@ CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1,2) ** \return The result of the CRC calculation on the specified memory block, or error code \ref CFEReturnCodes ** ******************************************************************************/ -uint32 CFE_ES_CalculateCRC(const void *DataPtr, uint32 DataLength, uint32 InputCRC, uint32 TypeCRC); +uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC); /*****************************************************************************/ /** @@ -1218,7 +1241,7 @@ void CFE_ES_ProcessAsyncEvent(void); ** \sa #CFE_ES_CopyToCDS, #CFE_ES_RestoreFromCDS ** ******************************************************************************/ -CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, CFE_ES_CDS_Offset_t BlockSize, const char *Name); +CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, size_t BlockSize, const char *Name); /*****************************************************************************/ /** @@ -1273,7 +1296,7 @@ CFE_Status_t CFE_ES_GetCDSBlockIDByName(CFE_ES_ResourceID_t *BlockIdPtr, const c ** \sa #CFE_ES_GetCDSBlockIDByName ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_ResourceID_t BlockId, uint32 BufferLength); +CFE_Status_t CFE_ES_GetCDSBlockName(char *BlockName, CFE_ES_ResourceID_t BlockId, size_t BufferLength); /*****************************************************************************/ @@ -1362,7 +1385,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, CFE_ES_MemOffset_t Size); +CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size); /*****************************************************************************/ /** @@ -1391,7 +1414,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, C ** \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, CFE_ES_MemOffset_t Size); +CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size); /*****************************************************************************/ /** @@ -1431,10 +1454,10 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, CFE_ES ******************************************************************************/ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, - CFE_ES_MemOffset_t Size, + size_t Size, uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizes, - uint16 UseMutex ); + const size_t *BlockSizes, + bool UseMutex ); /*****************************************************************************/ @@ -1485,7 +1508,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID); ** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_GetPoolBufInfo ** ******************************************************************************/ -int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, CFE_ES_MemOffset_t Size); +int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size); /*****************************************************************************/ /** @@ -1792,7 +1815,7 @@ CFE_Status_t CFE_ES_GetGenCounterIDByName(CFE_ES_ResourceID_t *CounterIdPtr, con ** \sa #CFE_ES_GetGenCounterIDByName ** ******************************************************************************/ -CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_ResourceID_t CounterId, uint32 BufferLength); +CFE_Status_t CFE_ES_GetGenCounterName(char *CounterName, CFE_ES_ResourceID_t CounterId, size_t BufferLength); /**@}*/ diff --git a/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h b/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h index a230b7c90..d03927dad 100644 --- a/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h +++ b/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h @@ -364,10 +364,20 @@ typedef CFE_ES_ResourceID_t CFE_ES_MemHandle_t; typedef CFE_ES_ResourceID_t CFE_ES_CDSHandle_t; /** - * @brief Type used for memory sizes and offsets + * @brief Type used for task priority in CFE ES as + * including the commands/telemetry messages. + * + * @note the valid range is only 0-255 (same as OSAL) but + * a wider type is used for backward compatibility + * in binary formats of messages. + */ +typedef uint16 CFE_ES_TaskPriority_Atom_t; + +/** + * @brief Type used for memory sizes and offsets in commands and telemetry * * For backward compatibility with existing CFE code this should be uint32, - * but pools and other data structures will be limited to 4GB in size as a result. + * but all telemetry information will be limited to 4GB in size as a result. * * On 64-bit platforms this can be a 64-bit value which will allow larger * memory objects, but this will break compatibility with existing control @@ -375,11 +385,17 @@ typedef CFE_ES_ResourceID_t CFE_ES_CDSHandle_t; * * In either case this must be an unsigned type. */ -typedef uint32 CFE_ES_MemOffset_t; +typedef uint32 CFE_ES_MemOffset_t; + +/* + * A converter macro to use when initializing an CFE_ES_MemOffset_t + * from an integer value of a different type. + */ +#define CFE_ES_MEMOFFSET_C(x) ((CFE_ES_MemOffset_t)(x)) /** - * @brief Type used for memory addresses + * @brief Type used for memory addresses in command and telemetry messages * * For backward compatibility with existing CFE code this should be uint32, * but if running on a 64-bit platform, addresses in telemetry will be @@ -396,26 +412,18 @@ typedef uint32 CFE_ES_MemOffset_t; * converts to the native "cpuaddr" type provided by OSAL. This macro * provides independence between the message representation and local * representation of a memory address. - * - * @sa #CFE_SB_SET_MEMADDR, #CFE_SB_GET_MEMADDR */ typedef uint32 CFE_ES_MemAddress_t; -/** - * @brief Type used for CDS sizes and offsets. - * - * This must match the type used in the PSP CDS API, e.g.: - * CFE_PSP_GetCDSSize() - * CFE_PSP_WriteToCDS() - * CFE_PSP_ReadFromCDS() - * - * It is defined separately from the CFE_ES_MemOffset_t as the type used in - * the PSP CDS access API may be different than the ES Pool API. +/* + * A converter macro to use when initializing an CFE_ES_MemAddress_t + * from a pointer value of a different type. * - * In either case this must be an unsigned type. + * @note on a 64 bit platform, this macro will truncate the address such + * that it will fit into a 32-bit telemetry field. Obviously, the resulting + * value is no longer usable as a memory address after this. */ -typedef uint32 CFE_ES_CDS_Offset_t; - +#define CFE_ES_MEMADDRESS_C(x) ((CFE_ES_MemAddress_t)((cpuaddr)(x) & 0xFFFFFFFF)) #endif /* CFE_EDS_ENABLED_BUILD */ diff --git a/fsw/cfe-core/src/inc/cfe_es_msg.h b/fsw/cfe-core/src/inc/cfe_es_msg.h index 5f6b71ff3..28a0efc4a 100644 --- a/fsw/cfe-core/src/inc/cfe_es_msg.h +++ b/fsw/cfe-core/src/inc/cfe_es_msg.h @@ -1169,13 +1169,13 @@ typedef struct CFE_ES_StartAppCmd_Payload char AppFileName[CFE_MISSION_MAX_PATH_LEN]; /**< \brief Full path and filename of Application's executable image */ - uint32 StackSize; /**< \brief Desired stack size for the new application */ + CFE_ES_MemOffset_t StackSize; /**< \brief Desired stack size for the new application */ - uint16 ExceptionAction; /**< \brief #CFE_ES_ExceptionAction_RESTART_APP=On exception, + CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \brief #CFE_ES_ExceptionAction_RESTART_APP=On exception, restart Application, #CFE_ES_ExceptionAction_PROC_RESTART=On exception, perform a Processor Reset */ - uint16 Priority; /**< \brief The new Applications runtime priority. */ + CFE_ES_TaskPriority_Atom_t Priority; /**< \brief The new Applications runtime priority. */ } CFE_ES_StartAppCmd_Payload_t; @@ -1424,10 +1424,10 @@ typedef struct CFE_ES_AppInfo \brief The BSS Size of the Application */ CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR \brief The Start Address of the Application */ - uint16 ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN + CFE_ES_ExceptionAction_Enum_t ExceptionAction; /**< \cfetlmmnemonic \ES_EXCEPTNACTN \brief What should occur if Application has an exception (Restart Application OR Restart Processor) */ - uint16 Priority; /**< \cfetlmmnemonic \ES_PRIORITY + CFE_ES_TaskPriority_Atom_t Priority; /**< \cfetlmmnemonic \ES_PRIORITY \brief The Priority of the Application */ CFE_ES_ResourceID_t MainTaskId; /**< \cfetlmmnemonic \ES_MAINTASKID \brief The Application's Main Task ID */ @@ -1475,7 +1475,7 @@ typedef struct CFE_ES_TaskInfo typedef struct CFE_ES_CDSRegDumpRec { CFE_ES_CDSHandle_t Handle; /**< \brief Handle of CDS */ - CFE_ES_CDS_Offset_t Size; /**< \brief Size, in bytes, of the CDS memory block */ + CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of the CDS memory block */ bool Table; /**< \brief Flag that indicates whether CDS contains a Critical Table */ char Name[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; /**< \brief Processor Unique Name of CDS */ uint8 ByteAlignSpare[3]; /**< \brief Spare bytes to ensure structure size is multiple of 4 bytes */ @@ -1582,9 +1582,9 @@ typedef struct CFE_ES_HousekeepingTlm_Payload uint8 OSALMissionRevision;/**< \cfetlmmnemonic \ES_OSMISSIONREV \brief OS Abstraction Layer MissionRevision Number */ - uint32 SysLogBytesUsed; /**< \cfetlmmnemonic \ES_SYSLOGBYTEUSED + CFE_ES_MemOffset_t SysLogBytesUsed; /**< \cfetlmmnemonic \ES_SYSLOGBYTEUSED \brief Total number of bytes used in system log */ - uint32 SysLogSize; /**< \cfetlmmnemonic \ES_SYSLOGSIZE + CFE_ES_MemOffset_t SysLogSize; /**< \cfetlmmnemonic \ES_SYSLOGSIZE \brief Total size of the system log */ uint32 SysLogEntries; /**< \cfetlmmnemonic \ES_SYSLOGENTRIES \brief Number of entries in the system log */ @@ -1634,11 +1634,11 @@ typedef struct CFE_ES_HousekeepingTlm_Payload \brief Number of Entries Put Into the Performance Analyzer Log */ uint32 PerfDataToWrite; /**< \cfetlmmnemonic \ES_PERFDATA2WRITE \brief Number of Performance Analyzer Log Entries Left to be Written to Log Dump File */ - uint32 HeapBytesFree; /**< \cfetlmmnemonic \ES_HEAPBYTESFREE + CFE_ES_MemOffset_t HeapBytesFree; /**< \cfetlmmnemonic \ES_HEAPBYTESFREE \brief Number of free bytes remaining in the OS heap */ - uint32 HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE + CFE_ES_MemOffset_t HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE \brief Number of free blocks remaining in the OS heap */ - uint32 HeapMaxBlockSize; /**< \cfetlmmnemonic \ES_HEAPMAXBLK + CFE_ES_MemOffset_t HeapMaxBlockSize; /**< \cfetlmmnemonic \ES_HEAPMAXBLK \brief Number of bytes in the largest free block */ } CFE_ES_HousekeepingTlm_Payload_t; diff --git a/fsw/cfe-core/src/inc/private/cfe_private.h b/fsw/cfe-core/src/inc/private/cfe_private.h index 727c9f62b..a2f1b0152 100644 --- a/fsw/cfe-core/src/inc/private/cfe_private.h +++ b/fsw/cfe-core/src/inc/private/cfe_private.h @@ -303,7 +303,7 @@ extern int32 CFE_TIME_CleanUpApp(CFE_ES_ResourceID_t AppId); ** \return See return codes for #CFE_ES_RegisterCDS ** ******************************************************************************/ -int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, CFE_ES_CDS_Offset_t UserBlockSize, const char *Name, bool CriticalTbl); +int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize, const char *Name, bool CriticalTbl); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index b0416ad2a..1fb73a022 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -42,6 +42,18 @@ #define ES_UT_CDS_BLOCK_SIZE 16 +/* + * A size which meets the minimum CDS size + * requirements for the implementation, but + * not much larger. + */ +#define ES_UT_CDS_SMALL_TEST_SIZE (56 * 1024) + +/* + * A size which has room for actual allocations + */ +#define ES_UT_CDS_LARGE_TEST_SIZE (128 * 1024) + extern CFE_ES_PerfData_t *Perf; extern CFE_ES_Global_t CFE_ES_Global; extern CFE_ES_TaskData_t CFE_ES_TaskData; @@ -261,7 +273,7 @@ void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_ CFE_ES_AppRecord_t *LocalAppPtr; CFE_ES_TaskRecord_t *LocalTaskPtr; - OS_TaskCreate(&UtOsalId, "UT", NULL, NULL, 0, 0, 0); + OS_TaskCreate(&UtOsalId, "UT", NULL, OSAL_TASK_STACK_ALLOCATE, 0, 0, 0); UtTaskId = CFE_ES_ResourceID_FromOSAL(UtOsalId); UtAppId = CFE_ES_Global.LastAppId; CFE_ES_Global.LastAppId = CFE_ES_ResourceID_FromInteger( @@ -302,6 +314,9 @@ void ES_UT_SetupSingleAppId(CFE_ES_AppType_Enum_t AppType, CFE_ES_AppState_Enum_ if (AppType == CFE_ES_AppType_EXTERNAL) { ++CFE_ES_Global.RegisteredExternalApps; + + OS_ModuleLoad(&UtOsalId, NULL, NULL, 0); + LocalAppPtr->ModuleInfo.ModuleId = UtOsalId; } ++CFE_ES_Global.RegisteredTasks; } @@ -320,7 +335,7 @@ void ES_UT_SetupChildTaskId(const CFE_ES_AppRecord_t *ParentApp, const char *Tas UtAppId = CFE_ES_AppRecordGetID(ParentApp); - OS_TaskCreate(&UtOsalId, "C", NULL, NULL, 0, 0, 0); + OS_TaskCreate(&UtOsalId, "C", NULL, OSAL_TASK_STACK_ALLOCATE, 0, 0, 0); UtTaskId = CFE_ES_ResourceID_FromOSAL(UtOsalId); LocalTaskPtr = CFE_ES_LocateTaskRecordByID(UtTaskId); @@ -373,20 +388,20 @@ void ES_UT_SetupSingleLibId(const char *LibName, CFE_ES_LibRecord_t **OutLibRec) ++CFE_ES_Global.RegisteredLibs; } -int32 ES_UT_PoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_PoolDirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { *BdPtr = (CFE_ES_GenPoolBD_t*)((void*)&UT_MemPoolDirectBuffer.Data[Offset]); return CFE_SUCCESS; } -int32 ES_UT_PoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_PoolDirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_SUCCESS; } -int32 ES_UT_PoolIndirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_PoolIndirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { memcpy(&UT_MemPoolIndirectBuffer.BD, &UT_MemPoolIndirectBuffer.Data[Offset], sizeof(CFE_ES_GenPoolBD_t)); @@ -394,14 +409,14 @@ int32 ES_UT_PoolIndirectRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemO return CFE_SUCCESS; } -int32 ES_UT_PoolIndirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_PoolIndirectCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { memcpy(&UT_MemPoolIndirectBuffer.Data[Offset], BdPtr, sizeof(CFE_ES_GenPoolBD_t)); return CFE_SUCCESS; } -int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, CFE_ES_GenPoolBD_t **BdPtr) { static CFE_ES_GenPoolBD_t BdBuf; @@ -410,7 +425,7 @@ int32 ES_UT_CDSPoolRetrieve(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset return CFE_PSP_ReadFromCDS(&BdBuf, Offset, sizeof(BdBuf)); } -int32 ES_UT_CDSPoolCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, CFE_ES_MemOffset_t Offset, +int32 ES_UT_CDSPoolCommit(CFE_ES_GenPoolRecord_t *PoolRecPtr, size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr) { return CFE_PSP_WriteToCDS(BdPtr, Offset, sizeof(*BdPtr)); @@ -468,13 +483,13 @@ void ES_UT_SetupCDSGlobal(uint32 CDS_Size) } -void ES_UT_SetupSingleCDSRegistry(const char *CDSName, CFE_ES_MemOffset_t BlockSize, bool IsTable, +void ES_UT_SetupSingleCDSRegistry(const char *CDSName, size_t BlockSize, bool IsTable, CFE_ES_CDS_RegRec_t **OutRegRec) { CFE_ES_CDS_RegRec_t *LocalRegRecPtr; CFE_ES_ResourceID_t UtCDSID; CFE_ES_GenPoolBD_t LocalBD; - uint32 UT_CDS_BufferSize; + size_t UT_CDS_BufferSize; /* first time this is done, set up the global */ @@ -554,7 +569,7 @@ int32 ES_UT_SetupOSCleanupHook(void *UserObj, int32 StubRetcode, */ if (CallCount == 0) { - OS_TaskCreate(&ObjList[0], NULL, NULL, NULL, 0, 0, 0); + OS_TaskCreate(&ObjList[0], NULL, NULL, OSAL_TASK_STACK_ALLOCATE, 0, 0, 0); OS_QueueCreate(&ObjList[1], NULL, 0, 0, 0); OS_MutSemCreate(&ObjList[2], NULL, 0); OS_BinSemCreate(&ObjList[3], NULL, 0, 0); @@ -1494,7 +1509,6 @@ void TestApps(void) UtAppRecPtr->StartParams.Priority = 255; UtAppRecPtr->StartParams.StackSize = 8192; UtAppRecPtr->StartParams.ExceptionAction = 0; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1511,7 +1525,6 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1527,7 +1540,6 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1543,7 +1555,6 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1558,7 +1569,6 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1574,7 +1584,6 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1590,7 +1599,6 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1614,7 +1622,6 @@ void TestApps(void) UtAppRecPtr->StartParams.Priority = 255; UtAppRecPtr->StartParams.StackSize = 8192; UtAppRecPtr->StartParams.ExceptionAction = 0; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1632,7 +1639,6 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1655,7 +1661,6 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1678,7 +1683,6 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1701,7 +1705,6 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1726,7 +1729,6 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1795,7 +1797,6 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupForOSCleanup(); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1809,7 +1810,6 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); @@ -1824,7 +1824,6 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, @@ -1837,7 +1836,6 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, @@ -2009,12 +2007,10 @@ void TestApps(void) ES_ResetUnitTest(); /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Setup a second entry which will NOT be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); ES_UT_SetupMemPoolId(&UtPoolRecPtr); UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -2037,7 +2033,6 @@ void TestApps(void) ES_ResetUnitTest(); /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); ES_UT_SetupMemPoolId(&UtPoolRecPtr); UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); UtPoolRecPtr->PoolID = CFE_ES_ResourceID_FromInteger(99999); /* Mismatch */ @@ -2058,10 +2053,8 @@ void TestApps(void) /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Setup a second entry which will NOT be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); @@ -2116,9 +2109,6 @@ void TestApps(void) /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); - - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, "UT", - "ut-module", 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(Id) == CFE_SUCCESS && @@ -2385,19 +2375,19 @@ void TestGenericPool(void) { CFE_ES_GenPoolRecord_t Pool1; CFE_ES_GenPoolRecord_t Pool2; - CFE_ES_MemOffset_t Offset1; - CFE_ES_MemOffset_t Offset2; - CFE_ES_MemOffset_t Offset3; - CFE_ES_MemOffset_t Offset4; - CFE_ES_MemOffset_t OffsetEnd; - CFE_ES_MemOffset_t BlockSize; + size_t Offset1; + size_t Offset2; + size_t Offset3; + size_t Offset4; + size_t OffsetEnd; + size_t BlockSize; CFE_ES_MemOffset_t FreeSize; CFE_ES_MemOffset_t TotalSize; uint16 NumBlocks; uint32 CountBuf; uint32 ErrBuf; CFE_ES_BlockStats_t BlockStats; - static const CFE_ES_MemOffset_t UT_POOL_BLOCK_SIZES[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = + static const size_t UT_POOL_BLOCK_SIZES[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { /* * These are intentionally in a mixed order @@ -2871,7 +2861,7 @@ void TestTask(void) memset(CmdBuf.StartAppCmd.Payload.Application, 'x', sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 8192; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(8192); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2900,7 +2890,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 12096; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2919,7 +2909,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 12096; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2938,7 +2928,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 12096; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2957,7 +2947,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 12096; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = 255; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2976,7 +2966,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = 0; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(0); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -2995,7 +2985,7 @@ void TestTask(void) strncpy((char *) CmdBuf.StartAppCmd.Payload.Application, "appName", sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.Priority = 1000; - CmdBuf.StartAppCmd.Payload.StackSize = 12096; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); @@ -3753,7 +3743,7 @@ void TestTask(void) sizeof(CmdBuf.StartAppCmd.Payload.Application)); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; CmdBuf.StartAppCmd.Payload.Priority = 160; - CmdBuf.StartAppCmd.Payload.StackSize = CFE_PLATFORM_ES_DEFAULT_STACK_SIZE; + CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_DEFAULT_STACK_SIZE); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t), UT_TPID_CFE_ES_CMD_START_APP_CC); UT_Report(__FILE__, __LINE__, @@ -5390,7 +5380,7 @@ void TestGenericCounterAPI(void) void TestCDS() { - uint32 CdsSize; + size_t CdsSize; uint8 *CdsPtr; char CDSName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN + 4]; CFE_ES_CDSHandle_t CDSHandle; @@ -5470,7 +5460,7 @@ void TestCDS() /* Test CDS registering with a write CDS failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, @@ -5482,7 +5472,7 @@ void TestCDS() /* Test successful CDS registering */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", @@ -5525,7 +5515,7 @@ void TestCDS() /* Test CDS registering with all the CDS registries taken */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); /* Set all the CDS registries to 'taken' */ UtCDSRegRecPtr = CFE_ES_Global.CDSVars.Registry; @@ -5579,7 +5569,7 @@ void TestCDS() /* Test CDS registering using a name longer than the maximum allowed */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); for (i = 0; i < CFE_MISSION_ES_CDS_MAX_NAME_LENGTH + 1; i++) { @@ -5748,7 +5738,7 @@ void TestCDS() * To prepare for the rebuild tests, set up a clean area in PSP mem, * and make a registry entry. */ - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); ES_UT_SetupSingleCDSRegistry("UT", 8, false, &UtCDSRegRecPtr); UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCDSRegRecPtr->BlockSize); @@ -5807,7 +5797,7 @@ void TestCDS() /* * To prepare for the rebuild tests, set up a clean area in PSP mem */ - ES_UT_SetupCDSGlobal(128 * 1024); + ES_UT_SetupCDSGlobal(ES_UT_CDS_LARGE_TEST_SIZE); /* Test CDS initialization where rebuilding the CDS is successful */ ES_ResetUnitTest(); @@ -5871,9 +5861,9 @@ void TestCDSMempool(void) CFE_ES_CDS_RegRec_t *UtCdsRegRecPtr; int Data; CFE_ES_ResourceID_t BlockHandle; - CFE_ES_CDS_Offset_t SavedSize; - CFE_ES_CDS_Offset_t SavedOffset; - uint8 *CdsPtr; + size_t SavedSize; + size_t SavedOffset; + uint8 *CdsPtr; UtPrintf("Begin Test CDS memory pool"); @@ -5898,7 +5888,7 @@ void TestCDSMempool(void) * a freed block in the pool. Then attempt to rebuild. */ ES_ResetUnitTest(); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); SavedSize = CFE_ES_Global.CDSVars.TotalSize; SavedOffset = CFE_ES_Global.CDSVars.Pool.TailPosition; ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), @@ -5939,7 +5929,7 @@ void TestCDSMempool(void) /* Test CDS block access */ ES_ResetUnitTest(); - ES_UT_SetupCDSGlobal(50000); + ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); ES_UT_SetupSingleCDSRegistry("UT", sizeof(Data) + sizeof(CFE_ES_CDS_BlockHeader_t), false, &UtCdsRegRecPtr); BlockHandle = CFE_ES_CDSBlockRecordGetID(UtCdsRegRecPtr); @@ -6045,7 +6035,7 @@ void TestESMempool(void) uint32 *addressp2 = NULL; /* Pool 2 buffer address */ CFE_ES_MemPoolRecord_t *PoolPtr; CFE_ES_MemPoolStats_t Stats; - CFE_ES_MemOffset_t BlockSizes[CFE_PLATFORM_ES_POOL_MAX_BUCKETS+2]; + size_t BlockSizes[CFE_PLATFORM_ES_POOL_MAX_BUCKETS+2]; CFE_ES_GenPoolBD_t *BdPtr; uint32 i; @@ -6265,17 +6255,6 @@ void TestESMempool(void) "CFE_ES_PoolCreateEx", "Use default block sizes when none are given"); - /* Test initializing a pre-allocated pool using an invalid mutex option */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, - Buffer1, - sizeof(Buffer1), - CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, - BlockSizes, - 2) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", - "Invalid mutex option"); - /* * Test creating a memory pool after the limit reached (no slots) */ diff --git a/fsw/cfe-core/ut-stubs/ut_es_stubs.c b/fsw/cfe-core/ut-stubs/ut_es_stubs.c index e0212fff1..6bd242975 100644 --- a/fsw/cfe-core/ut-stubs/ut_es_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_es_stubs.c @@ -108,13 +108,13 @@ ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr, - const char *TaskName, - CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, - uint32 *StackPtr, - uint32 StackSize, - uint32 Priority, - uint32 Flags) +CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_ResourceID_t *TaskIdPtr, + const char *TaskName, + CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr, + CFE_ES_StackPointer_t StackPtr, + size_t StackSize, + CFE_ES_TaskPriority_Atom_t Priority, + uint32 Flags) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_ES_CreateChildTask), TaskName); @@ -157,8 +157,8 @@ int32 CFE_ES_GetAppID(CFE_ES_ResourceID_t *AppIdPtr) int32 status; CFE_ES_ResourceID_t *IdBuff; - uint32 BuffSize; - uint32 Position; + size_t BuffSize; + size_t Position; status = UT_DEFAULT_IMPL(CFE_ES_GetAppID); @@ -189,8 +189,8 @@ int32 CFE_ES_GetTaskID(CFE_ES_ResourceID_t *TaskIdPtr) int32 status; CFE_ES_ResourceID_t *IdBuff; - uint32 BuffSize; - uint32 Position; + size_t BuffSize; + size_t Position; status = UT_DEFAULT_IMPL(CFE_ES_GetTaskID); @@ -241,8 +241,8 @@ int32 CFE_ES_GetAppIDByName(CFE_ES_ResourceID_t *AppIdPtr, const char *AppName) UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppIdPtr); UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppIDByName), AppName); - uint32 UserBuffSize; - uint32 BuffPosition; + size_t UserBuffSize; + size_t BuffPosition; const char *NameBuff; CFE_ES_ResourceID_t *IdBuff; int32 status; @@ -297,14 +297,14 @@ int32 CFE_ES_GetAppIDByName(CFE_ES_ResourceID_t *AppIdPtr, const char *AppName) ** Returns CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, uint32 BufferLength) +CFE_Status_t CFE_ES_GetAppName(char *AppName, CFE_ES_ResourceID_t AppId, size_t BufferLength) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetAppName), AppName); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), AppId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetAppName), BufferLength); - uint32 UserBuffSize; - uint32 BuffPosition; + size_t UserBuffSize; + size_t BuffPosition; const char *NameBuff; int32 status; @@ -451,9 +451,7 @@ int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) ** value (0xffffffff if Size exceeds maximum value allowed). ** ******************************************************************************/ -int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, - CFE_ES_MemHandle_t PoolID, - CFE_ES_MemOffset_t Size) +int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_GetPoolBuf), BufPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_GetPoolBuf), PoolID); @@ -466,9 +464,9 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, uint8 Bytes[CFE_UT_ES_POOL_STATIC_BLOCK_SIZE]; } Buffer; - uint32 PoolSize; - uint32 PositionStart; - uint32 PositionEnd; + size_t PoolSize; + size_t PositionStart; + size_t PositionEnd; void *PoolPtr; cpuaddr BufAddrStart; cpuaddr BufAddrEnd; @@ -561,7 +559,7 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, ** Returns either a user-defined status flag or OS_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, CFE_ES_MemOffset_t Size) +CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), PoolID); UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), MemPtr); @@ -594,9 +592,7 @@ int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, CFE_ES_MemOff ** Returns OS_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - CFE_ES_MemOffset_t Size) +CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), PoolID); UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), MemPtr); @@ -634,12 +630,12 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, - uint8 *MemPtr, - CFE_ES_MemOffset_t Size, - uint16 NumBlockSizes, - const CFE_ES_MemOffset_t *BlockSizes, - uint16 UseMutex ) +CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, + uint8 *MemPtr, + size_t Size, + uint16 NumBlockSizes, + const size_t *BlockSizes, + bool UseMutex ) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), PoolID); UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), MemPtr); @@ -777,10 +773,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit) ** Returns either a user-defined status flag or CFE_SUCCESS. ** ******************************************************************************/ -uint32 CFE_ES_CalculateCRC(const void *DataPtr, - uint32 DataLength, - uint32 InputCRC, - uint32 TypeCRC) +uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_CalculateCRC), DataPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CalculateCRC), DataLength); @@ -889,7 +882,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus) int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) { int32 status; - uint32 CdsBufferSize; + size_t CdsBufferSize; UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_CopyToCDS), Handle); UT_Stub_RegisterContext(UT_KEY(CFE_ES_CopyToCDS), DataToCopy); @@ -931,7 +924,7 @@ int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy) int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) { int32 status; - uint32 CdsBufferSize; + size_t CdsBufferSize; UT_Stub_RegisterContext(UT_KEY(CFE_ES_RestoreFromCDS), RestoreToMemory); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_RestoreFromCDS), Handle); @@ -971,7 +964,7 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) ** ******************************************************************************/ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, - CFE_ES_CDS_Offset_t UserBlockSize, + size_t UserBlockSize, const char *Name, bool CriticalTbl) { @@ -1112,7 +1105,7 @@ bool CFE_ES_RunLoop(uint32 *ExitStatus) return UT_DEFAULT_IMPL(CFE_ES_RunLoop) != 0; } -int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, CFE_ES_CDS_Offset_t BlockSize, const char *Name) +CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, size_t BlockSize, const char *Name) { UT_Stub_RegisterContext(UT_KEY(CFE_ES_RegisterCDS), HandlePtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_ES_RegisterCDS), BlockSize);