From 9ed226c20cd730748c0e3d884950acc164af6154 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 2 Nov 2020 10:45:33 -0500 Subject: [PATCH] Fix #663, more consistent use of data types (WIP) Define and Use data types more consistently across CFE. Replace many uses of generic uint16/uint32 with a more purpose-specific typedef. Replace all sizes with size_t across the API. --- fsw/cfe-core/src/es/cfe_es_api.c | 32 ++++----- fsw/cfe-core/src/es/cfe_es_apps.c | 70 ++++++++++++------- fsw/cfe-core/src/es/cfe_es_apps.h | 16 ++--- fsw/cfe-core/src/es/cfe_es_backgroundtask.c | 4 +- fsw/cfe-core/src/es/cfe_es_cds.c | 12 ++-- fsw/cfe-core/src/es/cfe_es_cds.h | 2 +- fsw/cfe-core/src/es/cfe_es_cds_mempool.c | 31 +++++--- fsw/cfe-core/src/es/cfe_es_generic_pool.c | 64 ++++++++--------- fsw/cfe-core/src/es/cfe_es_generic_pool.h | 59 +++++++++------- fsw/cfe-core/src/es/cfe_es_mempool.c | 34 ++++----- fsw/cfe-core/src/es/cfe_es_perf.c | 3 +- fsw/cfe-core/src/es/cfe_es_start.c | 4 +- fsw/cfe-core/src/es/cfe_es_task.c | 65 +++++++++-------- fsw/cfe-core/src/es/cfe_es_task.h | 2 +- fsw/cfe-core/src/evs/cfe_evs_log.c | 2 +- fsw/cfe-core/src/evs/cfe_evs_task.c | 43 +++++++----- fsw/cfe-core/src/evs/cfe_evs_utils.c | 4 +- fsw/cfe-core/src/inc/cfe_es.h | 59 +++++++++++----- fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h | 51 ++++++++++++-- fsw/cfe-core/src/inc/cfe_es_msg.h | 54 +++++++------- fsw/cfe-core/src/inc/cfe_sb.h | 34 +++------ fsw/cfe-core/src/inc/cfe_tbl.h | 4 +- .../src/inc/cfe_tbl_extern_typedefs.h | 5 +- fsw/cfe-core/src/inc/cfe_tbl_msg.h | 8 +-- fsw/cfe-core/src/inc/private/cfe_private.h | 2 +- fsw/cfe-core/src/sb/cfe_sb_api.c | 8 +-- fsw/cfe-core/src/sb/cfe_sb_buf.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_init.c | 2 +- fsw/cfe-core/src/sb/cfe_sb_priv.h | 8 +-- fsw/cfe-core/src/sb/cfe_sb_task.c | 10 +-- fsw/cfe-core/src/sb/cfe_sb_util.c | 33 +++++---- fsw/cfe-core/src/tbl/cfe_tbl_api.c | 20 +++--- fsw/cfe-core/src/tbl/cfe_tbl_internal.c | 4 +- fsw/cfe-core/src/tbl/cfe_tbl_task.c | 2 +- fsw/cfe-core/src/tbl/cfe_tbl_task.h | 6 +- fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c | 46 ++++++------ fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h | 4 +- fsw/cfe-core/src/time/cfe_time_task.c | 8 +-- fsw/cfe-core/src/time/cfe_time_utils.h | 2 +- fsw/cfe-core/ut-stubs/ut_es_stubs.c | 45 +++++------- fsw/cfe-core/ut-stubs/ut_sb_stubs.c | 20 +++--- fsw/cfe-core/ut-stubs/ut_tbl_stubs.c | 2 +- 42 files changed, 485 insertions(+), 401 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_api.c b/fsw/cfe-core/src/es/cfe_es_api.c index cb5545ca0..c0f251b2f 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; @@ -1002,7 +1002,7 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_ResourceID_t AppId) CFE_ES_CopyModuleBasicInfo(&AppRecPtr->StartParams.BasicInfo, AppInfo); CFE_ES_CopyModuleStatusInfo(&AppRecPtr->ModuleInfo, AppInfo); - AppInfo->StackSize = AppRecPtr->StartParams.StackSize; + AppInfo->StackSize = CFE_ES_MEMOFFSET_ATOM(AppRecPtr->StartParams.StackSize); AppInfo->ExceptionAction = AppRecPtr->StartParams.ExceptionAction; AppInfo->Priority = AppRecPtr->StartParams.Priority; AppInfo->MainTaskId = AppRecPtr->MainTaskId; @@ -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; @@ -1763,7 +1755,7 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, CFE_ES_CDS_Offset_t B if (Status < 0) { /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_EVS_SendEventWithAppID(CFE_ES_CDS_REGISTER_ERR_EID, CFE_EVS_EventType_ERROR, @@ -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; diff --git a/fsw/cfe-core/src/es/cfe_es_apps.c b/fsw/cfe-core/src/es/cfe_es_apps.c index 3800a898c..a07b598e0 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, + CFE_ES_TASKPRIORITY_ATOM(PriorityIn), + StackSizeIn, + CFE_ES_EXCEPTIONACTION_ENUM(ExceptionActionIn)); } else if(strcmp(EntryType,"CFE_LIB")==0) { @@ -402,7 +418,7 @@ int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_Modu if ( ReturnCode == CFE_SUCCESS ) { /* store the data in the app record after successful load+lookup */ - LoadStatus->ModuleId = ModuleId; + LoadStatus->ModuleId = CFE_ES_ResourceID_FromOSAL(ModuleId); LoadStatus->EntryAddress = StartAddr; } else if (OS_ObjectIdDefined(ModuleId)) @@ -521,7 +537,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) */ + CFE_ES_TASK_STACK_ALLOCATE, /* stack pointer (allocate) */ StartParams->StackSize, /* stack size */ StartParams->Priority, /* task priority */ OS_FP_ENABLED); /* task options */ @@ -588,9 +604,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; @@ -1321,7 +1337,7 @@ int32 CFE_ES_CleanUpApp(CFE_ES_ResourceID_t AppId) * * (this will be OS_OBJECT_ID_UNDEFINED if it was not loaded dynamically) */ - ModuleId = AppRecPtr->ModuleInfo.ModuleId; + ModuleId = CFE_ES_ResourceID_ToOSAL(AppRecPtr->ModuleInfo.ModuleId); } /* @@ -1749,7 +1765,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_ATOM(StatusPtr->EntryAddress); } /* @@ -1762,12 +1778,12 @@ void CFE_ES_CopyModuleStatusInfo(const CFE_ES_ModuleLoadStatus_t *StatusPtr, CFE ** to check the return code and log any relevant errors based on the context. **--------------------------------------------------------------------------------------- */ -void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr) +void CFE_ES_CopyModuleAddressInfo(CFE_ES_ResourceID_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr) { OS_module_prop_t ModuleInfo; int32 ReturnCode; - ReturnCode = OS_ModuleInfo ( ModuleId, &ModuleInfo ); + ReturnCode = OS_ModuleInfo ( CFE_ES_ResourceID_ToOSAL(ModuleId), &ModuleInfo ); if ( ReturnCode == OS_SUCCESS ) { AppInfoPtr->AddressesAreValid = @@ -1780,12 +1796,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_ATOM(ModuleInfo.addr.code_address); + AppInfoPtr->CodeSize = CFE_ES_MEMOFFSET_ATOM(ModuleInfo.addr.code_size); + AppInfoPtr->DataAddress = CFE_ES_MEMADDRESS_ATOM(ModuleInfo.addr.data_address); + AppInfoPtr->DataSize = CFE_ES_MEMOFFSET_ATOM(ModuleInfo.addr.data_size); + AppInfoPtr->BSSAddress = CFE_ES_MEMADDRESS_ATOM(ModuleInfo.addr.bss_address); + AppInfoPtr->BSSSize = CFE_ES_MEMOFFSET_ATOM(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..002ec2bc0 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.h +++ b/fsw/cfe-core/src/es/cfe_es_apps.h @@ -92,8 +92,8 @@ typedef struct */ typedef struct { - cpuaddr EntryAddress; - osal_id_t ModuleId; + cpuaddr EntryAddress; + CFE_ES_ResourceID_t ModuleId; } CFE_ES_ModuleLoadStatus_t; @@ -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 */ @@ -305,7 +305,7 @@ void CFE_ES_CopyModuleStatusInfo(const CFE_ES_ModuleLoadStatus_t *StatusPtr, CFE ** Purpose: Populate the cFE_ES_AppInfo structure with address information from OSAL. **--------------------------------------------------------------------------------------- */ -void CFE_ES_CopyModuleAddressInfo(osal_id_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr); +void CFE_ES_CopyModuleAddressInfo(CFE_ES_ResourceID_t ModuleId, CFE_ES_AppInfo_t *AppInfoPtr); #endif /* _cfe_es_apps_ */ diff --git a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c index 0f111a810..c532e5a72 100644 --- a/fsw/cfe-core/src/es/cfe_es_backgroundtask.c +++ b/fsw/cfe-core/src/es/cfe_es_backgroundtask.c @@ -43,9 +43,9 @@ #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_PRIORITY CFE_ES_TASKPRIORITY_ATOM(CFE_PLATFORM_ES_PERF_CHILD_PRIORITY) #define CFE_ES_BACKGROUND_CHILD_FLAGS 0 #define CFE_ES_BACKGROUND_MAX_IDLE_DELAY 30000 /* 30 seconds */ diff --git a/fsw/cfe-core/src/es/cfe_es_cds.c b/fsw/cfe-core/src/es/cfe_es_cds.c index be9efc862..bf976b271 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds.c +++ b/fsw/cfe-core/src/es/cfe_es_cds.c @@ -305,15 +305,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; @@ -668,7 +668,7 @@ void CFE_ES_FormCDSName(char *FullCDSName, const char *CDSName, CFE_ES_ResourceI { char AppName[OS_MAX_API_NAME]; - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Ensure that AppName is null terminated */ AppName[OS_MAX_API_NAME-1] = '\0'; @@ -844,7 +844,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..2381be3c0 100644 --- a/fsw/cfe-core/src/es/cfe_es_cds.h +++ b/fsw/cfe-core/src/es/cfe_es_cds.h @@ -383,7 +383,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 CFE_ES_CDS_Offset_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..2c7510f14 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,7 +90,7 @@ 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; @@ -111,13 +111,18 @@ 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_Offset_t CDSOffset; + CFE_ES_CDS_Offset_t CDSSize; + + /* Type conversions */ + CDSOffset = Offset; + CDSSize = sizeof(CFE_ES_GenPoolBD_t); - CFE_ES_CDS_CachePreload(&CDS->Cache, BdPtr, Offset, - sizeof(CFE_ES_GenPoolBD_t)); + CFE_ES_CDS_CachePreload(&CDS->Cache, BdPtr, CDSOffset, CDSSize); return CFE_ES_CDS_CacheFlush(&CDS->Cache); } @@ -135,8 +140,8 @@ int32 CFE_ES_CreateCDSPool(CFE_ES_CDS_Offset_t CDSPoolSize, CFE_ES_CDS_Offset_t { 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; @@ -212,7 +217,7 @@ 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; + size_t BlockSize; CFE_ES_CDS_Offset_t UserDataSize; CFE_ES_CDS_Offset_t UserDataOffset; CFE_ES_CDS_RegRec_t *CDSRegRecPtr; @@ -311,7 +316,7 @@ 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; + size_t BlockSize; CFE_ES_CDS_Offset_t UserDataSize; CFE_ES_CDS_Offset_t UserDataOffset; CFE_ES_CDS_RegRec_t *CDSRegRecPtr; @@ -400,10 +405,14 @@ int32 CFE_ES_CDSBlockRead(void *DataRead, CFE_ES_CDSHandle_t Handle) ** Purpose: ** */ -uint32 CFE_ES_CDSReqdMinSize(uint32 MaxNumBlocksToSupport) +CFE_ES_CDS_Offset_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_generic_pool.c b/fsw/cfe-core/src/es/cfe_es_generic_pool.c index cbf451cbf..014bc00da 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; @@ -373,7 +373,7 @@ CFE_ES_MemOffset_t CFE_ES_GenPoolCalcMinSize(uint16 NumBlockSizes, MinBlockSize += sizeof(CFE_ES_GenPoolBD_t); - return (NumBlocks * MinBlockSize); + return NumBlocks * MinBlockSize; } @@ -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; @@ -655,16 +655,16 @@ bool CFE_ES_GenPoolValidateState(const CFE_ES_GenPoolRecord_t *PoolRecPtr) **--------------------------------------------------------------------------------------- */ void CFE_ES_GenPoolGetUsage(CFE_ES_GenPoolRecord_t *PoolRecPtr, - CFE_ES_MemOffset_t *FreeSizeBuf, - CFE_ES_MemOffset_t *TotalSizeBuf) + CFE_ES_MemOffset_Atom_t *FreeSizeBuf, + CFE_ES_MemOffset_Atom_t *TotalSizeBuf) { if (TotalSizeBuf != NULL) { - *TotalSizeBuf = PoolRecPtr->PoolTotalSize; + *TotalSizeBuf = CFE_ES_MEMOFFSET_ATOM(PoolRecPtr->PoolTotalSize); } if (FreeSizeBuf != NULL) { - *FreeSizeBuf = PoolRecPtr->PoolMaxOffset - PoolRecPtr->TailPosition; + *FreeSizeBuf = CFE_ES_MEMOFFSET_ATOM(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_ATOM(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..64d2d458d 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,7 +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, + size_t Offset, CFE_ES_GenPoolBD_t **BdPtr); /** @@ -101,7 +101,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, + size_t Offset, const CFE_ES_GenPoolBD_t *BdPtr); @@ -110,10 +110,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 +148,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 +169,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 +185,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 +221,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,16 +238,25 @@ 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_Atom_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, - CFE_ES_MemOffset_t *TotalSizeBuf); + CFE_ES_MemOffset_Atom_t *FreeSizeBuf, + CFE_ES_MemOffset_Atom_t *TotalSizeBuf); /** * \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 +271,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 +299,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..12ccd6fa1 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 */ @@ -399,12 +399,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 +466,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 +519,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); @@ -670,7 +670,7 @@ int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle) { CFE_ES_MemPoolRecord_t *PoolRecPtr; - CFE_ES_MemOffset_t TotalSize; + CFE_ES_MemOffset_Atom_t TotalSize; /* Test #1) Handle must be valid */ 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 c85a22555..6fce91de9 100644 --- a/fsw/cfe-core/src/es/cfe_es_perf.c +++ b/fsw/cfe-core/src/es/cfe_es_perf.c @@ -229,7 +229,8 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfData_t *data) /* Copy out the string, using default if unspecified */ CFE_SB_MessageStringGet(PerfDumpState->DataFileName, CmdPtr->DataFileName, - CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME, OS_MAX_PATH_LEN, sizeof(CmdPtr->DataFileName)); + CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME, + sizeof(PerfDumpState->DataFileName), sizeof(CmdPtr->DataFileName)); PerfDumpState->PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_BackgroundWakeup(); diff --git a/fsw/cfe-core/src/es/cfe_es_start.c b/fsw/cfe-core/src/es/cfe_es_start.c index 2a883ef13..9111023ab 100644 --- a/fsw/cfe-core/src/es/cfe_es_start.c +++ b/fsw/cfe-core/src/es/cfe_es_start.c @@ -784,8 +784,8 @@ void CFE_ES_CreateObjects(void) /* FileName and EntryPoint is not valid for core apps */ AppRecPtr->StartParams.StackSize = CFE_ES_ObjectTable[i].ObjectSize; - AppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_PROC_RESTART; - AppRecPtr->StartParams.Priority = CFE_ES_ObjectTable[i].ObjectPriority; + AppRecPtr->StartParams.ExceptionAction = CFE_ES_EXCEPTIONACTION_ENUM(CFE_ES_ExceptionAction_PROC_RESTART); + AppRecPtr->StartParams.Priority = CFE_ES_TASKPRIORITY_ATOM(CFE_ES_ObjectTable[i].ObjectPriority); AppRecPtr->ModuleInfo.EntryAddress = (cpuaddr)CFE_ES_ObjectTable[i].FuncPtrUnion.VoidPtr; /* diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index 75af1e6e9..c9031f0aa 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -196,7 +196,7 @@ void CFE_ES_TaskMain(void) int32 CFE_ES_TaskInit(void) { int32 Status; - uint32 SizeofCfeSegment; + uint32 SizeofCfeSegment; /* NOTE: This size must be 32 bits per PSP API */ cpuaddr CfeSegmentAddr; char EventBuffer[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; char VersionBuffer[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; @@ -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_ATOM(CFE_ES_ResetDataPtr->SystemLogEndIdx); + CFE_ES_TaskData.HkPacket.Payload.SysLogSize = CFE_ES_MEMOFFSET_ATOM(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; @@ -731,15 +731,15 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) 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; + CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_ATOM(HeapProp.free_bytes); + CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_ATOM(HeapProp.free_blocks); + CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = CFE_ES_MEMOFFSET_ATOM(HeapProp.largest_free_block); } else { - CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = 0; - CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = 0; - CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = 0; + CFE_ES_TaskData.HkPacket.Payload.HeapBytesFree = CFE_ES_MEMOFFSET_ATOM(0); + CFE_ES_TaskData.HkPacket.Payload.HeapBlocksFree = CFE_ES_MEMOFFSET_ATOM(0); + CFE_ES_TaskData.HkPacket.Payload.HeapMaxBlockSize = CFE_ES_MEMOFFSET_ATOM(0); } /* @@ -867,13 +867,13 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data) /* Create local copies of all input strings and ensure null termination */ FilenameLen = CFE_SB_MessageStringGet(LocalFile, (char *)cmd->AppFileName, NULL, - OS_MAX_PATH_LEN, sizeof(cmd->AppFileName)); + sizeof(LocalFile), sizeof(cmd->AppFileName)); AppEntryLen = CFE_SB_MessageStringGet(LocalEntryPt, (char *)cmd->AppEntryPoint, NULL, - OS_MAX_API_NAME, sizeof(cmd->AppEntryPoint)); + sizeof(LocalEntryPt), sizeof(cmd->AppEntryPoint)); AppNameLen = CFE_SB_MessageStringGet(LocalAppName, (char *)cmd->Application, NULL, - OS_MAX_API_NAME, sizeof(cmd->Application)); + sizeof(LocalAppName), sizeof(cmd->Application)); /* ** Verify command parameters @@ -927,9 +927,9 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data) Result = CFE_ES_AppCreate(&AppID, LocalFile, LocalEntryPt, LocalAppName, - (uint32) cmd->Priority, - (uint32) cmd->StackSize, - (uint32) cmd->ExceptionAction); + cmd->Priority, + cmd->StackSize, + cmd->ExceptionAction); /* ** Send appropriate event message @@ -968,7 +968,8 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopApp_t *data) CFE_ES_ResourceID_t AppID; int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, OS_MAX_API_NAME, sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, + sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1021,7 +1022,8 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartApp_t *data) CFE_ES_ResourceID_t AppID; int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, OS_MAX_API_NAME, sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, + sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1071,8 +1073,10 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadApp_t *data) CFE_ES_ResourceID_t AppID; int32 Result; - CFE_SB_MessageStringGet(LocalFileName, (char *)cmd->AppFileName, NULL, sizeof(LocalFileName), sizeof(cmd->AppFileName)); - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalFileName, (char *)cmd->AppFileName, NULL, + sizeof(LocalFileName), sizeof(cmd->AppFileName)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, + sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&AppID, LocalApp); @@ -1122,7 +1126,8 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data) CFE_ES_ResourceID_t ResourceID; int32 Result; - CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, OS_MAX_API_NAME, sizeof(cmd->Application)); + CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, + sizeof(LocalApp), sizeof(cmd->Application)); Result = CFE_ES_GetAppIDByName(&ResourceID, LocalApp); if (Result == CFE_ES_ERR_NAME_NOT_FOUND) @@ -1196,8 +1201,8 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAll_t *data) /* ** Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ - CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, - CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE, OS_MAX_PATH_LEN, sizeof(CmdPtr->FileName)); + CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_APP_LOG_FILE, + sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); /* * Collect list of active resource IDs. @@ -1354,8 +1359,8 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasks_t *data) /* ** Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ - CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, - CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE, OS_MAX_PATH_LEN, sizeof(CmdPtr->FileName)); + CFE_SB_MessageStringGet(QueryAllFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE, + sizeof(QueryAllFilename), sizeof(CmdPtr->FileName)); /* * Collect list of active task IDs. @@ -1548,8 +1553,8 @@ int32 CFE_ES_WriteSyslogCmd(const CFE_ES_WriteSyslog_t *data) int32 Stat; char LogFilename[OS_MAX_PATH_LEN]; - CFE_SB_MessageStringGet(LogFilename, (char *)CmdPtr->FileName, - CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE, OS_MAX_PATH_LEN, sizeof(CmdPtr->FileName)); + CFE_SB_MessageStringGet(LogFilename, (char *)CmdPtr->FileName, CFE_PLATFORM_ES_DEFAULT_SYSLOG_FILE, + sizeof(LogFilename), sizeof(CmdPtr->FileName)); Stat = CFE_ES_SysLogDump(LogFilename); @@ -1641,10 +1646,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 @@ -1730,7 +1735,7 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDS_t *data) char LocalCdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; CFE_SB_MessageStringGet(LocalCdsName, (char *)cmd->CdsName, NULL, - CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN, sizeof(cmd->CdsName)); + sizeof(LocalCdsName), sizeof(cmd->CdsName)); Status = CFE_ES_DeleteCDS(LocalCdsName, false); @@ -1847,7 +1852,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data) /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(DumpFilename, CmdPtr->DumpFilename, CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE, - OS_MAX_PATH_LEN, sizeof(CmdPtr->DumpFilename)); + sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); /* Create a new dump file, overwriting anything that may have existed previously */ Status = OS_OpenCreate(&FileDescriptor, DumpFilename, diff --git a/fsw/cfe-core/src/es/cfe_es_task.h b/fsw/cfe-core/src/es/cfe_es_task.h index 83e142ac8..d67833f33 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.h +++ b/fsw/cfe-core/src/es/cfe_es_task.h @@ -204,7 +204,7 @@ 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); +bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t msg, size_t ExpectedLength); void CFE_ES_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual); /*************************************************************************/ diff --git a/fsw/cfe-core/src/evs/cfe_evs_log.c b/fsw/cfe-core/src/evs/cfe_evs_log.c index 28519d7bd..e6c091203 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_log.c +++ b/fsw/cfe-core/src/evs/cfe_evs_log.c @@ -169,7 +169,7 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFile_t *data) { /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(LogFilename, (const char *)CmdPtr->LogFilename, CFE_PLATFORM_EVS_DEFAULT_LOG_FILE, - OS_MAX_PATH_LEN, sizeof(CmdPtr->LogFilename)); + sizeof(LogFilename), sizeof(CmdPtr->LogFilename)); /* Create the log file */ Result = OS_OpenCreate(&LogFileHandle, LogFilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.c b/fsw/cfe-core/src/evs/cfe_evs_task.c index e5baec3cb..b8bc9f701 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.c +++ b/fsw/cfe-core/src/evs/cfe_evs_task.c @@ -54,7 +54,7 @@ CFE_EVS_GlobalData_t CFE_EVS_GlobalData; ** Local function prototypes. */ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ); -bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength); +bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, size_t ExpectedLength); /* Function Definitions */ @@ -486,7 +486,7 @@ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) case CFE_EVS_SET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, (uint16) sizeof(CFE_EVS_SetFilter_t))) + if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_SetFilter_t))) { Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilter_t*)EVS_MsgPtr); } @@ -608,10 +608,10 @@ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) ** Assumptions and Notes: ** */ -bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_EVS_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 @@ -786,7 +786,8 @@ int32 CFE_EVS_SetFilterCmd(const CFE_EVS_SetFilter_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1116,7 +1117,8 @@ int32 CFE_EVS_EnableAppEventTypeCmd(const CFE_EVS_EnableAppEventType_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retrieve application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1190,7 +1192,8 @@ int32 CFE_EVS_DisableAppEventTypeCmd(const CFE_EVS_DisableAppEventType_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1263,7 +1266,8 @@ int32 CFE_EVS_EnableAppEventsCmd(const CFE_EVS_EnableAppEvents_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retrieve application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1321,7 +1325,8 @@ int32 CFE_EVS_DisableAppEventsCmd(const CFE_EVS_DisableAppEvents_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1380,7 +1385,8 @@ int32 CFE_EVS_ResetAppCounterCmd(const CFE_EVS_ResetAppCounter_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1440,7 +1446,8 @@ int32 CFE_EVS_ResetFilterCmd(const CFE_EVS_ResetFilter_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1513,7 +1520,8 @@ int32 CFE_EVS_ResetAllFiltersCmd(const CFE_EVS_ResetAllFilters_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1575,7 +1583,8 @@ int32 CFE_EVS_AddEventFilterCmd(const CFE_EVS_AddEventFilter_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1667,7 +1676,8 @@ int32 CFE_EVS_DeleteEventFilterCmd(const CFE_EVS_DeleteEventFilter_t *data) * Althgouh EVS_GetApplicationInfo() does not require a null terminated argument, * the value is passed to EVS_SendEvent which does require termination (normal C string) */ - CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, OS_MAX_API_NAME, sizeof(CmdPtr->AppName)); + CFE_SB_MessageStringGet(LocalName, (char *)CmdPtr->AppName, NULL, + sizeof(LocalName), sizeof(CmdPtr->AppName)); /* Retreive application data */ Status = EVS_GetApplicationInfo(&AppDataPtr, LocalName); @@ -1747,7 +1757,7 @@ int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFile_t *data) /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(LocalName, CmdPtr->AppDataFilename, CFE_PLATFORM_EVS_DEFAULT_APP_DATA_FILE, - OS_MAX_PATH_LEN, sizeof(CmdPtr->AppDataFilename)); + sizeof(LocalName), sizeof(CmdPtr->AppDataFilename)); /* Create Application Data File */ Result = OS_OpenCreate(&FileHandle, LocalName, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY); @@ -1781,7 +1791,8 @@ int32 CFE_EVS_WriteAppDataFileCmd(const CFE_EVS_WriteAppDataFile_t *data) memset(&AppDataFile, 0, sizeof(CFE_EVS_AppDataFile_t)); /* Copy application data to application file data record */ - CFE_ES_GetAppName(AppDataFile.AppName, EVS_AppDataGetID(AppDataPtr), OS_MAX_API_NAME); + CFE_ES_GetAppName(AppDataFile.AppName, EVS_AppDataGetID(AppDataPtr), + sizeof(AppDataFile.AppName)); AppDataFile.ActiveFlag = AppDataPtr->ActiveFlag; AppDataFile.EventCount = AppDataPtr->EventCount; AppDataFile.EventTypesActiveFlag = AppDataPtr->EventTypesActiveFlag; diff --git a/fsw/cfe-core/src/evs/cfe_evs_utils.c b/fsw/cfe-core/src/evs/cfe_evs_utils.c index 906d808b0..905df42eb 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_utils.c +++ b/fsw/cfe-core/src/evs/cfe_evs_utils.c @@ -194,7 +194,7 @@ int32 EVS_NotRegistered (EVS_AppData_t *AppDataPtr, CFE_ES_ResourceID_t CallerID AppDataPtr->UnregAppID = CallerID; /* Get the name of the "not registered" app */ - CFE_ES_GetAppName(AppName, CallerID, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, CallerID, sizeof(AppName)); /* Send the "not registered" event */ EVS_SendEvent(CFE_EVS_ERR_UNREGISTERED_EVS_APP, CFE_EVS_EventType_ERROR, @@ -300,7 +300,7 @@ bool EVS_IsFiltered (EVS_AppData_t *AppDataPtr, uint16 EventID, uint16 EventType /* Is it time to lock this filter? */ if (FilterPtr->Count == CFE_EVS_MAX_FILTER_COUNT) { - CFE_ES_GetAppName(AppName, EVS_AppDataGetID(AppDataPtr), OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, EVS_AppDataGetID(AppDataPtr), sizeof(AppName)); EVS_SendEvent(CFE_EVS_FILTER_MAX_EID, CFE_EVS_EventType_INFORMATION, "Max filter count reached, AppName = %s, EventID = 0x%08x: Filter locked until reset", 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..7439f493a 100644 --- a/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h +++ b/fsw/cfe-core/src/inc/cfe_es_extern_typedefs.h @@ -82,8 +82,13 @@ enum CFE_ES_ExceptionAction * * @sa enum CFE_ES_ExceptionAction */ -typedef uint8 CFE_ES_ExceptionAction_Enum_t; +typedef uint8 CFE_ES_ExceptionAction_Enum_t; +/* + * A converter macro to use when initializing an CFE_ES_ExceptionAction_Enum_t + * from an integer value of a different type. + */ +#define CFE_ES_EXCEPTIONACTION_ENUM(C) ((CFE_ES_ExceptionAction_Enum_t)(C)) /** * @brief Label definitions associated with CFE_ES_AppType_Enum_t @@ -363,11 +368,29 @@ 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; + +/* + * A converter macro to use when initializing an CFE_ES_TaskPriority_Atom_t + * from an integer value of a different type. + */ +#define CFE_ES_TASKPRIORITY_ATOM(C) ((CFE_ES_TaskPriority_Atom_t)(C)) + +/** + * @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 +398,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_Atom_t; + +/* + * A converter macro to use when initializing an CFE_ES_MemOffset_Atom_t + * from an integer value of a different type. + */ +#define CFE_ES_MEMOFFSET_ATOM(C) ((CFE_ES_MemOffset_Atom_t)(C)) /** - * @brief Type used for memory addresses + * @brief Type used for memory addresses in cmd/tlm * * 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,10 +425,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. + */ +typedef uint32 CFE_ES_MemAddress_Atom_t; + +/* + * A converter macro to use when initializing an CFE_ES_MemAddress_Atom_t + * from a pointer value of a different type. * - * @sa #CFE_SB_SET_MEMADDR, #CFE_SB_GET_MEMADDR + * @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_MemAddress_t; +#define CFE_ES_MEMADDRESS_ATOM(C) ((CFE_ES_MemAddress_Atom_t)((cpuaddr)(C) & 0xFFFFFFFF)) /** * @brief Type used for CDS sizes and offsets. diff --git a/fsw/cfe-core/src/inc/cfe_es_msg.h b/fsw/cfe-core/src/inc/cfe_es_msg.h index 5f6b71ff3..bd6a1645f 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_Atom_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; @@ -1404,30 +1404,30 @@ typedef struct CFE_ES_AppInfo char FileName[CFE_MISSION_MAX_PATH_LEN]; /**< \cfetlmmnemonic \ES_APPFILENAME \brief The Filename of the file containing the Application */ - CFE_ES_MemOffset_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE + CFE_ES_MemOffset_Atom_t StackSize; /**< \cfetlmmnemonic \ES_STACKSIZE \brief The Stack Size of the Application */ - osal_id_t ModuleId; /**< \cfetlmmnemonic \ES_MODULEID + CFE_ES_ResourceID_t ModuleId; /**< \cfetlmmnemonic \ES_MODULEID \brief The ID of the Loadable Module for the Application */ uint32 AddressesAreValid; /**< \cfetlmmnemonic \ES_ADDRVALID \brief Indicates that the Code, Data, and BSS addresses/sizes are valid */ - CFE_ES_MemAddress_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR + CFE_ES_MemAddress_Atom_t CodeAddress; /**< \cfetlmmnemonic \ES_CODEADDR \brief The Address of the Application Code Segment*/ - CFE_ES_MemOffset_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE + CFE_ES_MemOffset_Atom_t CodeSize; /**< \cfetlmmnemonic \ES_CODESIZE \brief The Code Size of the Application */ - CFE_ES_MemAddress_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR + CFE_ES_MemAddress_Atom_t DataAddress; /**< \cfetlmmnemonic \ES_DATAADDR \brief The Address of the Application Data Segment*/ - CFE_ES_MemOffset_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE + CFE_ES_MemOffset_Atom_t DataSize; /**< \cfetlmmnemonic \ES_DATASIZE \brief The Data Size of the Application */ - CFE_ES_MemAddress_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR + CFE_ES_MemAddress_Atom_t BSSAddress; /**< \cfetlmmnemonic \ES_BSSADDR \brief The Address of the Application BSS Segment*/ - CFE_ES_MemOffset_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE + CFE_ES_MemOffset_Atom_t BSSSize; /**< \cfetlmmnemonic \ES_BSSSIZE \brief The BSS Size of the Application */ - CFE_ES_MemAddress_t StartAddress; /**< \cfetlmmnemonic \ES_STARTADDR + CFE_ES_MemAddress_Atom_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 */ @@ -1489,9 +1489,9 @@ typedef struct CFE_ES_CDSRegDumpRec */ typedef struct CFE_ES_BlockStats { - CFE_ES_MemOffset_t BlockSize; /**< \brief Number of bytes in each of these blocks */ - uint32 NumCreated; /**< \brief Number of Memory Blocks of this size created */ - uint32 NumFree; /**< \brief Number of Memory Blocks of this size that are free */ + CFE_ES_MemOffset_Atom_t BlockSize; /**< \brief Number of bytes in each of these blocks */ + uint32 NumCreated; /**< \brief Number of Memory Blocks of this size created */ + uint32 NumFree; /**< \brief Number of Memory Blocks of this size that are free */ } CFE_ES_BlockStats_t; /** @@ -1504,15 +1504,15 @@ typedef struct CFE_ES_BlockStats */ typedef struct CFE_ES_MemPoolStats { - CFE_ES_MemOffset_t PoolSize; /**< \cfetlmmnemonic \ES_POOLSIZE + CFE_ES_MemOffset_Atom_t PoolSize; /**< \cfetlmmnemonic \ES_POOLSIZE \brief Size of Memory Pool (in bytes) */ - uint32 NumBlocksRequested; /**< \cfetlmmnemonic \ES_BLKSREQ + uint32 NumBlocksRequested; /**< \cfetlmmnemonic \ES_BLKSREQ \brief Number of times a memory block has been allocated */ - uint32 CheckErrCtr; /**< \cfetlmmnemonic \ES_BLKERRCTR + uint32 CheckErrCtr; /**< \cfetlmmnemonic \ES_BLKERRCTR \brief Number of errors detected when freeing a memory block */ - CFE_ES_MemOffset_t NumFreeBytes; /**< \cfetlmmnemonic \ES_FREEBYTES + CFE_ES_MemOffset_Atom_t NumFreeBytes; /**< \cfetlmmnemonic \ES_FREEBYTES \brief Number of bytes never allocated to a block */ - CFE_ES_BlockStats_t BlockStats[CFE_MISSION_ES_POOL_MAX_BUCKETS]; /**< \cfetlmmnemonic \ES_BLKSTATS + CFE_ES_BlockStats_t BlockStats[CFE_MISSION_ES_POOL_MAX_BUCKETS]; /**< \cfetlmmnemonic \ES_BLKSTATS \brief Contains stats on each block size */ } CFE_ES_MemPoolStats_t; @@ -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_Atom_t SysLogBytesUsed; /**< \cfetlmmnemonic \ES_SYSLOGBYTEUSED \brief Total number of bytes used in system log */ - uint32 SysLogSize; /**< \cfetlmmnemonic \ES_SYSLOGSIZE + CFE_ES_MemOffset_Atom_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_Atom_t HeapBytesFree; /**< \cfetlmmnemonic \ES_HEAPBYTESFREE \brief Number of free bytes remaining in the OS heap */ - uint32 HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE + CFE_ES_MemOffset_Atom_t HeapBlocksFree; /**< \cfetlmmnemonic \ES_HEAPBLKSFREE \brief Number of free blocks remaining in the OS heap */ - uint32 HeapMaxBlockSize; /**< \cfetlmmnemonic \ES_HEAPMAXBLK + CFE_ES_MemOffset_Atom_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/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index 59b9ac419..607a4d24f 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -120,24 +120,6 @@ #define CFE_CLR(i,x) ((i) &= ~CFE_BIT(x)) /**< \brief Clears bit x of i */ #define CFE_TST(i,x) (((i) & CFE_BIT(x)) != 0)/**< \brief true(non zero) if bit x of i is set */ -/** - * \brief Set memory address within SB Message - * - * Macro that should be used to set memory addresses within software bus messages. - * For now this does a straight copy, but in a future revision this may translate the - * raw memory address into a "safe" integer value. This is particularly important if - * the message is to be sent off this CPU. - */ -#define CFE_SB_SET_MEMADDR(msgdst,src) msgdst = (cpuaddr)src - -/** - * \brief Get memory address from SB Message - * - * Macro that should be used to get memory addresses from software bus messages. - * This is the inverse operation of CFE_SB_SET_MEMADDR. - */ -#define CFE_SB_GET_MEMADDR(msgsrc) (cpuaddr)msgsrc - /* ** Pipe option bit fields. */ @@ -671,7 +653,7 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, CFE_SB_PipeId_t PipeId, int ** ** \sa #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopySend **/ -CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, +CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle); /*****************************************************************************/ @@ -820,7 +802,7 @@ CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t B **/ void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, - uint16 Length, + size_t Length, bool Clear ); /*****************************************************************************/ @@ -868,7 +850,7 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, ** \sa #CFE_SB_SetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_SetTotalMsgLength, ** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength); +void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,size_t DataLength); /*****************************************************************************/ /** @@ -893,7 +875,7 @@ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength); ** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_GetTotalMsgLength, ** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength); +void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,size_t TotalLength); /*****************************************************************************/ /** @@ -1007,7 +989,7 @@ CFE_Status_t CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode); ** \return Number of characters copied or error code, see \ref CFEReturnCodes ** */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, uint32 DestMaxSize, uint32 SourceMaxSize); +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize); /**@}*/ /** @defgroup CFEAPIGetMessage cFE Getting Message Characteristics APIs @@ -1073,7 +1055,7 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr); ** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_GetTotalMsgLength, ** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr); +size_t CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr); /*****************************************************************************/ /** @@ -1094,7 +1076,7 @@ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr); ** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_SetTotalMsgLength, ** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr); +size_t CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr); /*****************************************************************************/ /** @@ -1182,7 +1164,7 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr); ** \return Number of characters copied or error code, see \ref CFEReturnCodes ** */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, uint32 DestMaxSize, uint32 SourceMaxSize); +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize); /**@}*/ /** @defgroup CFEAPISBChecksum cFE Checksum Control APIs diff --git a/fsw/cfe-core/src/inc/cfe_tbl.h b/fsw/cfe-core/src/inc/cfe_tbl.h index 4e29481d2..0229ba4ab 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl.h +++ b/fsw/cfe-core/src/inc/cfe_tbl.h @@ -116,7 +116,7 @@ typedef enum CFE_TBL_SrcEnum /** \brief Table Info */ typedef struct CFE_TBL_Info { - uint32 Size; /**< \brief Size, in bytes, of Table */ + size_t Size; /**< \brief Size, in bytes, of Table */ uint32 NumUsers; /**< \brief Number of Apps with access to the table */ uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ @@ -265,7 +265,7 @@ typedef struct CFE_TBL_Info **/ CFE_Status_t CFE_TBL_Register(CFE_TBL_Handle_t *TblHandlePtr, /* Returned Handle */ const char *Name, /* Application specific name */ - uint32 Size, /* Size, in bytes, of table */ + size_t Size, /* Size, in bytes, of table */ uint16 TblOptionFlags, /* Tbl Options Settings */ CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr); /* Ptr to func that validates tbl */ diff --git a/fsw/cfe-core/src/inc/cfe_tbl_extern_typedefs.h b/fsw/cfe-core/src/inc/cfe_tbl_extern_typedefs.h index 64c80b6de..8411c0cba 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_extern_typedefs.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_extern_typedefs.h @@ -32,6 +32,7 @@ /* Use the local definitions of these types */ #include "common_types.h" +#include "cfe_es_extern_typedefs.h" #include /* for CFE_MISSION_TBL_MAX_FULL_NAME_LEN */ /** @@ -69,8 +70,8 @@ typedef uint16 CFE_TBL_BufferSelect_En typedef struct CFE_TBL_File_Hdr { uint32 Reserved; /**< Future Use: NumTblSegments in File? */ - uint32 Offset; /**< Byte Offset at which load should commence */ - uint32 NumBytes; /**< Number of bytes to load into table */ + CFE_ES_MemOffset_Atom_t Offset; /**< Byte Offset at which load should commence */ + CFE_ES_MemOffset_Atom_t NumBytes; /**< Number of bytes to load into table */ char TableName[CFE_MISSION_TBL_MAX_FULL_NAME_LEN]; /**< Fully qualified name of table to load */ } CFE_TBL_File_Hdr_t; diff --git a/fsw/cfe-core/src/inc/cfe_tbl_msg.h b/fsw/cfe-core/src/inc/cfe_tbl_msg.h index b93445fea..85aa95a5b 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_msg.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_msg.h @@ -772,15 +772,15 @@ typedef struct CFE_TBL_HousekeepingTlm **/ typedef struct CFE_TBL_TblRegPacket_Payload { - uint32 Size; /**< \cfetlmmnemonic \TBL_SIZE + CFE_ES_MemOffset_Atom_t Size; /**< \cfetlmmnemonic \TBL_SIZE \brief Size, in bytes, of Table */ uint32 Crc; /**< \cfetlmmnemonic \TBL_CRC \brief Most recently calculated CRC of Table */ - cpuaddr ActiveBufferAddr; /**< \cfetlmmnemonic \TBL_ACTBUFADD + CFE_ES_MemAddress_Atom_t ActiveBufferAddr; /**< \cfetlmmnemonic \TBL_ACTBUFADD \brief Address of Active Buffer */ - cpuaddr InactiveBufferAddr; /**< \cfetlmmnemonic \TBL_IACTBUFADD + CFE_ES_MemAddress_Atom_t InactiveBufferAddr; /**< \cfetlmmnemonic \TBL_IACTBUFADD \brief Address of Inactive Buffer */ - cpuaddr ValidationFuncPtr; /**< \cfetlmmnemonic \TBL_VALFUNCPTR + CFE_ES_MemAddress_Atom_t ValidationFuncPtr; /**< \cfetlmmnemonic \TBL_VALFUNCPTR \brief Ptr to Owner App's function that validates tbl contents */ CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \cfetlmmnemonic \TBL_TIMELASTUPD \brief Time when Table was last updated */ 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/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index 736fac134..ce5be8ac4 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -103,7 +103,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char * CFE_ES_GetTaskID(&TskId); /* get callers name */ - CFE_ES_GetAppName(AppName, AppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)); /* Hardcode a NULL terminator, in case rcvd name was too long */ AppName[OS_MAX_API_NAME-1]= '\0'; @@ -1164,7 +1164,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_SB_PipeD_t *PipeDscPtr; CFE_SBR_RouteId_t RouteId; CFE_SB_BufferD_t *BufDscPtr; - uint16 TotalMsgSize; + size_t TotalMsgSize; CFE_ES_ResourceID_t AppId; CFE_ES_ResourceID_t TskId; uint32 i; @@ -1294,7 +1294,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, /* Copy the packet into the SB memory space */ if (CopyMode != CFE_SB_SEND_ZEROCOPY){ /* Copy the packet into the SB memory space */ - memcpy( BufDscPtr->Buffer, MsgPtr, (uint16)TotalMsgSize ); + memcpy( BufDscPtr->Buffer, MsgPtr, TotalMsgSize ); } /* For Tlm packets, increment the seq count if requested */ @@ -1583,7 +1583,7 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, /* * Function: CFE_SB_ZeroCopyGetPtr - See API and header file for details */ -CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, +CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) { int32 stat1; diff --git a/fsw/cfe-core/src/sb/cfe_sb_buf.c b/fsw/cfe-core/src/sb/cfe_sb_buf.c index a17a6bdbe..966f16125 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_buf.c +++ b/fsw/cfe-core/src/sb/cfe_sb_buf.c @@ -57,7 +57,7 @@ ** could not be allocated. */ -CFE_SB_BufferD_t * CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, uint16 Size) { +CFE_SB_BufferD_t * CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, size_t Size) { int32 stat1; uint8 *address = NULL; CFE_SB_BufferD_t *bd = NULL; diff --git a/fsw/cfe-core/src/sb/cfe_sb_init.c b/fsw/cfe-core/src/sb/cfe_sb_init.c index 2a6d25e5f..52ee1bd61 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_init.c +++ b/fsw/cfe-core/src/sb/cfe_sb_init.c @@ -47,7 +47,7 @@ ** External Declarations */ -const CFE_ES_MemOffset_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = +const size_t CFE_SB_MemPoolDefSize[CFE_PLATFORM_ES_POOL_MAX_BUCKETS] = { CFE_PLATFORM_SB_MAX_BLOCK_SIZE, CFE_PLATFORM_SB_MEM_BLOCK_SIZE_16, diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.h b/fsw/cfe-core/src/sb/cfe_sb_priv.h index efc015f79..758beca92 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.h +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.h @@ -116,7 +116,7 @@ typedef struct { CFE_SB_MsgId_t MsgId; uint16 UseCount; - uint32 Size; + size_t Size; void *Buffer; } CFE_SB_BufferD_t; @@ -133,7 +133,7 @@ typedef struct { typedef struct { CFE_ES_ResourceID_t AppID; - uint32 Size; + size_t Size; void *Buffer; void *Next; void *Prev; @@ -249,7 +249,7 @@ void CFE_SB_ProcessCmdPipePkt(void); void CFE_SB_ResetCounters(void); void CFE_SB_SetMsgSeqCnt(CFE_SB_MsgPtr_t MsgPtr,uint32 Count); char *CFE_SB_GetAppTskName(CFE_ES_ResourceID_t TaskId, char* FullName); -CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, uint16 Size); +CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, size_t Size); CFE_SB_BufferD_t *CFE_SB_GetBufferFromCaller(CFE_SB_MsgId_t MsgId, void *Address); CFE_SB_PipeD_t *CFE_SB_GetPipePtr(CFE_SB_PipeId_t PipeId); CFE_SB_PipeId_t CFE_SB_GetAvailPipeIdx(void); @@ -360,7 +360,7 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI ** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, ** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr); +size_t CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr); /* diff --git a/fsw/cfe-core/src/sb/cfe_sb_task.c b/fsw/cfe-core/src/sb/cfe_sb_task.c index 97c587186..089d1f00d 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_task.c +++ b/fsw/cfe-core/src/sb/cfe_sb_task.c @@ -323,10 +323,10 @@ int32 CFE_SB_AppInit(void){ ** Return: ** true if length is acceptable */ -bool CFE_SB_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_SB_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 @@ -783,7 +783,7 @@ int32 CFE_SB_SendRoutingInfoCmd(const CFE_SB_SendRoutingInfo_t *data) ptr = &data->Payload; CFE_SB_MessageStringGet(LocalFilename, ptr->Filename, CFE_PLATFORM_SB_DEFAULT_ROUTING_FILENAME, - OS_MAX_PATH_LEN, sizeof(ptr->Filename)); + sizeof(LocalFilename), sizeof(ptr->Filename)); Stat = CFE_SB_SendRtgInfo(LocalFilename); CFE_SB_IncrCmdCtr(Stat); @@ -813,7 +813,7 @@ int32 CFE_SB_SendPipeInfoCmd(const CFE_SB_SendPipeInfo_t *data) ptr = &data->Payload; CFE_SB_MessageStringGet(LocalFilename, ptr->Filename, CFE_PLATFORM_SB_DEFAULT_PIPE_FILENAME, - OS_MAX_PATH_LEN, sizeof(ptr->Filename)); + sizeof(LocalFilename), sizeof(ptr->Filename)); Stat = CFE_SB_SendPipeInfo(LocalFilename); CFE_SB_IncrCmdCtr(Stat); @@ -843,7 +843,7 @@ int32 CFE_SB_SendMapInfoCmd(const CFE_SB_SendMapInfo_t *data) ptr = &data->Payload; CFE_SB_MessageStringGet(LocalFilename, ptr->Filename, CFE_PLATFORM_SB_DEFAULT_MAP_FILENAME, - OS_MAX_PATH_LEN, sizeof(ptr->Filename)); + sizeof(LocalFilename), sizeof(ptr->Filename)); Stat = CFE_SB_SendMapInfo(LocalFilename); diff --git a/fsw/cfe-core/src/sb/cfe_sb_util.c b/fsw/cfe-core/src/sb/cfe_sb_util.c index 1cc61fbc5..ee7081075 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_util.c @@ -47,7 +47,7 @@ */ void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, - uint16 Length, + size_t Length, bool Clear ) { @@ -67,10 +67,9 @@ void CFE_SB_InitMsg(void *MsgPtr, ** Return: ** Size of Message Header. */ -uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) +size_t CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) { - - uint16 size = 0; + size_t size = 0; bool hassechdr = false; CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; @@ -103,7 +102,7 @@ uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) { uint8 *BytePtr; - uint16 HdrSize; + size_t HdrSize; BytePtr = (uint8 *)MsgPtr; HdrSize = CFE_SB_MsgHdrSize(MsgPtr); @@ -115,24 +114,25 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_GetUserDataLength - See API and header file for details */ -uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) +size_t CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) { - uint32 TotalMsgSize; - uint16 HdrSize; + CFE_MSG_Size_t TotalMsgSize; + size_t HdrSize; CFE_MSG_GetSize(MsgPtr, &TotalMsgSize); HdrSize = CFE_SB_MsgHdrSize(MsgPtr); - return (TotalMsgSize - HdrSize); + return TotalMsgSize - HdrSize; }/* end CFE_SB_GetUserDataLength */ /* * Function: CFE_SB_SetUserDataLength - See API and header file for details */ -void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) +void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, size_t DataLength) { - uint32 TotalMsgSize, HdrSize; + CFE_MSG_Size_t TotalMsgSize; + size_t HdrSize; HdrSize = CFE_SB_MsgHdrSize(MsgPtr); TotalMsgSize = HdrSize + DataLength; @@ -144,15 +144,14 @@ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) /* * Function: CFE_SB_GetTotalMsgLength - See API and header file for details */ -uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) +size_t CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) { CFE_MSG_Size_t size; CFE_MSG_GetSize(MsgPtr, &size); - /* Known bug that this API can't return maximum ccsds size */ - return (uint16)size; + return size; }/* end CFE_SB_GetTotalMsgLength */ @@ -160,7 +159,7 @@ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) /* * Function: CFE_SB_SetTotalMsgLength - See API and header file for details */ -void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) +void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,size_t TotalLength) { CFE_MSG_SetSize(MsgPtr, TotalLength); @@ -279,7 +278,7 @@ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_MessageStringGet - See API and header file for details */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, uint32 DestMaxSize, uint32 SourceMaxSize) +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize) { int32 Result; @@ -331,7 +330,7 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, /* * Function: CFE_SB_MessageStringSet - See API and header file for details */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, uint32 DestMaxSize, uint32 SourceMaxSize) +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize) { int32 Result; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_api.c b/fsw/cfe-core/src/tbl/cfe_tbl_api.c index b28e72232..c032c938b 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_api.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_api.c @@ -50,7 +50,7 @@ */ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, const char *Name, - uint32 Size, + size_t Size, uint16 TblOptionFlags, CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr ) { @@ -368,7 +368,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* possible at this point during table registration. But we */ /* do need to handle the error case because if the function */ /* call did fail, WorkingBufferPtr would be a NULL pointer. */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to get work buffer for '%s.%s' (ErrCode=0x%08X)\n", AppName, Name, (unsigned int)Status); } @@ -379,7 +379,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, if (Status != CFE_SUCCESS) { - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to recover '%s.%s' from CDS (ErrCode=0x%08X)\n", AppName, Name, (unsigned int)Status); } @@ -422,7 +422,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, { /* If an error occurred while trying to get the previous contents registry info, */ /* Log the error in the System Log and pretend like we created a new CDS */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_ES_WriteToSysLog("CFE_TBL:Register-Failed to recover '%s.%s' info from CDS TblReg\n", AppName, Name); Status = CFE_SUCCESS; @@ -490,7 +490,7 @@ int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, *TblHandlePtr = CFE_TBL_BAD_TABLE_HANDLE; /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_EVS_SendEventWithAppID(CFE_TBL_REGISTER_ERR_EID, CFE_EVS_EventType_ERROR, @@ -589,7 +589,7 @@ int32 CFE_TBL_Share( CFE_TBL_Handle_t *TblHandlePtr, if (Status < 0) { /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_EVS_SendEventWithAppID(CFE_TBL_SHARE_ERR_EID, CFE_EVS_EventType_ERROR, @@ -653,7 +653,7 @@ int32 CFE_TBL_Unregister ( CFE_TBL_Handle_t TblHandle ) if (Status < 0) { /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); CFE_EVS_SendEventWithAppID(CFE_TBL_UNREGISTER_ERR_EID, CFE_EVS_EventType_ERROR, @@ -702,7 +702,7 @@ int32 CFE_TBL_Load( CFE_TBL_Handle_t TblHandle, RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex]; /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Initialize return pointer to NULL */ WorkingBufferPtr = NULL; @@ -941,7 +941,7 @@ int32 CFE_TBL_Update( CFE_TBL_Handle_t TblHandle ) if (Status != CFE_TBL_ERR_BAD_APP_ID) { /* Translate AppID of caller into App Name */ - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); } /* On Error conditions, notify ground of screw up */ @@ -1142,7 +1142,7 @@ int32 CFE_TBL_Validate( CFE_TBL_Handle_t TblHandle ) AccessDescPtr = &CFE_TBL_TaskData.Handles[TblHandle]; RegRecPtr = &CFE_TBL_TaskData.Registry[AccessDescPtr->RegIndex]; - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Identify the image to be validated, starting with the Inactive Buffer */ if (RegRecPtr->ValidateInactiveIndex != CFE_TBL_NO_VALIDATION_PENDING) diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c index d5334759d..e7b861fe8 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c @@ -156,7 +156,7 @@ int32 CFE_TBL_EarlyInit (void) /* Initialize memory partition and allocate shared table buffers. */ Status = CFE_ES_PoolCreate(&CFE_TBL_TaskData.Buf.PoolHdl, CFE_TBL_TaskData.Buf.Partition.Data, - CFE_PLATFORM_TBL_BUF_MEMORY_BYTES); + sizeof(CFE_TBL_TaskData.Buf.Partition)); if(Status < 0) { @@ -682,7 +682,7 @@ void CFE_TBL_FormTableName(char *FullTblName, const char *TblName, CFE_ES_Resour { char AppName[OS_MAX_API_NAME]; - CFE_ES_GetAppName(AppName, ThisAppId, OS_MAX_API_NAME); + CFE_ES_GetAppName(AppName, ThisAppId, sizeof(AppName)); /* Ensure that AppName is null terminated */ AppName[OS_MAX_API_NAME-1] = '\0'; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.c b/fsw/cfe-core/src/tbl/cfe_tbl_task.c index d1b4ffa59..8e44405a3 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.c @@ -265,7 +265,7 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(MessagePtr); uint16 CommandCode = CFE_SB_GetCmdCode(MessagePtr); int16 CmdIndx; - uint32 ActualLength; + size_t ActualLength; CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ /* Search the Command Handler Table for a matching message */ diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.h b/fsw/cfe-core/src/tbl/cfe_tbl_task.h index 96af49979..4f1d24d70 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.h @@ -185,7 +185,7 @@ typedef struct typedef struct { CFE_ES_ResourceID_t OwnerAppId; /**< \brief Application ID of App that Registered Table */ - uint32 Size; /**< \brief Size, in bytes, of Table */ + size_t Size; /**< \brief Size, in bytes, of Table */ CFE_SB_MsgId_t NotificationMsgId; /**< \brief Message ID of an associated management notification message */ uint32 NotificationParam; /**< \brief Parameter of an associated management notification message */ CFE_TBL_LoadBuff_t Buffers[2]; /**< \brief Active and Inactive Buffer Pointers */ @@ -238,7 +238,7 @@ typedef struct typedef struct { CFE_TBL_DumpState_t State; /**< \brief Current state of this block of data */ - uint32 Size; /**< \brief Number of bytes to be dumped */ + size_t Size; /**< \brief Number of bytes to be dumped */ CFE_TBL_LoadBuff_t *DumpBufferPtr; /**< \brief Address where dumped data is to be stored temporarily */ CFE_TBL_RegistryRec_t *RegRecPtr; /**< \brief Ptr to dumped table's registry record */ char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Name of Table being Dumped */ @@ -253,7 +253,7 @@ typedef struct */ typedef struct { - uint32 Size; /**< \brief Size, in bytes, of Table */ + CFE_ES_MemOffset_Atom_t Size; /**< \brief Size, in bytes, of Table */ CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ uint32 NumUsers; /**< \brief Number of applications that are sharing the table */ int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c index 39048e696..197d96fd2 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c @@ -274,31 +274,31 @@ void CFE_TBL_GetTblRegData(void) RegRecPtr = &CFE_TBL_TaskData.Registry[CFE_TBL_TaskData.HkTlmTblRegIndex]; - CFE_TBL_TaskData.TblRegPacket.Payload.Size = RegRecPtr->Size; - CFE_SB_SET_MEMADDR(CFE_TBL_TaskData.TblRegPacket.Payload.ActiveBufferAddr, - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr); + CFE_TBL_TaskData.TblRegPacket.Payload.Size = CFE_ES_MEMOFFSET_ATOM(RegRecPtr->Size); + CFE_TBL_TaskData.TblRegPacket.Payload.ActiveBufferAddr = + CFE_ES_MEMADDRESS_ATOM(RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].BufferPtr); if (RegRecPtr->DoubleBuffered) { /* For a double buffered table, the inactive is the other allocated buffer */ - CFE_SB_SET_MEMADDR(CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr, - RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr); + CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr = + CFE_ES_MEMADDRESS_ATOM(RegRecPtr->Buffers[(1U-RegRecPtr->ActiveBufferIndex)].BufferPtr); } else { /* Check to see if an inactive buffer has currently been allocated to the single buffered table */ if (RegRecPtr->LoadInProgress != CFE_TBL_NO_LOAD_IN_PROGRESS) { - CFE_SB_SET_MEMADDR(CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr, - CFE_TBL_TaskData.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); + CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr = + CFE_ES_MEMADDRESS_ATOM(CFE_TBL_TaskData.LoadBuffs[RegRecPtr->LoadInProgress].BufferPtr); } else { - CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr = 0; + CFE_TBL_TaskData.TblRegPacket.Payload.InactiveBufferAddr = CFE_ES_MEMADDRESS_ATOM(0); } } - CFE_SB_SET_MEMADDR(CFE_TBL_TaskData.TblRegPacket.Payload.ValidationFuncPtr, RegRecPtr->ValidationFuncPtr); + CFE_TBL_TaskData.TblRegPacket.Payload.ValidationFuncPtr = CFE_ES_MEMADDRESS_ATOM(RegRecPtr->ValidationFuncPtr); CFE_TBL_TaskData.TblRegPacket.Payload.TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; CFE_TBL_TaskData.TblRegPacket.Payload.TableLoadedOnce = RegRecPtr->TableLoadedOnce; CFE_TBL_TaskData.TblRegPacket.Payload.LoadPending = RegRecPtr->LoadPending; @@ -382,7 +382,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_Load_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(LoadFilename, (char *)CmdPtr->LoadFilename, NULL, - OS_MAX_PATH_LEN, sizeof(CmdPtr->LoadFilename)); + sizeof(LoadFilename), sizeof(CmdPtr->LoadFilename)); /* Try to open the specified table file */ Status = OS_OpenCreate(&FileDescriptor, LoadFilename, OS_FILE_FLAG_NONE, OS_READ_ONLY); @@ -588,10 +588,10 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_Dump_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(DumpFilename, (char *)CmdPtr->DumpFilename, NULL, - OS_MAX_PATH_LEN, sizeof(CmdPtr->DumpFilename)); + sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -730,7 +730,7 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_Dump_t *data) ** NOTE: For complete prolog information, see prototype above ********************************************************************/ -CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *TableName, const void *DumpDataAddr, uint32 TblSizeInBytes) +CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *TableName, const void *DumpDataAddr, size_t TblSizeInBytes) { CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ bool FileExistedPrev = false; @@ -769,8 +769,8 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T /* Initialize the Table Image Header for the Dump File */ strncpy(TblFileHeader.TableName, TableName, sizeof(TblFileHeader.TableName)-1); TblFileHeader.TableName[sizeof(TblFileHeader.TableName)-1] = 0; - TblFileHeader.Offset = 0; - TblFileHeader.NumBytes = TblSizeInBytes; + TblFileHeader.Offset = CFE_ES_MEMOFFSET_ATOM(0); + TblFileHeader.NumBytes = CFE_ES_MEMOFFSET_ATOM(TblSizeInBytes); TblFileHeader.Reserved = 0; /* Determine if this is a little endian processor */ @@ -795,7 +795,7 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *T DumpDataAddr, TblSizeInBytes); - if (Status == (int32)TblSizeInBytes) + if (Status == TblSizeInBytes) { if (FileExistedPrev) { @@ -878,7 +878,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_Validate_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1034,7 +1034,7 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_Activate_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table that is to be dumped exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1133,7 +1133,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data) /* Copy the commanded filename into local buffer to ensure size limitation and to allow for modification */ CFE_SB_MessageStringGet(DumpFilename, (char *)CmdPtr->DumpFilename, CFE_PLATFORM_TBL_DEFAULT_REG_DUMP_FILE, - OS_MAX_PATH_LEN, sizeof(CmdPtr->DumpFilename)); + sizeof(DumpFilename), sizeof(CmdPtr->DumpFilename)); /* Check to see if the dump file already exists */ Status = OS_OpenCreate(&FileDescriptor, DumpFilename, OS_FILE_FLAG_NONE, OS_READ_ONLY); @@ -1172,7 +1172,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistry_t *data) (RegRecPtr->HeadOfAccessList != CFE_TBL_END_OF_LIST)) { /* Fill Registry Dump Record with relevant information */ - DumpRecord.Size = RegRecPtr->Size; + DumpRecord.Size = CFE_ES_MEMOFFSET_ATOM(RegRecPtr->Size); DumpRecord.TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; DumpRecord.LoadInProgress = RegRecPtr->LoadInProgress; DumpRecord.ValidationFunc = (RegRecPtr->ValidationFuncPtr != NULL); @@ -1310,7 +1310,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistry_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table registry entry that is to be telemetered exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); @@ -1360,7 +1360,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDS_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table is no longer in the registry */ /* This would imply that the owning application has been terminated and that it */ @@ -1456,7 +1456,7 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoad_t *data) /* Make sure all strings are null terminated before attempting to process them */ CFE_SB_MessageStringGet(TableName, (char *)CmdPtr->TableName, NULL, - CFE_TBL_MAX_FULL_NAME_LEN, sizeof(CmdPtr->TableName)); + sizeof(TableName), sizeof(CmdPtr->TableName)); /* Before doing anything, lets make sure the table registry entry that is to be telemetered exists */ RegIndex = CFE_TBL_FindTableInRegistry(TableName); diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h index c2f4f1aeb..f95fa43c5 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h @@ -73,7 +73,7 @@ typedef enum typedef struct { CFE_SB_MsgId_t MsgId; /**< \brief Acceptable Message ID */ uint32 CmdCode; /**< \brief Acceptable Command Code (if necessary) */ - uint32 ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ + size_t ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ CFE_TBL_MsgProcFuncPtr_t MsgProcFuncPtr; /**< \brief Pointer to function to handle message */ CFE_TBL_MsgType_t MsgTypes; /**< \brief Message Type (i.e. - with/without Cmd Code) */ } CFE_TBL_CmdHandlerTblRec_t; @@ -329,7 +329,7 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoad_t *data); ** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR ******************************************************************************/ extern CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile( const char *DumpFilename, const char *TableName, - const void *DumpDataAddr, uint32 TblSizeInBytes); + const void *DumpDataAddr, size_t TblSizeInBytes); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/src/time/cfe_time_task.c b/fsw/cfe-core/src/time/cfe_time_task.c index 0f7ef3a50..d9e4a095f 100644 --- a/fsw/cfe-core/src/time/cfe_time_task.c +++ b/fsw/cfe-core/src/time/cfe_time_task.c @@ -241,7 +241,7 @@ int32 CFE_TIME_TaskInit(void) CFE_TIME_Tone1HzTask, CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE, - CFE_PLATFORM_TIME_TONE_TASK_PRIORITY, + CFE_ES_TASKPRIORITY_ATOM(CFE_PLATFORM_TIME_TONE_TASK_PRIORITY), CFE_TIME_TASK_FLAGS); if(Status != CFE_SUCCESS) { @@ -255,7 +255,7 @@ int32 CFE_TIME_TaskInit(void) CFE_TIME_Local1HzTask, CFE_TIME_TASK_STACK_PTR, CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE, - CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY, + CFE_ES_TASKPRIORITY_ATOM(CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY), CFE_TIME_TASK_FLAGS); if(Status != CFE_SUCCESS) { @@ -427,10 +427,10 @@ int32 CFE_TIME_TaskInit(void) ** Return: ** true if length is acceptable */ -bool CFE_TIME_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_TIME_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 diff --git a/fsw/cfe-core/src/time/cfe_time_utils.h b/fsw/cfe-core/src/time/cfe_time_utils.h index d89f19350..bb0ee47f5 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.h +++ b/fsw/cfe-core/src/time/cfe_time_utils.h @@ -62,7 +62,7 @@ */ #define CFE_TIME_TASK_TONE_NAME "TIME_TONE_TASK" #define CFE_TIME_TASK_1HZ_NAME "TIME_1HZ_TASK" -#define CFE_TIME_TASK_STACK_PTR 0 +#define CFE_TIME_TASK_STACK_PTR CFE_ES_TASK_STACK_ALLOCATE #define CFE_TIME_TASK_FLAGS 0 /* diff --git a/fsw/cfe-core/ut-stubs/ut_es_stubs.c b/fsw/cfe-core/ut-stubs/ut_es_stubs.c index f9c26c407..2d7f17e0e 100644 --- a/fsw/cfe-core/ut-stubs/ut_es_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_es_stubs.c @@ -107,13 +107,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); @@ -296,7 +296,7 @@ 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); @@ -450,9 +450,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); @@ -560,7 +558,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); @@ -593,9 +591,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); @@ -633,12 +629,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); @@ -776,10 +772,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); @@ -1111,7 +1104,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); diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index 1683dc65b..b8e3f50db 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -377,10 +377,10 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) ** This function does not return a value. ** ******************************************************************************/ -void CFE_SB_InitMsg(void *MsgPtr, +void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, - uint16 Length, - bool Clear) + size_t Length, + bool Clear ) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_InitMsg), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_InitMsg), MsgId); @@ -729,7 +729,7 @@ void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr) ** Returns a user-defined status value, UT_SB_TotalMsgLen. ** ******************************************************************************/ -uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) +size_t CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetTotalMsgLength), MsgPtr); @@ -779,7 +779,7 @@ int32 CFE_SB_CleanUpApp(uint32 AppId) ** See function prototype for full description ** */ -int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, uint32 DestMaxSize, uint32 SourceMaxSize) +int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, size_t DestMaxSize, size_t SourceMaxSize) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), DestStringPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringGet), SourceStringPtr); @@ -826,7 +826,7 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, ** See function prototype for full description ** */ -int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, uint32 DestMaxSize, uint32 SourceMaxSize) +int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize, size_t SourceMaxSize) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), DestStringPtr); UT_Stub_RegisterContext(UT_KEY(CFE_SB_MessageStringSet), SourceStringPtr); @@ -942,7 +942,7 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) return Result; } -void CFE_SB_SetTotalMsgLength (CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) +void CFE_SB_SetTotalMsgLength (CFE_SB_MsgPtr_t MsgPtr,size_t TotalLength) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetTotalMsgLength), TotalLength); @@ -999,7 +999,7 @@ int32 CFE_SB_GetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 *OptPtr) return status; } -uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) +size_t CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) { UT_Stub_RegisterContext(UT_KEY(CFE_SB_GetUserDataLength), MsgPtr); @@ -1048,7 +1048,7 @@ int32 CFE_SB_SetPipeOpts(CFE_SB_PipeId_t PipeId, uint8 Opts) return status; } -void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) +void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, size_t DataLength) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetUserDataLength), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_SetUserDataLength), DataLength); @@ -1069,7 +1069,7 @@ int32 CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId) return status; } -CFE_SB_Msg_t* CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) +CFE_SB_Msg_t* CFE_SB_ZeroCopyGetPtr(size_t MsgSize, CFE_SB_ZeroCopyHandle_t *BufferHandle) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_SB_ZeroCopyGetPtr), MsgSize); UT_Stub_RegisterContext(UT_KEY(CFE_SB_ZeroCopyGetPtr), BufferHandle); diff --git a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c index 32a3b2144..c92508300 100644 --- a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c @@ -101,7 +101,7 @@ int32 CFE_TBL_CleanUpApp(uint32 AppId) int32 CFE_TBL_Register( CFE_TBL_Handle_t *TblHandlePtr, /* Returned Handle */ const char *Name, /* Application specific name */ - uint32 Size, /* Size, in bytes, of table */ + size_t Size, /* Size, in bytes, of table */ uint16 TblOptionFlags, /* Tbl Options Settings */ CFE_TBL_CallbackFuncPtr_t TblValidationFuncPtr ) /* Ptr to func that validates tbl */ {