From 7eab9a07b737c35f83a3f0ec4602bd6d7d71f5a7 Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Tue, 18 Apr 2023 22:03:44 +1000 Subject: [PATCH] Fix #1527, Implement common command-handler return pattern across cFE --- modules/core_api/fsw/inc/cfe_error.h | 16 +-- modules/es/fsw/src/cfe_es_dispatch.c | 65 +++++---- modules/es/fsw/src/cfe_es_perf.c | 29 ++-- modules/es/fsw/src/cfe_es_task.c | 173 +++++++---------------- modules/sb/fsw/src/cfe_sb_dispatch.c | 32 +++-- modules/sb/fsw/src/cfe_sb_priv.h | 10 -- modules/sb/fsw/src/cfe_sb_task.c | 81 +++++------ modules/tbl/fsw/src/cfe_tbl_dispatch.c | 14 +- modules/tbl/fsw/src/cfe_tbl_task_cmds.c | 62 ++++---- modules/tbl/fsw/src/cfe_tbl_task_cmds.h | 61 +++----- modules/tbl/ut-coverage/tbl_UT.c | 140 +++++++++--------- modules/time/fsw/src/cfe_time_dispatch.c | 50 ++++--- modules/time/fsw/src/cfe_time_task.c | 152 ++++++++++---------- modules/time/fsw/src/cfe_time_utils.h | 10 +- 14 files changed, 421 insertions(+), 474 deletions(-) diff --git a/modules/core_api/fsw/inc/cfe_error.h b/modules/core_api/fsw/inc/cfe_error.h index bd7138478..718ae628a 100644 --- a/modules/core_api/fsw/inc/cfe_error.h +++ b/modules/core_api/fsw/inc/cfe_error.h @@ -154,6 +154,14 @@ char *CFE_ES_StatusToString(CFE_Status_t status, CFE_StatusString_t *status_stri */ #define CFE_STATUS_NO_COUNTER_INCREMENT ((CFE_Status_t)0x48000001) +/** + * @brief Command Execution Failure + * + * This error code will be returned when a command function fails + * to successfully execute its command + */ +#define CFE_STATUS_COMMAND_FAILURE ((CFE_Status_t)0xc8000001) + /** * @brief Wrong Message Length * @@ -1251,14 +1259,6 @@ char *CFE_ES_StatusToString(CFE_Status_t status, CFE_StatusString_t *status_stri */ #define CFE_TBL_ERR_BAD_PROCESSOR_ID ((CFE_Status_t)0xcc000029) -/** - * @brief Message Error - * - * Error code indicating that the TBL command was not processed - * successfully and that the error counter should be incremented. - */ -#define CFE_TBL_MESSAGE_ERROR ((CFE_Status_t)0xcc00002a) - /** ** Error code indicating that the TBL file is shorter than ** indicated in the file header. diff --git a/modules/es/fsw/src/cfe_es_dispatch.c b/modules/es/fsw/src/cfe_es_dispatch.c index 2d0df7172..09a44dfb8 100644 --- a/modules/es/fsw/src/cfe_es_dispatch.c +++ b/modules/es/fsw/src/cfe_es_dispatch.c @@ -79,6 +79,7 @@ void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; + CFE_Status_t Status = CFE_STATUS_NO_COUNTER_INCREMENT; CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); switch (CFE_SB_MsgIdToValue(MessageID)) @@ -101,168 +102,168 @@ void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) case CFE_ES_NOOP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_NoopCmd_t))) { - CFE_ES_NoopCmd((const CFE_ES_NoopCmd_t *)SBBufPtr); + Status = CFE_ES_NoopCmd((const CFE_ES_NoopCmd_t *)SBBufPtr); } break; case CFE_ES_RESET_COUNTERS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCountersCmd_t))) { - CFE_ES_ResetCountersCmd((const CFE_ES_ResetCountersCmd_t *)SBBufPtr); + Status = CFE_ES_ResetCountersCmd((const CFE_ES_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_ES_RESTART_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartCmd_t))) { - CFE_ES_RestartCmd((const CFE_ES_RestartCmd_t *)SBBufPtr); + Status = CFE_ES_RestartCmd((const CFE_ES_RestartCmd_t *)SBBufPtr); } break; case CFE_ES_START_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartAppCmd_t))) { - CFE_ES_StartAppCmd((const CFE_ES_StartAppCmd_t *)SBBufPtr); + Status = CFE_ES_StartAppCmd((const CFE_ES_StartAppCmd_t *)SBBufPtr); } break; case CFE_ES_STOP_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopAppCmd_t))) { - CFE_ES_StopAppCmd((const CFE_ES_StopAppCmd_t *)SBBufPtr); + Status = CFE_ES_StopAppCmd((const CFE_ES_StopAppCmd_t *)SBBufPtr); } break; case CFE_ES_RESTART_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartAppCmd_t))) { - CFE_ES_RestartAppCmd((const CFE_ES_RestartAppCmd_t *)SBBufPtr); + Status = CFE_ES_RestartAppCmd((const CFE_ES_RestartAppCmd_t *)SBBufPtr); } break; case CFE_ES_RELOAD_APP_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadAppCmd_t))) { - CFE_ES_ReloadAppCmd((const CFE_ES_ReloadAppCmd_t *)SBBufPtr); + Status = CFE_ES_ReloadAppCmd((const CFE_ES_ReloadAppCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ONE_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOneCmd_t))) { - CFE_ES_QueryOneCmd((const CFE_ES_QueryOneCmd_t *)SBBufPtr); + Status = CFE_ES_QueryOneCmd((const CFE_ES_QueryOneCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ALL_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllCmd_t))) { - CFE_ES_QueryAllCmd((const CFE_ES_QueryAllCmd_t *)SBBufPtr); + Status = CFE_ES_QueryAllCmd((const CFE_ES_QueryAllCmd_t *)SBBufPtr); } break; case CFE_ES_QUERY_ALL_TASKS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasksCmd_t))) { - CFE_ES_QueryAllTasksCmd((const CFE_ES_QueryAllTasksCmd_t *)SBBufPtr); + Status = CFE_ES_QueryAllTasksCmd((const CFE_ES_QueryAllTasksCmd_t *)SBBufPtr); } break; case CFE_ES_CLEAR_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSysLogCmd_t))) { - CFE_ES_ClearSysLogCmd((const CFE_ES_ClearSysLogCmd_t *)SBBufPtr); + Status = CFE_ES_ClearSysLogCmd((const CFE_ES_ClearSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_WRITE_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSysLogCmd_t))) { - CFE_ES_WriteSysLogCmd((const CFE_ES_WriteSysLogCmd_t *)SBBufPtr); + Status = CFE_ES_WriteSysLogCmd((const CFE_ES_WriteSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_OVER_WRITE_SYSLOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSysLogCmd_t))) { - CFE_ES_OverWriteSysLogCmd((const CFE_ES_OverWriteSysLogCmd_t *)SBBufPtr); + Status = CFE_ES_OverWriteSysLogCmd((const CFE_ES_OverWriteSysLogCmd_t *)SBBufPtr); } break; case CFE_ES_CLEAR_ER_LOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLogCmd_t))) { - CFE_ES_ClearERLogCmd((const CFE_ES_ClearERLogCmd_t *)SBBufPtr); + Status = CFE_ES_ClearERLogCmd((const CFE_ES_ClearERLogCmd_t *)SBBufPtr); } break; case CFE_ES_WRITE_ER_LOG_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLogCmd_t))) { - CFE_ES_WriteERLogCmd((const CFE_ES_WriteERLogCmd_t *)SBBufPtr); + Status = CFE_ES_WriteERLogCmd((const CFE_ES_WriteERLogCmd_t *)SBBufPtr); } break; case CFE_ES_START_PERF_DATA_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfDataCmd_t))) { - CFE_ES_StartPerfDataCmd((const CFE_ES_StartPerfDataCmd_t *)SBBufPtr); + Status = CFE_ES_StartPerfDataCmd((const CFE_ES_StartPerfDataCmd_t *)SBBufPtr); } break; case CFE_ES_STOP_PERF_DATA_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfDataCmd_t))) { - CFE_ES_StopPerfDataCmd((const CFE_ES_StopPerfDataCmd_t *)SBBufPtr); + Status = CFE_ES_StopPerfDataCmd((const CFE_ES_StopPerfDataCmd_t *)SBBufPtr); } break; case CFE_ES_SET_PERF_FILTER_MASK_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMaskCmd_t))) { - CFE_ES_SetPerfFilterMaskCmd((const CFE_ES_SetPerfFilterMaskCmd_t *)SBBufPtr); + Status = CFE_ES_SetPerfFilterMaskCmd((const CFE_ES_SetPerfFilterMaskCmd_t *)SBBufPtr); } break; case CFE_ES_SET_PERF_TRIGGER_MASK_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMaskCmd_t))) { - CFE_ES_SetPerfTriggerMaskCmd((const CFE_ES_SetPerfTriggerMaskCmd_t *)SBBufPtr); + Status = CFE_ES_SetPerfTriggerMaskCmd((const CFE_ES_SetPerfTriggerMaskCmd_t *)SBBufPtr); } break; case CFE_ES_RESET_PR_COUNT_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCountCmd_t))) { - CFE_ES_ResetPRCountCmd((const CFE_ES_ResetPRCountCmd_t *)SBBufPtr); + Status = CFE_ES_ResetPRCountCmd((const CFE_ES_ResetPRCountCmd_t *)SBBufPtr); } break; case CFE_ES_SET_MAX_PR_COUNT_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCountCmd_t))) { - CFE_ES_SetMaxPRCountCmd((const CFE_ES_SetMaxPRCountCmd_t *)SBBufPtr); + Status = CFE_ES_SetMaxPRCountCmd((const CFE_ES_SetMaxPRCountCmd_t *)SBBufPtr); } break; case CFE_ES_DELETE_CDS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDSCmd_t))) { - CFE_ES_DeleteCDSCmd((const CFE_ES_DeleteCDSCmd_t *)SBBufPtr); + Status = CFE_ES_DeleteCDSCmd((const CFE_ES_DeleteCDSCmd_t *)SBBufPtr); } break; case CFE_ES_SEND_MEM_POOL_STATS_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStatsCmd_t))) { - CFE_ES_SendMemPoolStatsCmd((const CFE_ES_SendMemPoolStatsCmd_t *)SBBufPtr); + Status = CFE_ES_SendMemPoolStatsCmd((const CFE_ES_SendMemPoolStatsCmd_t *)SBBufPtr); } break; case CFE_ES_DUMP_CDS_REGISTRY_CC: if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistryCmd_t))) { - CFE_ES_DumpCDSRegistryCmd((const CFE_ES_DumpCDSRegistryCmd_t *)SBBufPtr); + Status = CFE_ES_DumpCDSRegistryCmd((const CFE_ES_DumpCDSRegistryCmd_t *)SBBufPtr); } break; @@ -270,9 +271,23 @@ void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ground command code: ID = 0x%X, CC = %d", (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); - CFE_ES_Global.TaskData.CommandErrorCounter++; + Status = CFE_STATUS_BAD_COMMAND_CODE; break; } + + /* + * Any command functions returning a Status of CFE_STATUS_NO_COUNTER_INCREMENT + * will not increment either counter + */ + if (Status == CFE_SUCCESS) + { + CFE_ES_Global.TaskData.CommandCounter++; + } + else if ((Status == CFE_STATUS_COMMAND_FAILURE) || (Status == CFE_STATUS_BAD_COMMAND_CODE)) + { + CFE_ES_Global.TaskData.CommandErrorCounter++; + } + break; default: diff --git a/modules/es/fsw/src/cfe_es_perf.c b/modules/es/fsw/src/cfe_es_perf.c index 62233a6fa..aa344d23a 100644 --- a/modules/es/fsw/src/cfe_es_perf.c +++ b/modules/es/fsw/src/cfe_es_perf.c @@ -144,6 +144,7 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) const CFE_ES_StartPerfCmd_Payload_t *CmdPtr = &data->Payload; CFE_ES_PerfDumpGlobal_t * PerfDumpState = &CFE_ES_Global.BackgroundPerfDumpState; CFE_ES_PerfData_t * Perf; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Set the pointer to the data area @@ -157,7 +158,7 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) /* Make sure Trigger Mode is valid */ if (CmdPtr->TriggerMode < CFE_ES_PERF_MAX_MODES) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; /* Taking lock here as this might be changing states from one active mode to another. * In that case, need to make sure that the log is not written to while resetting the counters. */ @@ -177,7 +178,6 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID, CFE_EVS_EventType_ERROR, "Cannot start collecting performance data, trigger mode (%d) out of range (%d to %d)", (int)CmdPtr->TriggerMode, (int)CFE_ES_PERF_TRIGGER_START, (int)CFE_ES_PERF_TRIGGER_END); @@ -185,12 +185,11 @@ int32 CFE_ES_StartPerfDataCmd(const CFE_ES_StartPerfDataCmd_t *data) } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STARTCMD_ERR_EID, CFE_EVS_EventType_ERROR, "Cannot start collecting performance data,perf data write in progress"); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -205,6 +204,7 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) CFE_ES_PerfDumpGlobal_t * PerfDumpState = &CFE_ES_Global.BackgroundPerfDumpState; CFE_ES_PerfData_t * Perf; int32 Status; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Set the pointer to the data area @@ -231,8 +231,7 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) PerfDumpState->PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_BackgroundWakeup(); - CFE_ES_Global.TaskData.CommandCounter++; - + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_PERF_STOPCMD_EID, CFE_EVS_EventType_DEBUG, "Perf Stop Cmd Rcvd, will write %d entries.%dmS dly every %d entries", (int)Perf->MetaData.DataCount, (int)CFE_PLATFORM_ES_PERF_CHILD_MS_DELAY, @@ -240,7 +239,6 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_LOG_ERR_EID, CFE_EVS_EventType_ERROR, "Error parsing filename, RC = %d", (int)Status); } @@ -248,12 +246,11 @@ int32 CFE_ES_StopPerfDataCmd(const CFE_ES_StopPerfDataCmd_t *data) } /* if data to write == 0 */ else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_PERF_STOPCMD_ERR2_EID, CFE_EVS_EventType_ERROR, "Stop performance data cmd ignored,perf data write in progress"); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -493,6 +490,7 @@ int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMaskCmd_t *data) { const CFE_ES_SetPerfFilterMaskCmd_Payload_t *cmd = &data->Payload; CFE_ES_PerfData_t * Perf; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Set the pointer to the data area @@ -507,18 +505,16 @@ int32 CFE_ES_SetPerfFilterMaskCmd(const CFE_ES_SetPerfFilterMaskCmd_t *data) "Set Performance Filter Mask Cmd rcvd, num %u, val 0x%08X", (unsigned int)cmd->FilterMaskNum, (unsigned int)cmd->FilterMask); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } else { CFE_EVS_SendEvent(CFE_ES_PERF_FILTMSKERR_EID, CFE_EVS_EventType_ERROR, "Performance Filter Mask Cmd Error,Index(%u)out of range(%u)", (unsigned int)cmd->FilterMaskNum, (unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -531,6 +527,7 @@ int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) { const CFE_ES_SetPerfTrigMaskCmd_Payload_t *cmd = &data->Payload; CFE_ES_PerfData_t * Perf; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Set the pointer to the data area @@ -545,18 +542,16 @@ int32 CFE_ES_SetPerfTriggerMaskCmd(const CFE_ES_SetPerfTriggerMaskCmd_t *data) "Set Performance Trigger Mask Cmd rcvd,num %u, val 0x%08X", (unsigned int)cmd->TriggerMaskNum, (unsigned int)cmd->TriggerMask); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } else { CFE_EVS_SendEvent(CFE_ES_PERF_TRIGMSKERR_EID, CFE_EVS_EventType_ERROR, "Performance Trigger Mask Cmd Error,Index(%u)out of range(%u)", (unsigned int)cmd->TriggerMaskNum, (unsigned int)CFE_ES_PERF_32BIT_WORDS_IN_MASK); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index 4f03ba7c4..8db17fd74 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -565,11 +565,6 @@ int32 CFE_ES_NoopCmd(const CFE_ES_NoopCmd_t *Cmd) */ CFE_ES_GenerateBuildInfoEvents(); - /* - ** This command will always succeed. - */ - CFE_ES_Global.TaskData.CommandCounter++; - CFE_EVS_SendEvent(CFE_ES_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command:\n cFS Versions: cfe %s, osal %s, psp %s", CFE_SRC_VERSION, OS_GetVersionString(), CFE_PSP_GetVersionString()); @@ -593,7 +588,7 @@ int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCountersCmd_t *data) */ CFE_EVS_SendEvent(CFE_ES_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "Reset Counters command"); - return CFE_SUCCESS; + return CFE_STATUS_NO_COUNTER_INCREMENT; } /*---------------------------------------------------------------- @@ -604,11 +599,11 @@ int32 CFE_ES_ResetCountersCmd(const CFE_ES_ResetCountersCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data) { - const CFE_ES_RestartCmd_Payload_t *cmd = &data->Payload; + const CFE_ES_RestartCmd_Payload_t *cmd = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; if ((cmd->RestartType != CFE_PSP_RST_TYPE_PROCESSOR) && (cmd->RestartType != CFE_PSP_RST_TYPE_POWERON)) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_BOOT_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid cFE restart type: %d", (int)cmd->RestartType); } @@ -618,9 +613,10 @@ int32 CFE_ES_RestartCmd(const CFE_ES_RestartCmd_t *data) ** This function will not return. */ CFE_ES_ResetCFE(cmd->RestartType); + ReturnCode = CFE_STATUS_NO_COUNTER_INCREMENT; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -638,6 +634,7 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) int32 AppNameLen; char LocalAppName[OS_MAX_API_NAME]; CFE_ES_AppStartParams_t StartParams; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Create local copies of all input strings and ensure null termination */ Result = CFE_FS_ParseInputFileNameEx(StartParams.BasicInfo.FileName, cmd->AppFileName, @@ -656,32 +653,27 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) */ if (Result != CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_INVALID_FILENAME_ERR_EID, CFE_EVS_EventType_ERROR, "CFE_ES_StartAppCmd: invalid filename, status=%lx", (unsigned long)Result); } else if (AppEntryLen <= 0) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID, CFE_EVS_EventType_ERROR, "CFE_ES_StartAppCmd: App Entry Point is empty."); } else if (AppNameLen <= 0) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_NULL_APP_NAME_ERR_EID, CFE_EVS_EventType_ERROR, "CFE_ES_StartAppCmd: App Name is empty."); } else if (cmd->Priority > OS_MAX_PRIORITY) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_PRIORITY_ERR_EID, CFE_EVS_EventType_ERROR, "CFE_ES_StartAppCmd: Priority is too large: %d.", (int)cmd->Priority); } else if ((cmd->ExceptionAction != CFE_ES_ExceptionAction_RESTART_APP) && (cmd->ExceptionAction != CFE_ES_ExceptionAction_PROC_RESTART)) { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_EXC_ACTION_ERR_EID, CFE_EVS_EventType_ERROR, "CFE_ES_StartAppCmd: Invalid Exception Action: %d.", (int)cmd->ExceptionAction); } @@ -707,20 +699,19 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data) */ if (Result == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_START_INF_EID, CFE_EVS_EventType_INFORMATION, "Started %s from %s, AppID = %lu", LocalAppName, StartParams.BasicInfo.FileName, CFE_RESOURCEID_TO_ULONG(AppID)); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_START_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to start %s from %s, RC = 0x%08X", LocalAppName, StartParams.BasicInfo.FileName, (unsigned int)Result); } } /* End if -- command parameter validation */ - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -735,6 +726,7 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_t *data) char LocalApp[OS_MAX_API_NAME]; CFE_ES_AppId_t AppID; int32 Result; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); @@ -752,24 +744,22 @@ int32 CFE_ES_StopAppCmd(const CFE_ES_StopAppCmd_t *data) */ if (Result == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_STOP_DBG_EID, CFE_EVS_EventType_DEBUG, "Stop Application %s Initiated.", LocalApp); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_STOP_ERR1_EID, CFE_EVS_EventType_ERROR, "Stop Application %s Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_STOP_ERR2_EID, CFE_EVS_EventType_ERROR, "Stop Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, (unsigned int)Result); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -784,6 +774,7 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_t *data) char LocalApp[OS_MAX_API_NAME]; CFE_ES_AppId_t AppID; int32 Result; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); @@ -798,26 +789,24 @@ int32 CFE_ES_RestartAppCmd(const CFE_ES_RestartAppCmd_t *data) */ if (Result == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_RESTART_APP_DBG_EID, CFE_EVS_EventType_DEBUG, "Restart Application %s Initiated.", LocalApp); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR1_EID, CFE_EVS_EventType_ERROR, "Restart Application %s Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RESTART_APP_ERR2_EID, CFE_EVS_EventType_ERROR, "Restart Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, (unsigned int)Result); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -833,6 +822,7 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_t *data) char LocalFileName[OS_MAX_PATH_LEN]; CFE_ES_AppId_t AppID; int32 Result; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); @@ -856,25 +846,23 @@ int32 CFE_ES_ReloadAppCmd(const CFE_ES_ReloadAppCmd_t *data) */ if (Result == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_DBG_EID, CFE_EVS_EventType_DEBUG, "Reload Application %s Initiated.", LocalApp); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR1_EID, CFE_EVS_EventType_ERROR, "Reload Application %s Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_RELOAD_APP_ERR2_EID, CFE_EVS_EventType_ERROR, "Reload Application %s, GetAppIDByName failed. RC = 0x%08X.", LocalApp, (unsigned int)Result); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -887,13 +875,14 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) { const CFE_ES_AppNameCmd_Payload_t *cmd = &data->Payload; char LocalApp[OS_MAX_API_NAME]; + int32 Result; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; union { CFE_ES_AppId_t AppId; CFE_ES_LibId_t LibId; CFE_ResourceId_t ResourceID; } IdBuf; - int32 Result; CFE_SB_MessageStringGet(LocalApp, (char *)cmd->Application, NULL, sizeof(LocalApp), sizeof(cmd->Application)); @@ -921,25 +910,23 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOneCmd_t *data) Result = CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.OneAppPacket.TelemetryHeader), true); if (Result == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_ONE_APP_EID, CFE_EVS_EventType_DEBUG, "Sent %s application data", LocalApp); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_ONE_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to send %s application data, RC = 0x%08X", LocalApp, (unsigned int)Result); } } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_ONE_APPID_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to send %s application data: GetAppIDByName Failed, RC = 0x%08X", LocalApp, (unsigned int)Result); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -964,6 +951,7 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) uint32 NumResources; CFE_ES_AppRecord_t * AppRecPtr; CFE_ES_LibRecord_t * LibRecPtr; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* * Collect list of active resource IDs. @@ -1037,15 +1025,11 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) if (Result != sizeof(CFE_FS_Header_t)) { OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_WRHDR_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to write App Info file, WriteHdr RC = 0x%08X, exp %d", (unsigned int)Result, (int)sizeof(CFE_FS_Header_t)); - /* - * returning "success" here as there is no other recourse; - * the full extent of the error recovery has been done - */ - return CFE_SUCCESS; + + return CFE_STATUS_COMMAND_FAILURE; } /* @@ -1071,15 +1055,11 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) if (OsStatus != sizeof(CFE_ES_AppInfo_t)) { OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKWR_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to write App Info file, Task write RC = %ld, exp %d", (long)OsStatus, (int)sizeof(CFE_ES_AppInfo_t)); - /* - * returning "success" here as there is no other recourse; - * the full extent of the error recovery has been done - */ - return CFE_SUCCESS; + + return CFE_STATUS_COMMAND_FAILURE; } FileSize += sizeof(CFE_ES_AppInfo_t); @@ -1089,17 +1069,13 @@ int32 CFE_ES_QueryAllCmd(const CFE_ES_QueryAllCmd_t *data) } /* end for */ OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_ALL_APPS_EID, CFE_EVS_EventType_DEBUG, "App Info file written to %s, Entries=%d, FileSize=%d", QueryAllFilename, (int)EntryCount, (int)FileSize); } - else - { - CFE_ES_Global.TaskData.CommandErrorCounter++; - } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1123,6 +1099,7 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) CFE_ES_TaskId_t TaskList[OS_MAX_TASKS]; uint32 NumTasks; CFE_ES_TaskRecord_t * TaskRecPtr; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* * Collect list of active task IDs. @@ -1189,15 +1166,11 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) if (Result != sizeof(CFE_FS_Header_t)) { OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_WRHDR_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to write Task Info file, WriteHdr RC = 0x%08X, exp %d", (unsigned int)Result, (int)sizeof(CFE_FS_Header_t)); - /* - * returning "success" here as there is no other recourse; - * the full extent of the error recovery has been done - */ - return CFE_SUCCESS; + + return CFE_STATUS_COMMAND_FAILURE; } /* @@ -1223,15 +1196,11 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) if (OsStatus != sizeof(CFE_ES_TaskInfo_t)) { OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_TASKINFO_WR_ERR_EID, CFE_EVS_EventType_ERROR, "Failed to write Task Info file, Task write RC = %ld, exp %d", (long)OsStatus, (int)sizeof(CFE_ES_TaskInfo_t)); - /* - * returning "success" here as there is no other recourse; - * the full extent of the error recovery has been done - */ - return CFE_SUCCESS; + + return CFE_STATUS_COMMAND_FAILURE; } FileSize += sizeof(CFE_ES_TaskInfo_t); @@ -1241,17 +1210,13 @@ int32 CFE_ES_QueryAllTasksCmd(const CFE_ES_QueryAllTasksCmd_t *data) } /* end for */ OS_close(FileDescriptor); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_TASKINFO_EID, CFE_EVS_EventType_DEBUG, "Task Info file written to %s, Entries=%d, FileSize=%d", QueryAllFilename, (int)EntryCount, (int)FileSize); } - else - { - CFE_ES_Global.TaskData.CommandErrorCounter++; - } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1273,7 +1238,6 @@ int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data) /* ** This command will always succeed... */ - CFE_ES_Global.TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_SYSLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, "Cleared Executive Services log data"); return CFE_SUCCESS; @@ -1288,7 +1252,8 @@ int32 CFE_ES_ClearSysLogCmd(const CFE_ES_ClearSysLogCmd_t *data) int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) { int32 Status; - const CFE_ES_OverWriteSysLogCmd_Payload_t *CmdPtr = &data->Payload; + const CFE_ES_OverWriteSysLogCmd_Payload_t *CmdPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; Status = CFE_ES_SysLogSetMode(CmdPtr->Mode); @@ -1296,18 +1261,16 @@ int32 CFE_ES_OverWriteSysLogCmd(const CFE_ES_OverWriteSysLogCmd_t *data) { CFE_EVS_SendEvent(CFE_ES_ERR_SYSLOGMODE_EID, CFE_EVS_EventType_ERROR, "Set OverWriteSysLog Command: Invalid Mode setting = %d", (int)CmdPtr->Mode); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } else { CFE_EVS_SendEvent(CFE_ES_SYSLOGMODE_EID, CFE_EVS_EventType_DEBUG, "Set OverWriteSysLog Command Received with Mode setting = %d", (int)CmdPtr->Mode); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1321,6 +1284,7 @@ int32 CFE_ES_WriteSysLogCmd(const CFE_ES_WriteSysLogCmd_t *data) const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; int32 Stat; char LogFilename[OS_MAX_PATH_LEN]; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Copy the filename into local buffer with default name/path/extension if not specified @@ -1345,14 +1309,10 @@ int32 CFE_ES_WriteSysLogCmd(const CFE_ES_WriteSysLogCmd_t *data) if (Stat == CFE_SUCCESS) { - CFE_ES_Global.TaskData.CommandCounter++; - } - else - { - CFE_ES_Global.TaskData.CommandErrorCounter++; + ReturnCode = CFE_SUCCESS; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1383,7 +1343,6 @@ int32 CFE_ES_ClearERLogCmd(const CFE_ES_ClearERLogCmd_t *data) /* ** This command will always succeed */ - CFE_ES_Global.TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_ERLOG1_INF_EID, CFE_EVS_EventType_INFORMATION, "Cleared ES Exception and Reset Log data"); return CFE_SUCCESS; @@ -1400,6 +1359,7 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) const CFE_ES_FileNameCmd_Payload_t *CmdPtr = &data->Payload; CFE_ES_BackgroundLogDumpGlobal_t * StatePtr; int32 Status; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; StatePtr = &CFE_ES_Global.BackgroundERLogDumpState; @@ -1452,16 +1412,13 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLogCmd_t *data) CFE_EVS_SendEvent(CFE_ES_ERLOG2_ERR_EID, CFE_EVS_EventType_ERROR, "Error creating file, RC = %d", (int)Status); } - - /* background dump did not start, consider this an error */ - CFE_ES_Global.TaskData.CommandErrorCounter++; } else { - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1482,8 +1439,6 @@ int32 CFE_ES_ResetPRCountCmd(const CFE_ES_ResetPRCountCmd_t *data) */ CFE_EVS_SendEvent(CFE_ES_RESET_PR_COUNT_EID, CFE_EVS_EventType_INFORMATION, "Set Processor Reset Count to Zero"); - CFE_ES_Global.TaskData.CommandCounter++; - return CFE_SUCCESS; } @@ -1508,8 +1463,6 @@ int32 CFE_ES_SetMaxPRCountCmd(const CFE_ES_SetMaxPRCountCmd_t *data) CFE_EVS_SendEvent(CFE_ES_SET_MAX_PR_COUNT_EID, CFE_EVS_EventType_INFORMATION, "Maximum Processor Reset Count set to: %d", (int)cmd->MaxPRCount); - CFE_ES_Global.TaskData.CommandCounter++; - return CFE_SUCCESS; } @@ -1524,6 +1477,7 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data) int32 Status; const CFE_ES_DeleteCDSCmd_Payload_t *cmd = &data->Payload; char LocalCdsName[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN]; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; CFE_SB_MessageStringGet(LocalCdsName, (char *)cmd->CdsName, NULL, sizeof(LocalCdsName), sizeof(cmd->CdsName)); @@ -1533,40 +1487,32 @@ int32 CFE_ES_DeleteCDSCmd(const CFE_ES_DeleteCDSCmd_t *data) { CFE_EVS_SendEvent(CFE_ES_CDS_DELETE_TBL_ERR_EID, CFE_EVS_EventType_ERROR, "CDS '%s' is a Critical Table CDS. Must be deleted via TBL Command", LocalCdsName); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } else if (Status == CFE_ES_CDS_OWNER_ACTIVE_ERR) { CFE_EVS_SendEvent(CFE_ES_CDS_OWNER_ACTIVE_EID, CFE_EVS_EventType_ERROR, "CDS '%s' not deleted because owning app is active", LocalCdsName); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } else if (Status == CFE_ES_ERR_NAME_NOT_FOUND) { CFE_EVS_SendEvent(CFE_ES_CDS_NAME_ERR_EID, CFE_EVS_EventType_ERROR, "Unable to locate '%s' in CDS Registry", LocalCdsName); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } else if (Status != CFE_SUCCESS) { CFE_EVS_SendEvent(CFE_ES_CDS_DELETE_ERR_EID, CFE_EVS_EventType_ERROR, "Error while deleting '%s' from CDS, See SysLog.(Err=0x%08X)", LocalCdsName, (unsigned int)Status); - - CFE_ES_Global.TaskData.CommandErrorCounter++; } else { CFE_EVS_SendEvent(CFE_ES_CDS_DELETED_INFO_EID, CFE_EVS_EventType_INFORMATION, "Successfully removed '%s' from CDS", LocalCdsName); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1580,6 +1526,7 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) const CFE_ES_SendMemPoolStatsCmd_Payload_t *Cmd; CFE_ES_MemHandle_t MemHandle; bool ValidHandle; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; Cmd = &data->Payload; @@ -1601,20 +1548,19 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStatsCmd_t *data) CFE_SB_TimeStampMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.MemStatsPacket.TelemetryHeader)); CFE_SB_TransmitMsg(CFE_MSG_PTR(CFE_ES_Global.TaskData.MemStatsPacket.TelemetryHeader), true); - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG, "Successfully telemetered memory pool stats for 0x%08lX", CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); } else { - CFE_ES_Global.TaskData.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_ES_INVALID_POOL_HANDLE_ERR_EID, CFE_EVS_EventType_ERROR, "Cannot telemeter memory pool stats. Illegal Handle (0x%08lX)", CFE_RESOURCEID_TO_ULONG(Cmd->PoolHandle)); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1636,6 +1582,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) CFE_ES_CDSRegDumpRec_t DumpRecord; int32 FileSize = 0; int32 NumEntries = 0; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Copy the filename into local buffer with default name/path/extension if not specified @@ -1709,16 +1656,12 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) "Successfully dumped CDS Registry to '%s':Size=%d,Entries=%d", DumpFilename, (int)FileSize, (int)NumEntries); - /* Increment Successful Command Counter */ - CFE_ES_Global.TaskData.CommandCounter++; + ReturnCode = CFE_SUCCESS; } else { CFE_EVS_SendEvent(CFE_ES_CDS_DUMP_ERR_EID, CFE_EVS_EventType_ERROR, "Error writing CDS Registry to '%s', Status=%ld", DumpFilename, (long)OsStatus); - - /* Increment Command Error Counter */ - CFE_ES_Global.TaskData.CommandErrorCounter++; } } else @@ -1726,21 +1669,13 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) CFE_EVS_SendEvent(CFE_ES_WRITE_CFE_HDR_ERR_EID, CFE_EVS_EventType_ERROR, "Error writing cFE File Header to '%s', Status=0x%08X", DumpFilename, (unsigned int)Status); - - /* Increment Command Error Counter */ - CFE_ES_Global.TaskData.CommandErrorCounter++; } /* We are done outputting data to the dump file. Close it. */ OS_close(FileDescriptor); } - else - { - /* Increment Command Error Counter */ - CFE_ES_Global.TaskData.CommandErrorCounter++; - } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- diff --git a/modules/sb/fsw/src/cfe_sb_dispatch.c b/modules/sb/fsw/src/cfe_sb_dispatch.c index c1fa632e8..ece864af5 100644 --- a/modules/sb/fsw/src/cfe_sb_dispatch.c +++ b/modules/sb/fsw/src/cfe_sb_dispatch.c @@ -77,6 +77,7 @@ void CFE_SB_ProcessCmdPipePkt(const CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t FcnCode = 0; + CFE_Status_t Status = CFE_STATUS_NO_COUNTER_INCREMENT; CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); @@ -128,7 +129,7 @@ void CFE_SB_ProcessCmdPipePkt(const CFE_SB_Buffer_t *SBBufPtr) case CFE_SB_NOOP_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_NoopCmd_t))) { - CFE_SB_NoopCmd((const CFE_SB_NoopCmd_t *)SBBufPtr); + Status = CFE_SB_NoopCmd((const CFE_SB_NoopCmd_t *)SBBufPtr); } break; @@ -136,58 +137,71 @@ void CFE_SB_ProcessCmdPipePkt(const CFE_SB_Buffer_t *SBBufPtr) if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_ResetCountersCmd_t))) { /* Note: Command counter not incremented for this command */ - CFE_SB_ResetCountersCmd((const CFE_SB_ResetCountersCmd_t *)SBBufPtr); + Status = CFE_SB_ResetCountersCmd((const CFE_SB_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_SB_SEND_SB_STATS_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_SendSbStatsCmd_t))) { - CFE_SB_SendStatsCmd((const CFE_SB_SendSbStatsCmd_t *)SBBufPtr); + Status = CFE_SB_SendStatsCmd((const CFE_SB_SendSbStatsCmd_t *)SBBufPtr); } break; case CFE_SB_WRITE_ROUTING_INFO_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteRoutingInfoCmd_t))) { - CFE_SB_WriteRoutingInfoCmd((const CFE_SB_WriteRoutingInfoCmd_t *)SBBufPtr); + Status = CFE_SB_WriteRoutingInfoCmd((const CFE_SB_WriteRoutingInfoCmd_t *)SBBufPtr); } break; case CFE_SB_ENABLE_ROUTE_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_EnableRouteCmd_t))) { - CFE_SB_EnableRouteCmd((const CFE_SB_EnableRouteCmd_t *)SBBufPtr); + Status = CFE_SB_EnableRouteCmd((const CFE_SB_EnableRouteCmd_t *)SBBufPtr); } break; case CFE_SB_DISABLE_ROUTE_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_DisableRouteCmd_t))) { - CFE_SB_DisableRouteCmd((const CFE_SB_DisableRouteCmd_t *)SBBufPtr); + Status = CFE_SB_DisableRouteCmd((const CFE_SB_DisableRouteCmd_t *)SBBufPtr); } break; case CFE_SB_WRITE_PIPE_INFO_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WritePipeInfoCmd_t))) { - CFE_SB_WritePipeInfoCmd((const CFE_SB_WritePipeInfoCmd_t *)SBBufPtr); + Status = CFE_SB_WritePipeInfoCmd((const CFE_SB_WritePipeInfoCmd_t *)SBBufPtr); } break; case CFE_SB_WRITE_MAP_INFO_CC: if (CFE_SB_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_SB_WriteMapInfoCmd_t))) { - CFE_SB_WriteMapInfoCmd((const CFE_SB_WriteMapInfoCmd_t *)SBBufPtr); + Status = CFE_SB_WriteMapInfoCmd((const CFE_SB_WriteMapInfoCmd_t *)SBBufPtr); } break; default: CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID, CFE_EVS_EventType_ERROR, "Invalid Cmd, Unexpected Command Code %u", FcnCode); - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + Status = CFE_STATUS_BAD_COMMAND_CODE; break; } /* end switch on cmd code */ + + /* + * Any command functions returning a Status of CFE_STATUS_NO_COUNTER_INCREMENT + * will not increment either counter + */ + if (Status == CFE_SUCCESS) + { + CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; + } + else if ((Status == CFE_STATUS_COMMAND_FAILURE) || (Status == CFE_STATUS_BAD_COMMAND_CODE)) + { + CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; + } break; default: diff --git a/modules/sb/fsw/src/cfe_sb_priv.h b/modules/sb/fsw/src/cfe_sb_priv.h index 737682936..35573aab0 100644 --- a/modules/sb/fsw/src/cfe_sb_priv.h +++ b/modules/sb/fsw/src/cfe_sb_priv.h @@ -474,16 +474,6 @@ void CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd); */ int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId); -/*---------------------------------------------------------------------------------------*/ -/** - * Increment the command counter based on the status input. - * - * This small utility was written to eliminate duplicate code. - * - * @param status typically #CFE_SUCCESS or an SB error code - */ -void CFE_SB_IncrCmdCtr(int32 status); - /*---------------------------------------------------------------------------------------*/ /** * SB internal function to enable and disable subscription reporting. diff --git a/modules/sb/fsw/src/cfe_sb_task.c b/modules/sb/fsw/src/cfe_sb_task.c index e3168d8a7..1bee07665 100644 --- a/modules/sb/fsw/src/cfe_sb_task.c +++ b/modules/sb/fsw/src/cfe_sb_task.c @@ -268,10 +268,9 @@ int32 CFE_SB_AppInit(void) return Status; } - CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", - CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); - Status = - CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", VersionString); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", CFE_SRC_VERSION, CFE_BUILD_CODENAME, + CFE_LAST_OFFICIAL); + Status = CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", VersionString); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); @@ -290,10 +289,9 @@ int32 CFE_SB_AppInit(void) int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data) { char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; - CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", - CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", CFE_SRC_VERSION, CFE_BUILD_CODENAME, + CFE_LAST_OFFICIAL); CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; } @@ -310,7 +308,7 @@ int32 CFE_SB_ResetCountersCmd(const CFE_SB_ResetCountersCmd_t *data) CFE_SB_ResetCounters(); - return CFE_SUCCESS; + return CFE_STATUS_NO_COUNTER_INCREMENT; } /*---------------------------------------------------------------- @@ -393,6 +391,7 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) CFE_SB_DestinationD_t * DestPtr; const CFE_SB_RouteCmd_Payload_t *CmdPtr; uint16 PendingEventID; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; PendingEventID = 0; CmdPtr = &data->Payload; @@ -406,7 +405,6 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) if (!CFE_SB_IsValidMsgId(MsgId) || !CFE_SB_PipeDescIsMatch(PipeDscPtr, CmdPtr->Pipe)) { PendingEventID = CFE_SB_ENBL_RTE3_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; } else { @@ -414,13 +412,12 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) if (DestPtr == NULL) { PendingEventID = CFE_SB_ENBL_RTE1_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; } else { DestPtr->Active = CFE_SB_ACTIVE; PendingEventID = CFE_SB_ENBL_RTE2_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; + ReturnCode = CFE_SUCCESS; } } @@ -444,7 +441,7 @@ int32 CFE_SB_EnableRouteCmd(const CFE_SB_EnableRouteCmd_t *data) break; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -460,6 +457,7 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) CFE_SB_DestinationD_t * DestPtr; const CFE_SB_RouteCmd_Payload_t *CmdPtr; uint16 PendingEventID; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; PendingEventID = 0; CmdPtr = &data->Payload; @@ -473,7 +471,6 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) if (!CFE_SB_IsValidMsgId(MsgId) || !CFE_SB_PipeDescIsMatch(PipeDscPtr, CmdPtr->Pipe)) { PendingEventID = CFE_SB_DSBL_RTE3_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; } else { @@ -481,13 +478,12 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) if (DestPtr == NULL) { PendingEventID = CFE_SB_DSBL_RTE1_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; } else { DestPtr->Active = CFE_SB_INACTIVE; PendingEventID = CFE_SB_DSBL_RTE2_EID; - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; + ReturnCode = CFE_SUCCESS; } } @@ -511,7 +507,7 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRouteCmd_t *data) break; } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -569,8 +565,6 @@ int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStatsCmd_t *data) CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID, CFE_EVS_EventType_DEBUG, "Software Bus Statistics packet sent"); - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; - return CFE_SUCCESS; } @@ -775,6 +769,7 @@ int32 CFE_SB_WriteRoutingInfoCmd(const CFE_SB_WriteRoutingInfoCmd_t *data) const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; CFE_SB_BackgroundFileStateInfo_t * StatePtr; int32 Status; + CFE_Status_t Returncode = CFE_STATUS_COMMAND_FAILURE; StatePtr = &CFE_SB_Global.BackgroundFile; CmdPtr = &data->Payload; @@ -814,15 +809,17 @@ int32 CFE_SB_WriteRoutingInfoCmd(const CFE_SB_WriteRoutingInfoCmd_t *data) Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - if (Status != CFE_SUCCESS) + if (Status == CFE_SUCCESS) + { + Returncode = CFE_SUCCESS; + } + else { /* generate the same event as is generated when unable to create the file (same thing, really) */ CFE_SB_BackgroundFileEventHandler(StatePtr, CFE_FS_FileWriteEvent_CREATE_ERROR, Status, 0, 0, 0); } - CFE_SB_IncrCmdCtr(Status); - - return CFE_SUCCESS; + return Returncode; } /*---------------------------------------------------------------- @@ -914,6 +911,7 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; CFE_SB_BackgroundFileStateInfo_t * StatePtr; int32 Status; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; StatePtr = &CFE_SB_Global.BackgroundFile; CmdPtr = &data->Payload; @@ -953,15 +951,17 @@ int32 CFE_SB_WritePipeInfoCmd(const CFE_SB_WritePipeInfoCmd_t *data) Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - if (Status != CFE_SUCCESS) + if (Status == CFE_SUCCESS) + { + ReturnCode = CFE_SUCCESS; + } + else { /* generate the same event as is generated when unable to create the file (same thing, really) */ CFE_SB_BackgroundFileEventHandler(StatePtr, CFE_FS_FileWriteEvent_CREATE_ERROR, Status, 0, 0, 0); } - CFE_SB_IncrCmdCtr(Status); - - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1038,6 +1038,7 @@ int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) const CFE_SB_WriteFileInfoCmd_Payload_t *CmdPtr; CFE_SB_BackgroundFileStateInfo_t * StatePtr; int32 Status; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; StatePtr = &CFE_SB_Global.BackgroundFile; CmdPtr = &data->Payload; @@ -1077,15 +1078,17 @@ int32 CFE_SB_WriteMapInfoCmd(const CFE_SB_WriteMapInfoCmd_t *data) Status = CFE_STATUS_REQUEST_ALREADY_PENDING; } - if (Status != CFE_SUCCESS) + if (Status == CFE_SUCCESS) + { + ReturnCode = CFE_SUCCESS; + } + else { /* generate the same event as is generated when unable to create the file (same thing, really) */ CFE_SB_BackgroundFileEventHandler(StatePtr, CFE_FS_FileWriteEvent_CREATE_ERROR, Status, 0, 0, 0); } - CFE_SB_IncrCmdCtr(Status); - - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -1177,24 +1180,6 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubsCmd_t *data) return CFE_SUCCESS; } -/*---------------------------------------------------------------- - * - * Application-scope internal function - * See description in header file for argument/return detail - * - *-----------------------------------------------------------------*/ -void CFE_SB_IncrCmdCtr(int32 status) -{ - if (status == CFE_SUCCESS) - { - CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; - } - else - { - CFE_SB_Global.HKTlmMsg.Payload.CommandErrorCounter++; - } -} - /*---------------------------------------------------------------- * * Application-scope internal function diff --git a/modules/tbl/fsw/src/cfe_tbl_dispatch.c b/modules/tbl/fsw/src/cfe_tbl_dispatch.c index 4b2a57771..17e181b7a 100644 --- a/modules/tbl/fsw/src/cfe_tbl_dispatch.c +++ b/modules/tbl/fsw/src/cfe_tbl_dispatch.c @@ -93,11 +93,11 @@ const CFE_TBL_CmdHandlerTblRec_t CFE_TBL_CmdHandlerTbl[] = { *-----------------------------------------------------------------*/ void CFE_TBL_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; - CFE_MSG_FcnCode_t CommandCode = 0; - int16 CmdIndx; - CFE_MSG_Size_t ActualLength = 0; - CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; + int16 CmdIndx; + CFE_MSG_Size_t ActualLength = 0; + CFE_Status_t CmdStatus = CFE_STATUS_COMMAND_FAILURE; /* Assume a failed command */ CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); @@ -126,11 +126,11 @@ void CFE_TBL_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) /* Only update command counters when message has a command code */ if (CFE_TBL_CmdHandlerTbl[CmdIndx].MsgTypes == CFE_TBL_CMD_MSGTYPE) { - if (CmdStatus == CFE_TBL_INC_CMD_CTR) + if (CmdStatus == CFE_SUCCESS) { CFE_TBL_Global.CommandCounter++; } - else if (CmdStatus == CFE_TBL_INC_ERR_CTR) + else if (CmdStatus == CFE_STATUS_COMMAND_FAILURE) { CFE_TBL_Global.CommandErrorCounter++; } diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 28d87c652..9f928c159 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -94,7 +94,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) /* If dump file was successfully written, update the file header so that the timestamp */ /* is the time of the actual capturing of the data, NOT the time when it was written to the file */ - if (Status == CFE_TBL_INC_CMD_CTR) + if (Status == CFE_SUCCESS) { DumpTime.Seconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs; DumpTime.Subseconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSubSecs; @@ -130,7 +130,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data) } } - return CFE_TBL_DONT_INC_CTR; + return CFE_STATUS_NO_COUNTER_INCREMENT; } /*---------------------------------------------------------------- @@ -318,7 +318,7 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); - return CFE_TBL_INC_CMD_CTR; + return CFE_SUCCESS; } /*---------------------------------------------------------------- @@ -338,7 +338,7 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data) CFE_EVS_SendEvent(CFE_TBL_RESET_INF_EID, CFE_EVS_EventType_DEBUG, "Reset Counters command"); - return CFE_TBL_DONT_INC_CTR; + return CFE_STATUS_NO_COUNTER_INCREMENT; } /*---------------------------------------------------------------- @@ -349,7 +349,7 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ const CFE_TBL_LoadCmd_Payload_t *CmdPtr = &data->Payload; CFE_FS_Header_t StdFileHeader; CFE_TBL_File_Hdr_t TblFileHeader; @@ -468,7 +468,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) '\0'; /* Increment successful command completion counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } } else @@ -533,7 +533,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int16 RegIndex; const CFE_TBL_DumpCmd_Payload_t *CmdPtr = &data->Payload; char DumpFilename[OS_MAX_PATH_LEN]; @@ -638,7 +638,7 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) CFE_TBL_SendNotificationMsg(RegRecPtr); /* Consider the command completed successfully */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else { @@ -675,17 +675,17 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, const void *DumpDataAddr, - size_t TblSizeInBytes) +CFE_Status_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; - CFE_FS_Header_t StdFileHeader; - CFE_TBL_File_Hdr_t TblFileHeader; - osal_id_t FileDescriptor = OS_OBJECT_ID_UNDEFINED; - int32 Status; - int32 OsStatus; - int32 EndianCheck = 0x01020304; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ + bool FileExistedPrev = false; + CFE_FS_Header_t StdFileHeader; + CFE_TBL_File_Hdr_t TblFileHeader; + osal_id_t FileDescriptor = OS_OBJECT_ID_UNDEFINED; + int32 Status; + int32 OsStatus; + int32 EndianCheck = 0x01020304; /* Clear Header of any garbage before copying content */ memset(&TblFileHeader, 0, sizeof(CFE_TBL_File_Hdr_t)); @@ -759,7 +759,7 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *Ta .LastFileDumped[sizeof(CFE_TBL_Global.HkPacket.Payload.LastFileDumped) - 1] = 0; /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else { @@ -801,7 +801,7 @@ CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *Ta *-----------------------------------------------------------------*/ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int16 RegIndex; const CFE_TBL_ValidateCmd_Payload_t *CmdPtr = &data->Payload; CFE_TBL_RegistryRec_t * RegRecPtr; @@ -916,7 +916,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) } /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else { @@ -942,7 +942,7 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int16 RegIndex; const CFE_TBL_ActivateCmd_Payload_t *CmdPtr = &data->Payload; char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; @@ -989,7 +989,7 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data) } /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else { @@ -1200,7 +1200,7 @@ void CFE_TBL_DumpRegistryEventHandler(void *Meta, CFE_FS_FileWriteEvent_t Event, *-----------------------------------------------------------------*/ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int32 Status; const CFE_TBL_DumpRegistryCmd_Payload_t *CmdPtr = &data->Payload; os_fstat_t FileStat; @@ -1245,7 +1245,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) if (Status == CFE_SUCCESS) { /* Increment the TBL generic command counter (successfully queued for background job) */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } } } @@ -1261,7 +1261,7 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int16 RegIndex; const CFE_TBL_SendRegistryCmd_Payload_t *CmdPtr = &data->Payload; char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; @@ -1281,7 +1281,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data) "Table Registry entry for '%s' will be telemetered", TableName); /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else /* Table could not be found in Registry */ { @@ -1300,7 +1300,7 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ const CFE_TBL_DelCDSCmd_Payload_t *CmdPtr = &data->Payload; char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; CFE_TBL_CritRegRec_t * CritRegRecPtr = NULL; @@ -1363,7 +1363,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) CritRegRecPtr->CDSHandle = CFE_ES_CDS_BAD_HANDLE; /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } } else @@ -1388,7 +1388,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data) { - CFE_TBL_CmdProcRet_t ReturnCode = CFE_TBL_INC_ERR_CTR; /* Assume failure */ + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* Assume failure */ int16 RegIndex; const CFE_TBL_AbortLoadCmd_Payload_t *CmdPtr = &data->Payload; CFE_TBL_RegistryRec_t * RegRecPtr; @@ -1413,7 +1413,7 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data) CFE_TBL_AbortLoad(RegRecPtr); /* Increment Successful Command Counter */ - ReturnCode = CFE_TBL_INC_CMD_CTR; + ReturnCode = CFE_SUCCESS; } else { diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h index 1dfd63a5a..674d12464 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.h +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.h @@ -42,20 +42,6 @@ /********************* Macro and Constant Type Definitions ***************************/ -/* - * For backward compatibility, keep this enumeration for now but map the - * values to the globally-defined codes in cfe_error.h, so it won't be confusing - * if intermixed with a typical CFE int32 return code. - */ -typedef enum -{ - CFE_TBL_INC_ERR_CTR = - CFE_TBL_MESSAGE_ERROR, /**< Error detected in (or while processing) message, increment command error counter */ - CFE_TBL_DONT_INC_CTR = - CFE_STATUS_NO_COUNTER_INCREMENT, /**< No errors detected but don't increment command counter */ - CFE_TBL_INC_CMD_CTR = CFE_SUCCESS /**< No errors detected and increment command counter */ -} CFE_TBL_CmdProcRet_t; - typedef int32 (*CFE_TBL_MsgProcFuncPtr_t)(const void *MsgPtr); #define CFE_TBL_BAD_CMD_CODE (-1) /**< Command Code found in Message does not match any in #CFE_TBL_CmdHandlerTbl */ @@ -119,7 +105,7 @@ void CFE_TBL_GetTblRegData(void); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_DONT_INC_CTR \copydoc CFE_TBL_DONT_INC_CTR +** \retval #CFE_STATUS_NO_COUNTER_INCREMENT \copydoc CFE_STATUS_NO_COUNTER_INCREMENT */ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); @@ -135,8 +121,7 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_MSG_CommandHeader_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data); @@ -152,7 +137,7 @@ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_DONT_INC_CTR \copydoc CFE_TBL_DONT_INC_CTR +** \retval #CFE_STATUS_NO_COUNTER_INCREMENT \copydoc CFE_STATUS_NO_COUNTER_INCREMENT */ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data); @@ -169,8 +154,8 @@ int32 CFE_TBL_ResetCountersCmd(const CFE_TBL_ResetCountersCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data); @@ -187,8 +172,8 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data); @@ -206,8 +191,8 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data); @@ -224,8 +209,8 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data); @@ -241,8 +226,8 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data); @@ -259,8 +244,8 @@ int32 CFE_TBL_DumpRegistryCmd(const CFE_TBL_DumpRegistryCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data); @@ -276,8 +261,8 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data); @@ -293,8 +278,8 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data); ** ** \param[in] data points to the message received via command pipe that needs processing ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data); @@ -319,11 +304,11 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data); ** ** \param[in] TblSizeInBytes Size of block of data to be written to the file ** -** \retval #CFE_TBL_INC_ERR_CTR \copydoc CFE_TBL_INC_ERR_CTR -** \retval #CFE_TBL_INC_CMD_CTR \copydoc CFE_TBL_INC_CMD_CTR +** \retval #CFE_STATUS_COMMAND_FAILURE \copydoc CFE_STATUS_COMMAND_FAILURE +** \retval #CFE_SUCCESS \copydoc CFE_SUCCESS */ -CFE_TBL_CmdProcRet_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, const void *DumpDataAddr, - size_t TblSizeInBytes); +CFE_Status_t CFE_TBL_DumpToFile(const char *DumpFilename, const char *TableName, const void *DumpDataAddr, + size_t TblSizeInBytes); /*---------------------------------------------------------------------------------------*/ /** diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index f6ad15bae..1b74e528f 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -407,7 +407,7 @@ void Test_CFE_TBL_DeleteCDSCmd(void) UT_InitData(); strncpy(DelCDSCmd.Payload.TableName, "0", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test failure to find table in the critical table registry */ UT_InitData(); @@ -420,7 +420,7 @@ void Test_CFE_TBL_DeleteCDSCmd(void) strncpy(DelCDSCmd.Payload.TableName, "-1", sizeof(DelCDSCmd.Payload.TableName) - 1); DelCDSCmd.Payload.TableName[sizeof(DelCDSCmd.Payload.TableName) - 1] = '\0'; - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test finding the table in the critical table registry, but CDS is not * tagged as a table @@ -429,27 +429,27 @@ void Test_CFE_TBL_DeleteCDSCmd(void) snprintf(DelCDSCmd.Payload.TableName, sizeof(DelCDSCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_CRITICAL_TABLES + CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_WRONG_TYPE_ERR); - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test deletion when CDS owning application is still active */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_CDS_OWNER_ACTIVE_ERR); - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test deletion where the table cannot be located in the CDS registry */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test deletion error while deleting table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS - 1); - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_STATUS_COMMAND_FAILURE); /* Test successful removal of the table from the CDS */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_ES_DeleteCDS), 1, CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DeleteCDSCmd(&DelCDSCmd), CFE_SUCCESS); } /* @@ -469,14 +469,14 @@ void Test_CFE_TBL_TlmRegCmd(void) */ strncpy(TlmRegCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(TlmRegCmd.Payload.TableName) - 1); TlmRegCmd.Payload.TableName[sizeof(TlmRegCmd.Payload.TableName) - 1] = '\0'; - UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_SUCCESS); /* Test when table name does not exist */ UT_InitData(); snprintf(TlmRegCmd.Payload.TableName, sizeof(TlmRegCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_SendRegistryCmd(&TlmRegCmd), CFE_STATUS_COMMAND_FAILURE); } /* @@ -498,12 +498,12 @@ void Test_CFE_TBL_AbortLoadCmd(void) strncpy(AbortLdCmd.Payload.TableName, CFE_TBL_Global.Registry[0].Name, sizeof(AbortLdCmd.Payload.TableName) - 1); AbortLdCmd.Payload.TableName[sizeof(AbortLdCmd.Payload.TableName) - 1] = '\0'; CFE_TBL_Global.Registry[0].LoadInProgress = 1; - UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_SUCCESS); /* Test when table name does exist but no table load is in progress */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table name does exist, a table load is in progress, and the * table is dump only @@ -511,13 +511,13 @@ void Test_CFE_TBL_AbortLoadCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[0].DumpOnly = true; - UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table name not found in the registry */ UT_InitData(); snprintf(AbortLdCmd.Payload.TableName, sizeof(AbortLdCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_AbortLoadCmd(&AbortLdCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table is double buffered */ UT_InitData(); @@ -551,7 +551,7 @@ void Test_CFE_TBL_ActivateCmd(void) */ UT_InitData(); CFE_TBL_Global.Registry[0].DumpOnly = true; - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table name exists, the table is not a dump-only, a load is in * progress, and the table is double-buffered @@ -560,7 +560,7 @@ void Test_CFE_TBL_ActivateCmd(void) CFE_TBL_Global.Registry[0].DumpOnly = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[0].DoubleBuffered = true; - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table name exists, the table is not a dump-only, a load is in * progress, the table isn't double-buffered, and ValidationStatus = true @@ -568,7 +568,7 @@ void Test_CFE_TBL_ActivateCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].DoubleBuffered = false; CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].Validated = true; - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_SUCCESS); /* Test when table name exists, the table is not a dump-only, no load is in * progress, and no notification message should be sent @@ -576,7 +576,7 @@ void Test_CFE_TBL_ActivateCmd(void) UT_InitData(); CFE_TBL_Global.Registry[0].NotifyByMsg = false; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test when table name exists, the table is not a dump-only, no load in in * progress, and a notification message should be sent @@ -585,13 +585,13 @@ void Test_CFE_TBL_ActivateCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); CFE_TBL_Global.Registry[0].NotifyByMsg = true; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_SUCCESS); /* Test when the table name doesn't exist */ UT_InitData(); snprintf(ActivateCmd.Payload.TableName, sizeof(ActivateCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ActivateCmd(&ActivateCmd), CFE_STATUS_COMMAND_FAILURE); /* Restore original values */ CFE_TBL_Global.Registry[0].LoadInProgress = load; @@ -610,12 +610,14 @@ void Test_CFE_TBL_DumpToFile(void) /* Test with an error creating the dump file */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), + CFE_STATUS_COMMAND_FAILURE); /* Test with an error writing the cFE file header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, sizeof(CFE_FS_Header_t) - 1); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), + CFE_STATUS_COMMAND_FAILURE); /* Test with an error writing the table file header */ UT_InitData(); @@ -625,21 +627,23 @@ void Test_CFE_TBL_DumpToFile(void) */ UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 6, sizeof(CFE_FS_Header_t)); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, sizeof(CFE_TBL_File_Hdr_t) - 1); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), + CFE_STATUS_COMMAND_FAILURE); /* Test with an error writing the table to a file */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_write), 2, TblSizeInBytes - 1); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), + CFE_STATUS_COMMAND_FAILURE); /* Test successful file creation and data dumped */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 1, OS_ERROR); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_SUCCESS); /* Test where file already exists so data is overwritten */ UT_InitData(); - UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpToFile("filename", "tablename", "dumpaddress", TblSizeInBytes), CFE_SUCCESS); } /* @@ -651,7 +655,7 @@ void Test_CFE_TBL_ResetCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UtAssert_INT32_EQ(CFE_TBL_ResetCountersCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_ResetCountersCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); } /* @@ -671,7 +675,7 @@ void Test_CFE_TBL_ValidateCmd(void) UT_InitData(); snprintf(ValidateCmd.Payload.TableName, sizeof(ValidateCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test where the active buffer has data, but too many table validations * have been requested @@ -687,7 +691,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.ValidationResults[i].State = CFE_TBL_VALIDATION_PENDING; } - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test where the active buffer has data, but there is no validation * function pointer @@ -695,7 +699,7 @@ void Test_CFE_TBL_ValidateCmd(void) UT_InitData(); CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = NULL; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_SUCCESS); /* Test where the active buffer has data, the validation function pointer * exists, and the active table flag is set @@ -704,7 +708,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; ValidateCmd.Payload.ActiveTableFlag = true; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_SUCCESS); /* Test with the buffer inactive, the table is double-buffered, and the * validation function pointer exists @@ -715,7 +719,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.Registry[0].Buffers[1 - CFE_TBL_Global.Registry[0].ActiveBufferIndex].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].ValidationFuncPtr = ValFuncPtr; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_SUCCESS); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and no @@ -727,7 +731,7 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_SUCCESS); /* Test with the buffer inactive, the table is single-buffered with a * load in progress, the validation function pointer exists, and a @@ -740,19 +744,19 @@ void Test_CFE_TBL_ValidateCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = BuffPtr; CFE_TBL_Global.ValidationResults[0].State = CFE_TBL_VALIDATION_FREE; CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_SUCCESS); /* Test where no inactive buffer is present (single-buffered table without * load in progress) */ UT_InitData(); CFE_TBL_Global.Registry[0].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an illegal buffer */ UT_InitData(); ValidateCmd.Payload.ActiveTableFlag = 0xffff; - UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_ValidateCmd(&ValidateCmd), CFE_STATUS_COMMAND_FAILURE); } /* @@ -764,7 +768,7 @@ void Test_CFE_TBL_NoopCmd(void) /* Test run through function (there are no additional paths) */ UT_InitData(); - UtAssert_INT32_EQ(CFE_TBL_NoopCmd(NULL), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_NoopCmd(NULL), CFE_SUCCESS); } /* @@ -898,23 +902,23 @@ void Test_CFE_TBL_DumpRegCmd(void) UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); strncpy(DumpRegCmd.Payload.DumpFilename, "X", sizeof(DumpRegCmd.Payload.DumpFilename) - 1); DumpRegCmd.Payload.DumpFilename[sizeof(DumpRegCmd.Payload.DumpFilename) - 1] = '\0'; - UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_SUCCESS); /* Test command with a bad file name */ UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); - UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_STATUS_COMMAND_FAILURE); UT_ResetState(UT_KEY(CFE_FS_ParseInputFileNameEx)); /* Test command with the dump file already pending (max requests pending) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_STATUS_COMMAND_FAILURE); UT_ResetState(UT_KEY(CFE_FS_BackgroundFileDumpRequest)); /* Test command with the dump file already pending (local) */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpRequest), CFE_STATUS_REQUEST_ALREADY_PENDING); - UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpRegistryCmd(&DumpRegCmd), CFE_STATUS_COMMAND_FAILURE); /* Check event generators */ UT_ClearEventHistory(); @@ -1025,7 +1029,7 @@ void Test_CFE_TBL_DumpCmd(void) /* Test where the table cannot be found in the registry */ UT_InitData(); snprintf(DumpCmd.Payload.TableName, sizeof(DumpCmd.Payload.TableName), "%d", CFE_PLATFORM_TBL_MAX_NUM_TABLES + 1); - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an active buffer, the pointer is created, validation passes, * the table is dump only, no dump is already in progress, and have a @@ -1053,7 +1057,7 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[2].LoadInProgress] = Load; CFE_TBL_Global.Registry[2].NotifyByMsg = true; UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SB_INTERNAL_ERR); - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_SUCCESS); /* Test with an active buffer, a pointer is created, the table is dump * only, no dump is already progress, and fails to get a working buffer; @@ -1073,7 +1077,7 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an active buffer, a pointer is created, the table is dump * only, and no dump fails to find a free dump control block; too many @@ -1088,7 +1092,7 @@ void Test_CFE_TBL_DumpCmd(void) } CFE_TBL_Global.Registry[2].NotifyByMsg = true; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an inactive buffer, double-buffered, dump already in progress; * dump is already pending @@ -1098,7 +1102,7 @@ void Test_CFE_TBL_DumpCmd(void) CFE_TBL_Global.Registry[2].DoubleBuffered = true; CFE_TBL_Global.Registry[2].Buffers[(1 - CFE_TBL_Global.Registry[2].ActiveBufferIndex)].BufferPtr = BuffPtr; CFE_TBL_Global.Registry[2].DumpControlIndex = CFE_TBL_NO_DUMP_PENDING + 1; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an inactive buffer, single-buffered, pointer created, is a * dump only table @@ -1111,14 +1115,14 @@ void Test_CFE_TBL_DumpCmd(void) strncpy(DumpCmd.Payload.DumpFilename, CFE_TBL_Global.Registry[2].LastFileLoaded, sizeof(DumpCmd.Payload.DumpFilename) - 1); DumpCmd.Payload.DumpFilename[sizeof(DumpCmd.Payload.DumpFilename) - 1] = '\0'; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_SUCCESS); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to load in progress */ UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an inactive buffer, single-buffered: No inactive buffer for * table due to user defined address @@ -1126,12 +1130,12 @@ void Test_CFE_TBL_DumpCmd(void) UT_InitData(); CFE_TBL_Global.Registry[2].LoadInProgress = CFE_TBL_NO_LOAD_IN_PROGRESS + 1; CFE_TBL_Global.Registry[2].UserDefAddr = true; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with an illegal buffer parameter */ UT_InitData(); DumpCmd.Payload.ActiveTableFlag = CFE_TBL_BufferSelect_ACTIVE + 1; - UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_DumpCmd(&DumpCmd), CFE_STATUS_COMMAND_FAILURE); } /* @@ -1170,7 +1174,7 @@ void Test_CFE_TBL_LoadCmd(void) /* Test response to inability to open file */ UT_InitData(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test response to inability to find the table in the registry */ UT_InitData(); @@ -1178,7 +1182,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* The rest of the tests will use registry 0, note empty name matches */ CFE_TBL_Global.Registry[0].OwnerAppId = AppID; @@ -1188,7 +1192,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); CFE_TBL_Global.Registry[0].DumpOnly = true; - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); CFE_TBL_Global.Registry[0].DumpOnly = false; /* Test attempt to load a table with a load already pending */ @@ -1196,7 +1200,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); CFE_TBL_Global.Registry[0].LoadPending = true; - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); CFE_TBL_Global.Registry[0].LoadPending = false; /* Test where the file isn't dump only and passes table checks, get a @@ -1212,7 +1216,7 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.LoadBuffs[CFE_TBL_Global.Registry[0].LoadInProgress].BufferPtr = &LoadBuffer; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with no extra byte => successful load */ UT_InitData(); @@ -1220,7 +1224,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 3, 0); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_CMD_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_SUCCESS); /* Test with differing amount of data from header's claim */ UT_InitData(); @@ -1228,7 +1232,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetDeferredRetcode(UT_KEY(OS_read), 2, 0); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with no working buffers available */ UT_InitData(); @@ -1243,7 +1247,7 @@ void Test_CFE_TBL_LoadCmd(void) UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with interal CFE_TBL_GetWorkingBuffer error (memcpy with matching address */ UT_InitData(); @@ -1256,7 +1260,7 @@ void Test_CFE_TBL_LoadCmd(void) TblFileHeader.TableName[sizeof(TblFileHeader.TableName) - 1] = '\0'; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with table header indicating data beyond size of the table */ UT_InitData(); @@ -1264,14 +1268,14 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].Size = sizeof(UT_Table1_t) - 1; UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test with table header indicating no data in the file */ UT_InitData(); UT_TBL_SetupHeader(&TblFileHeader, 0, 0); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test where file has partial load for uninitialized table and offset * is non-zero @@ -1282,7 +1286,7 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].Size = sizeof(UT_Table1_t); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test where file has partial load for uninitialized table and offset * is zero @@ -1293,12 +1297,12 @@ void Test_CFE_TBL_LoadCmd(void) CFE_TBL_Global.Registry[0].Size = sizeof(UT_Table1_t); UT_SetReadBuffer(&TblFileHeader, sizeof(TblFileHeader)); UT_SetReadHeader(&StdFileHeader, sizeof(StdFileHeader)); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); /* Test response to inability to read the file header */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ReadHeader), 1, sizeof(CFE_FS_Header_t) - 1); - UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_TBL_INC_ERR_CTR); + UtAssert_INT32_EQ(CFE_TBL_LoadCmd(&LoadCmd), CFE_STATUS_COMMAND_FAILURE); } /* @@ -1346,7 +1350,7 @@ void Test_CFE_TBL_HousekeepingCmd(void) UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, CFE_SUCCESS - 1); CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; - UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); for (i = 1; i < CFE_PLATFORM_TBL_MAX_SIMULTANEOUS_LOADS; i++) { @@ -1361,26 +1365,26 @@ void Test_CFE_TBL_HousekeepingCmd(void) CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND + 1; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); /* Test response to an invalid table and a dump file create failure */ UT_InitData(); CFE_TBL_Global.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); - UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); /* Test response to a file time stamp failure */ UT_InitData(); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDeferredRetcode(UT_KEY(CFE_FS_SetTimestamp), 1, OS_SUCCESS - 1); - UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); /* Test response to OS_OpenCreate failure */ UT_InitData(); CFE_TBL_Global.DumpControlBlocks[0].State = CFE_TBL_DUMP_PERFORMED; UT_SetDeferredRetcode(UT_KEY(OS_OpenCreate), 3, -1); - UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_TBL_DONT_INC_CTR); + UtAssert_INT32_EQ(CFE_TBL_HousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT); } /* diff --git a/modules/time/fsw/src/cfe_time_dispatch.c b/modules/time/fsw/src/cfe_time_dispatch.c index 758200293..923bfc2bc 100644 --- a/modules/time/fsw/src/cfe_time_dispatch.c +++ b/modules/time/fsw/src/cfe_time_dispatch.c @@ -72,6 +72,7 @@ void CFE_TIME_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) { CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; CFE_MSG_FcnCode_t CommandCode = 0; + CFE_Status_t Status = CFE_STATUS_NO_COUNTER_INCREMENT; CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID); @@ -125,42 +126,42 @@ void CFE_TIME_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) case CFE_TIME_NOOP_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_NoopCmd_t))) { - CFE_TIME_NoopCmd((const CFE_TIME_NoopCmd_t *)SBBufPtr); + Status = CFE_TIME_NoopCmd((const CFE_TIME_NoopCmd_t *)SBBufPtr); } break; case CFE_TIME_RESET_COUNTERS_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_ResetCountersCmd_t))) { - CFE_TIME_ResetCountersCmd((const CFE_TIME_ResetCountersCmd_t *)SBBufPtr); + Status = CFE_TIME_ResetCountersCmd((const CFE_TIME_ResetCountersCmd_t *)SBBufPtr); } break; case CFE_TIME_SEND_DIAGNOSTIC_TLM_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SendDiagnosticCmd_t))) { - CFE_TIME_SendDiagnosticTlm((const CFE_TIME_SendDiagnosticCmd_t *)SBBufPtr); + Status = CFE_TIME_SendDiagnosticTlm((const CFE_TIME_SendDiagnosticCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_STATE_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetStateCmd_t))) { - CFE_TIME_SetStateCmd((const CFE_TIME_SetStateCmd_t *)SBBufPtr); + Status = CFE_TIME_SetStateCmd((const CFE_TIME_SetStateCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_SOURCE_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSourceCmd_t))) { - CFE_TIME_SetSourceCmd((const CFE_TIME_SetSourceCmd_t *)SBBufPtr); + Status = CFE_TIME_SetSourceCmd((const CFE_TIME_SetSourceCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_SIGNAL_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSignalCmd_t))) { - CFE_TIME_SetSignalCmd((const CFE_TIME_SetSignalCmd_t *)SBBufPtr); + Status = CFE_TIME_SetSignalCmd((const CFE_TIME_SetSignalCmd_t *)SBBufPtr); } break; @@ -170,14 +171,14 @@ void CFE_TIME_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) case CFE_TIME_ADD_DELAY_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_AddDelayCmd_t))) { - CFE_TIME_AddDelayCmd((const CFE_TIME_AddDelayCmd_t *)SBBufPtr); + Status = CFE_TIME_AddDelayCmd((const CFE_TIME_AddDelayCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_DELAY_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SubDelayCmd_t))) { - CFE_TIME_SubDelayCmd((const CFE_TIME_SubDelayCmd_t *)SBBufPtr); + Status = CFE_TIME_SubDelayCmd((const CFE_TIME_SubDelayCmd_t *)SBBufPtr); } break; @@ -187,67 +188,80 @@ void CFE_TIME_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) case CFE_TIME_SET_TIME_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetTimeCmd_t))) { - CFE_TIME_SetTimeCmd((const CFE_TIME_SetTimeCmd_t *)SBBufPtr); + Status = CFE_TIME_SetTimeCmd((const CFE_TIME_SetTimeCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_MET_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetMETCmd_t))) { - CFE_TIME_SetMETCmd((const CFE_TIME_SetMETCmd_t *)SBBufPtr); + Status = CFE_TIME_SetMETCmd((const CFE_TIME_SetMETCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_STCF_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetSTCFCmd_t))) { - CFE_TIME_SetSTCFCmd((const CFE_TIME_SetSTCFCmd_t *)SBBufPtr); + Status = CFE_TIME_SetSTCFCmd((const CFE_TIME_SetSTCFCmd_t *)SBBufPtr); } break; case CFE_TIME_SET_LEAP_SECONDS_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SetLeapSecondsCmd_t))) { - CFE_TIME_SetLeapSecondsCmd((const CFE_TIME_SetLeapSecondsCmd_t *)SBBufPtr); + Status = CFE_TIME_SetLeapSecondsCmd((const CFE_TIME_SetLeapSecondsCmd_t *)SBBufPtr); } break; case CFE_TIME_ADD_ADJUST_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_AddAdjustCmd_t))) { - CFE_TIME_AddAdjustCmd((const CFE_TIME_AddAdjustCmd_t *)SBBufPtr); + Status = CFE_TIME_AddAdjustCmd((const CFE_TIME_AddAdjustCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_ADJUST_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_SubAdjustCmd_t))) { - CFE_TIME_SubAdjustCmd((const CFE_TIME_SubAdjustCmd_t *)SBBufPtr); + Status = CFE_TIME_SubAdjustCmd((const CFE_TIME_SubAdjustCmd_t *)SBBufPtr); } break; case CFE_TIME_ADD_ONEHZ_ADJUSTMENT_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_Add1HZAdjustmentCmd_t))) { - CFE_TIME_Add1HZAdjustmentCmd((const CFE_TIME_Add1HZAdjustmentCmd_t *)SBBufPtr); + Status = CFE_TIME_Add1HZAdjustmentCmd((const CFE_TIME_Add1HZAdjustmentCmd_t *)SBBufPtr); } break; case CFE_TIME_SUB_ONEHZ_ADJUSTMENT_CC: if (CFE_TIME_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_TIME_Sub1HZAdjustmentCmd_t))) { - CFE_TIME_Sub1HZAdjustmentCmd((const CFE_TIME_Sub1HZAdjustmentCmd_t *)SBBufPtr); + Status = CFE_TIME_Sub1HZAdjustmentCmd((const CFE_TIME_Sub1HZAdjustmentCmd_t *)SBBufPtr); } break; default: - - CFE_TIME_Global.CommandErrorCounter++; + Status = CFE_STATUS_BAD_COMMAND_CODE; CFE_EVS_SendEvent(CFE_TIME_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command code -- ID = 0x%X, CC = %d", (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode); break; } /* switch (CFE_TIME_CMD_MID -- command code)*/ + + /* + * Any command functions returning a Status of CFE_STATUS_NO_COUNTER_INCREMENT + * will not increment either counter + */ + if (Status == CFE_SUCCESS) + { + CFE_TIME_Global.CommandCounter++; + } + else if ((Status == CFE_STATUS_COMMAND_FAILURE) || (Status == CFE_STATUS_BAD_COMMAND_CODE)) + { + CFE_TIME_Global.CommandErrorCounter++; + } + break; default: diff --git a/modules/time/fsw/src/cfe_time_task.c b/modules/time/fsw/src/cfe_time_task.c index 9cbc579ae..d99ebf93c 100644 --- a/modules/time/fsw/src/cfe_time_task.c +++ b/modules/time/fsw/src/cfe_time_task.c @@ -261,10 +261,10 @@ int32 CFE_TIME_TaskInit(void) return Status; } - CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", - CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); - Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized: %s", - VersionString); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", CFE_SRC_VERSION, CFE_BUILD_CODENAME, + CFE_LAST_OFFICIAL); + Status = + CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized: %s", VersionString); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); @@ -449,10 +449,8 @@ int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) { char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; - CFE_TIME_Global.CommandCounter++; - - CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", - CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", CFE_SRC_VERSION, CFE_BUILD_CODENAME, + CFE_LAST_OFFICIAL); CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); return CFE_SUCCESS; @@ -493,7 +491,7 @@ int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCountersCmd_t *data) CFE_EVS_SendEvent(CFE_TIME_RESET_EID, CFE_EVS_EventType_DEBUG, "Reset Counters command"); - return CFE_SUCCESS; + return CFE_STATUS_NO_COUNTER_INCREMENT; } /*---------------------------------------------------------------- @@ -504,8 +502,6 @@ int32 CFE_TIME_ResetCountersCmd(const CFE_TIME_ResetCountersCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticCmd_t *data) { - CFE_TIME_Global.CommandCounter++; - /* ** Collect diagnostics data from Time Services utilities... */ @@ -532,6 +528,7 @@ int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) { const CFE_TIME_StateCmd_Payload_t *CommandPtr = &data->Payload; const char * ClockStateText; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Verify command argument value (clock state)... @@ -558,17 +555,16 @@ int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) ClockStateText = "FLYWHEEL"; } - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_STATE_EID, CFE_EVS_EventType_INFORMATION, "Set Clock State = %s", ClockStateText); } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_STATE_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Clock State = 0x%X", (unsigned int)CommandPtr->ClockState); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -580,6 +576,7 @@ int32 CFE_TIME_SetStateCmd(const CFE_TIME_SetStateCmd_t *data) int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) { const CFE_TIME_SourceCmd_Payload_t *CommandPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; #if (CFE_PLATFORM_TIME_CFG_SOURCE == true) const char *TimeSourceText; @@ -595,7 +592,7 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) /* ** Only systems configured to select source of time data... */ - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_TIME_SetSource(CommandPtr->TimeSource); @@ -617,8 +614,6 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_SOURCE_CFG_EID, CFE_EVS_EventType_ERROR, "Set Source commands invalid without CFE_PLATFORM_TIME_CFG_SOURCE set to TRUE"); @@ -629,13 +624,12 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) /* ** Ground system database will prevent most of these errors... */ - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_SOURCE_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Time Source = 0x%X", (unsigned int)CommandPtr->TimeSource); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -647,6 +641,7 @@ int32 CFE_TIME_SetSourceCmd(const CFE_TIME_SetSourceCmd_t *data) int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) { const CFE_TIME_SignalCmd_Payload_t *CommandPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; #if (CFE_PLATFORM_TIME_CFG_SIGNAL == true) const char *ToneSourceText; @@ -662,8 +657,7 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) /* ** Only systems configured to select tone signal... */ - CFE_TIME_Global.CommandCounter++; - + ReturnCode = CFE_SUCCESS; CFE_TIME_SetSignal(CommandPtr->ToneSource); /* @@ -684,8 +678,6 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_SIGNAL_CFG_EID, CFE_EVS_EventType_ERROR, "Set Signal commands invalid without CFE_PLATFORM_TIME_CFG_SIGNAL set to TRUE"); @@ -696,13 +688,12 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) /* ** Ground system database will prevent most of these errors... */ - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_SIGNAL_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Tone Source = 0x%X", (unsigned int)CommandPtr->ToneSource); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -711,8 +702,11 @@ int32 CFE_TIME_SetSignalCmd(const CFE_TIME_SetSignalCmd_t *data) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction) +CFE_Status_t CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction) { + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; + /* ** Verify "micro-seconds" command argument... */ @@ -727,7 +721,7 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM CFE_TIME_SetDelay(Delay, Direction); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_DELAY_EID, CFE_EVS_EventType_INFORMATION, "Set Tone Delay -- secs = %u, usecs = %u, ssecs = 0x%X, dir = %d", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, @@ -737,8 +731,6 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_DELAY_CFG_EID, CFE_EVS_EventType_ERROR, "Set Delay commands invalid without CFE_PLATFORM_TIME_CFG_CLIENT set to TRUE"); @@ -746,11 +738,12 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELAY_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Tone Delay -- secs = %u, usecs = %u", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } + + return ReturnCode; } /*---------------------------------------------------------------- @@ -761,8 +754,11 @@ void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIM *-----------------------------------------------------------------*/ int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelayCmd_t *data) { - CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + + return ReturnCode; } /*---------------------------------------------------------------- @@ -773,8 +769,11 @@ int32 CFE_TIME_AddDelayCmd(const CFE_TIME_AddDelayCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelayCmd_t *data) { - CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_SetDelayImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + + return ReturnCode; } /*---------------------------------------------------------------- @@ -786,6 +785,7 @@ int32 CFE_TIME_SubDelayCmd(const CFE_TIME_SubDelayCmd_t *data) int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Verify "micro-seconds" command argument... @@ -801,7 +801,7 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) CFE_TIME_SetTime(NewTime); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_TIME_EID, CFE_EVS_EventType_INFORMATION, "Set Time -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, @@ -811,8 +811,6 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_TIME_CFG_EID, CFE_EVS_EventType_ERROR, "Set Time commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); @@ -820,12 +818,11 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_TIME_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid Time -- secs = %u, usecs = %u", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -837,6 +834,7 @@ int32 CFE_TIME_SetTimeCmd(const CFE_TIME_SetTimeCmd_t *data) int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Verify "micro-seconds" command argument... @@ -852,7 +850,7 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) CFE_TIME_SetMET(NewMET); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_MET_EID, CFE_EVS_EventType_INFORMATION, "Set MET -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, @@ -862,8 +860,6 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_MET_CFG_EID, CFE_EVS_EventType_ERROR, "Set MET commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); @@ -871,12 +867,11 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_MET_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid MET -- secs = %u, usecs = %u", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -888,6 +883,7 @@ int32 CFE_TIME_SetMETCmd(const CFE_TIME_SetMETCmd_t *data) int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) { const CFE_TIME_TimeCmd_Payload_t *CommandPtr = &data->Payload; + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; /* ** Verify "micro-seconds" command argument... @@ -903,7 +899,7 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) CFE_TIME_SetSTCF(NewSTCF); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_STCF_EID, CFE_EVS_EventType_INFORMATION, "Set STCF -- secs = %u, usecs = %u, ssecs = 0x%X", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, @@ -913,8 +909,6 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_STCF_CFG_EID, CFE_EVS_EventType_ERROR, "Set STCF commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); @@ -922,12 +916,11 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_STCF_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid STCF -- secs = %u, usecs = %u", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds); } - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -938,6 +931,8 @@ int32 CFE_TIME_SetSTCFCmd(const CFE_TIME_SetSTCFCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) { + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; + #if (CFE_PLATFORM_TIME_CFG_SERVER == true) const CFE_TIME_LeapsCmd_Payload_t *CommandPtr = &data->Payload; @@ -947,8 +942,7 @@ int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) */ CFE_TIME_SetLeapSeconds(CommandPtr->LeapSeconds); - CFE_TIME_Global.CommandCounter++; - + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_LEAPS_EID, CFE_EVS_EventType_INFORMATION, "Set Leap Seconds = %d", (int)CommandPtr->LeapSeconds); @@ -956,14 +950,12 @@ int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_LEAPS_CFG_EID, CFE_EVS_EventType_ERROR, "Set Leaps commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ - return CFE_SUCCESS; + return ReturnCode; } /*---------------------------------------------------------------- @@ -972,8 +964,11 @@ int32 CFE_TIME_SetLeapSecondsCmd(const CFE_TIME_SetLeapSecondsCmd_t *data) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction) +CFE_Status_t CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction) { + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; + /* ** Verify command arguments... */ @@ -988,7 +983,7 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ CFE_TIME_SetAdjust(Adjust, Direction); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_DELTA_EID, CFE_EVS_EventType_INFORMATION, "STCF Adjust -- secs = %u, usecs = %u, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, @@ -998,8 +993,6 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_DELTA_CFG_EID, CFE_EVS_EventType_ERROR, "STCF Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); @@ -1007,11 +1000,12 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ } else { - CFE_TIME_Global.CommandErrorCounter++; CFE_EVS_SendEvent(CFE_TIME_DELTA_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid STCF Adjust -- secs = %u, usecs = %u, dir[1=Pos, 2=Neg] = %d", (unsigned int)CommandPtr->Seconds, (unsigned int)CommandPtr->MicroSeconds, (int)Direction); } + + return ReturnCode; } /*---------------------------------------------------------------- @@ -1022,8 +1016,11 @@ void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_ *-----------------------------------------------------------------*/ int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data) { - CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + + return ReturnCode; } /*---------------------------------------------------------------- @@ -1034,8 +1031,11 @@ int32 CFE_TIME_AddAdjustCmd(const CFE_TIME_AddAdjustCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data) { - CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_AdjustImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + + return ReturnCode; } /*---------------------------------------------------------------- @@ -1044,9 +1044,11 @@ int32 CFE_TIME_SubAdjustCmd(const CFE_TIME_SubAdjustCmd_t *data) * See description in header file for argument/return detail * *-----------------------------------------------------------------*/ -void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, - CFE_TIME_AdjustDirection_Enum_t Direction) +CFE_Status_t CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction) { + CFE_Status_t ReturnCode = CFE_STATUS_COMMAND_FAILURE; + /* ** 1Hz adjustments are only valid for "Time Servers"... */ @@ -1058,7 +1060,7 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr CFE_TIME_Set1HzAdj(Adjust, Direction); - CFE_TIME_Global.CommandCounter++; + ReturnCode = CFE_SUCCESS; CFE_EVS_SendEvent(CFE_TIME_ONEHZ_EID, CFE_EVS_EventType_INFORMATION, "STCF 1Hz Adjust -- secs = %d, ssecs = 0x%X, dir[1=Pos, 2=Neg] = %d", (int)CommandPtr->Seconds, (unsigned int)CommandPtr->Subseconds, (int)Direction); @@ -1067,12 +1069,12 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr /* ** We want to know if disabled commands are being sent... */ - CFE_TIME_Global.CommandErrorCounter++; - CFE_EVS_SendEvent(CFE_TIME_ONEHZ_CFG_EID, CFE_EVS_EventType_ERROR, "1Hz Adjust commands invalid without CFE_PLATFORM_TIME_CFG_SERVER set to TRUE"); #endif /* CFE_PLATFORM_TIME_CFG_SERVER */ + + return ReturnCode; } /*---------------------------------------------------------------- @@ -1083,8 +1085,11 @@ void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr *-----------------------------------------------------------------*/ int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data) { - CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_ADD); + + return ReturnCode; } /*---------------------------------------------------------------- @@ -1095,6 +1100,9 @@ int32 CFE_TIME_Add1HZAdjustmentCmd(const CFE_TIME_Add1HZAdjustmentCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_Sub1HZAdjustmentCmd(const CFE_TIME_Sub1HZAdjustmentCmd_t *data) { - CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); - return CFE_SUCCESS; + CFE_Status_t ReturnCode; + + ReturnCode = CFE_TIME_1HzAdjImpl(&data->Payload, CFE_TIME_AdjustDirection_SUBTRACT); + + return ReturnCode; } diff --git a/modules/time/fsw/src/cfe_time_utils.h b/modules/time/fsw/src/cfe_time_utils.h index 31ef1283b..e298a0508 100644 --- a/modules/time/fsw/src/cfe_time_utils.h +++ b/modules/time/fsw/src/cfe_time_utils.h @@ -735,20 +735,22 @@ int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data); /** * @brief Time task ground command (tone delay) */ -void CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction); +CFE_Status_t CFE_TIME_SetDelayImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction); /*---------------------------------------------------------------------------------------*/ /** * @brief Time task ground command (1Hz adjust) */ -void CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, - CFE_TIME_AdjustDirection_Enum_t Direction); +CFE_Status_t CFE_TIME_1HzAdjImpl(const CFE_TIME_OneHzAdjustmentCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction); /*---------------------------------------------------------------------------------------*/ /** * @brief Time task ground command (adjust STCF) */ -void CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, CFE_TIME_AdjustDirection_Enum_t Direction); +CFE_Status_t CFE_TIME_AdjustImpl(const CFE_TIME_TimeCmd_Payload_t *CommandPtr, + CFE_TIME_AdjustDirection_Enum_t Direction); /* ** Ground command handlers...