From 34e5510eb35bd3b9b24761e37eee775774cf626b Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 4 Nov 2020 16:29:23 -0500 Subject: [PATCH] Fix #777, Use MSG APIs - Core software Update the core software from the deprecated SB APIs to the MSG APIs. --- fsw/cfe-core/src/es/cfe_es_task.c | 157 ++++++++++--------- fsw/cfe-core/src/es/cfe_es_task.h | 8 +- fsw/cfe-core/src/evs/cfe_evs_task.c | 149 +++++++++--------- fsw/cfe-core/src/evs/cfe_evs_task.h | 2 +- fsw/cfe-core/src/evs/cfe_evs_utils.c | 16 +- fsw/cfe-core/src/inc/cfe_error.h | 2 +- fsw/cfe-core/src/inc/cfe_es_msg.h | 8 +- fsw/cfe-core/src/inc/cfe_evs_msg.h | 6 +- fsw/cfe-core/src/inc/cfe_sb.h | 191 +++++++++++------------ fsw/cfe-core/src/inc/cfe_sb_events.h | 4 +- fsw/cfe-core/src/inc/cfe_tbl.h | 3 +- fsw/cfe-core/src/inc/cfe_tbl_msg.h | 8 +- fsw/cfe-core/src/inc/cfe_time_msg.h | 6 +- fsw/cfe-core/src/sb/cfe_sb_api.c | 54 ++++--- fsw/cfe-core/src/sb/cfe_sb_init.c | 7 +- fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c | 6 +- fsw/cfe-core/src/sb/cfe_sb_priv.c | 7 +- fsw/cfe-core/src/sb/cfe_sb_priv.h | 13 +- fsw/cfe-core/src/sb/cfe_sb_task.c | 72 ++++----- fsw/cfe-core/src/sb/cfe_sb_util.c | 41 ++--- fsw/cfe-core/src/tbl/cfe_tbl_api.c | 2 +- fsw/cfe-core/src/tbl/cfe_tbl_internal.c | 24 +-- fsw/cfe-core/src/tbl/cfe_tbl_task.c | 39 ++--- fsw/cfe-core/src/tbl/cfe_tbl_task.h | 6 +- fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c | 8 +- fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h | 4 +- fsw/cfe-core/src/time/cfe_time_task.c | 113 +++++++------- fsw/cfe-core/src/time/cfe_time_tone.c | 14 +- fsw/cfe-core/src/time/cfe_time_utils.c | 34 ++-- fsw/cfe-core/src/time/cfe_time_utils.h | 6 +- 30 files changed, 511 insertions(+), 499 deletions(-) diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index 75af1e6e9..49198cef2 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -252,23 +252,23 @@ int32 CFE_ES_TaskInit(void) /* ** Initialize housekeeping packet (clear user data area) */ - CFE_SB_InitMsg(&CFE_ES_TaskData.HkPacket, - CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), - sizeof(CFE_ES_TaskData.HkPacket), true); + CFE_MSG_Init(&CFE_ES_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_ES_HK_TLM_MID), + sizeof(CFE_ES_TaskData.HkPacket)); /* ** Initialize single application telemetry packet */ - CFE_SB_InitMsg(&CFE_ES_TaskData.OneAppPacket, - CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), - sizeof(CFE_ES_TaskData.OneAppPacket), true); + CFE_MSG_Init(&CFE_ES_TaskData.OneAppPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_ES_APP_TLM_MID), + sizeof(CFE_ES_TaskData.OneAppPacket)); /* ** Initialize memory pool statistics telemetry packet */ - CFE_SB_InitMsg(&CFE_ES_TaskData.MemStatsPacket, - CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), - sizeof(CFE_ES_TaskData.MemStatsPacket), true); + CFE_MSG_Init(&CFE_ES_TaskData.MemStatsPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_ES_MEMSTATS_TLM_MID), + sizeof(CFE_ES_TaskData.MemStatsPacket)); /* ** Create Software Bus message pipe @@ -434,19 +434,19 @@ int32 CFE_ES_TaskInit(void) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg) +void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr) { - CFE_SB_MsgId_t MessageID; - uint16 CommandCode; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; - MessageID = CFE_SB_GetMsgId(Msg); + CFE_MSG_GetMsgId(MsgPtr, &MessageID); switch (CFE_SB_MsgIdToValue(MessageID)) { /* ** Housekeeping telemetry request */ case CFE_ES_SEND_HK_MID: - CFE_ES_HousekeepingCmd((CFE_SB_CmdHdr_t*)Msg); + CFE_ES_HousekeepingCmd((CFE_SB_CmdHdr_t*)MsgPtr); break; /* @@ -454,174 +454,174 @@ void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg) */ case CFE_ES_CMD_MID: - CommandCode = CFE_SB_GetCmdCode(Msg); + CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); switch (CommandCode) { case CFE_ES_NOOP_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_Noop_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_Noop_t))) { - CFE_ES_NoopCmd((CFE_ES_Noop_t*)Msg); + CFE_ES_NoopCmd((CFE_ES_Noop_t*)MsgPtr); } break; case CFE_ES_RESET_COUNTERS_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_ResetCounters_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ResetCounters_t))) { - CFE_ES_ResetCountersCmd((CFE_ES_ResetCounters_t*)Msg); + CFE_ES_ResetCountersCmd((CFE_ES_ResetCounters_t*)MsgPtr); } break; case CFE_ES_RESTART_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_Restart_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_Restart_t))) { - CFE_ES_RestartCmd((CFE_ES_Restart_t*)Msg); + CFE_ES_RestartCmd((CFE_ES_Restart_t*)MsgPtr); } break; case CFE_ES_START_APP_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_StartApp_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StartApp_t))) { - CFE_ES_StartAppCmd((CFE_ES_StartApp_t*)Msg); + CFE_ES_StartAppCmd((CFE_ES_StartApp_t*)MsgPtr); } break; case CFE_ES_STOP_APP_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_StopApp_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StopApp_t))) { - CFE_ES_StopAppCmd((CFE_ES_StopApp_t*)Msg); + CFE_ES_StopAppCmd((CFE_ES_StopApp_t*)MsgPtr); } break; case CFE_ES_RESTART_APP_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_RestartApp_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_RestartApp_t))) { - CFE_ES_RestartAppCmd((CFE_ES_RestartApp_t*)Msg); + CFE_ES_RestartAppCmd((CFE_ES_RestartApp_t*)MsgPtr); } break; case CFE_ES_RELOAD_APP_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_ReloadApp_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ReloadApp_t))) { - CFE_ES_ReloadAppCmd((CFE_ES_ReloadApp_t*)Msg); + CFE_ES_ReloadAppCmd((CFE_ES_ReloadApp_t*)MsgPtr); } break; case CFE_ES_QUERY_ONE_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_QueryOne_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryOne_t))) { - CFE_ES_QueryOneCmd((CFE_ES_QueryOne_t*)Msg); + CFE_ES_QueryOneCmd((CFE_ES_QueryOne_t*)MsgPtr); } break; case CFE_ES_QUERY_ALL_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_QueryAll_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryAll_t))) { - CFE_ES_QueryAllCmd((CFE_ES_QueryAll_t*)Msg); + CFE_ES_QueryAllCmd((CFE_ES_QueryAll_t*)MsgPtr); } break; case CFE_ES_QUERY_ALL_TASKS_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_QueryAllTasks_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_QueryAllTasks_t))) { - CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasks_t*)Msg); + CFE_ES_QueryAllTasksCmd((CFE_ES_QueryAllTasks_t*)MsgPtr); } break; case CFE_ES_CLEAR_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_ClearSyslog_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ClearSyslog_t))) { - CFE_ES_ClearSyslogCmd((CFE_ES_ClearSyslog_t*)Msg); + CFE_ES_ClearSyslogCmd((CFE_ES_ClearSyslog_t*)MsgPtr); } break; case CFE_ES_WRITE_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_WriteSyslog_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_WriteSyslog_t))) { - CFE_ES_WriteSyslogCmd((CFE_ES_WriteSyslog_t*)Msg); + CFE_ES_WriteSyslogCmd((CFE_ES_WriteSyslog_t*)MsgPtr); } break; case CFE_ES_OVER_WRITE_SYSLOG_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_OverWriteSyslog_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_OverWriteSyslog_t))) { - CFE_ES_OverWriteSyslogCmd((CFE_ES_OverWriteSyslog_t*)Msg); + CFE_ES_OverWriteSyslogCmd((CFE_ES_OverWriteSyslog_t*)MsgPtr); } break; case CFE_ES_CLEAR_ER_LOG_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_ClearERLog_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ClearERLog_t))) { - CFE_ES_ClearERLogCmd((CFE_ES_ClearERLog_t*)Msg); + CFE_ES_ClearERLogCmd((CFE_ES_ClearERLog_t*)MsgPtr); } break; case CFE_ES_WRITE_ER_LOG_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_WriteERLog_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_WriteERLog_t))) { - CFE_ES_WriteERLogCmd((CFE_ES_WriteERLog_t*)Msg); + CFE_ES_WriteERLogCmd((CFE_ES_WriteERLog_t*)MsgPtr); } break; case CFE_ES_START_PERF_DATA_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_StartPerfData_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StartPerfData_t))) { - CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfData_t*)Msg); + CFE_ES_StartPerfDataCmd((CFE_ES_StartPerfData_t*)MsgPtr); } break; case CFE_ES_STOP_PERF_DATA_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_StopPerfData_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_StopPerfData_t))) { - CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfData_t*)Msg); + CFE_ES_StopPerfDataCmd((CFE_ES_StopPerfData_t*)MsgPtr); } break; case CFE_ES_SET_PERF_FILTER_MASK_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_SetPerfFilterMask_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetPerfFilterMask_t))) { - CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMask_t*)Msg); + CFE_ES_SetPerfFilterMaskCmd((CFE_ES_SetPerfFilterMask_t*)MsgPtr); } break; case CFE_ES_SET_PERF_TRIGGER_MASK_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_SetPerfTriggerMask_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetPerfTriggerMask_t))) { - CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMask_t*)Msg); + CFE_ES_SetPerfTriggerMaskCmd((CFE_ES_SetPerfTriggerMask_t*)MsgPtr); } break; case CFE_ES_RESET_PR_COUNT_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_ResetPRCount_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_ResetPRCount_t))) { - CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCount_t*)Msg); + CFE_ES_ResetPRCountCmd((CFE_ES_ResetPRCount_t*)MsgPtr); } break; case CFE_ES_SET_MAX_PR_COUNT_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_SetMaxPRCount_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SetMaxPRCount_t))) { - CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCount_t*)Msg); + CFE_ES_SetMaxPRCountCmd((CFE_ES_SetMaxPRCount_t*)MsgPtr); } break; case CFE_ES_DELETE_CDS_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_DeleteCDS_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_DeleteCDS_t))) { - CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDS_t*)Msg); + CFE_ES_DeleteCDSCmd((CFE_ES_DeleteCDS_t*)MsgPtr); } break; case CFE_ES_SEND_MEM_POOL_STATS_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_SendMemPoolStats_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_SendMemPoolStats_t))) { - CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStats_t*)Msg); + CFE_ES_SendMemPoolStatsCmd((CFE_ES_SendMemPoolStats_t*)MsgPtr); } break; case CFE_ES_DUMP_CDS_REGISTRY_CC: - if (CFE_ES_VerifyCmdLength(Msg, sizeof(CFE_ES_DumpCDSRegistry_t))) + if (CFE_ES_VerifyCmdLength(MsgPtr, sizeof(CFE_ES_DumpCDSRegistry_t))) { - CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistry_t*)Msg); + CFE_ES_DumpCDSRegistryCmd((CFE_ES_DumpCDSRegistry_t*)MsgPtr); } break; @@ -745,8 +745,8 @@ int32 CFE_ES_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.HkPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.HkPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.HkPacket); /* ** This command does not affect the command execution counter. @@ -1144,8 +1144,8 @@ int32 CFE_ES_QueryOneCmd(const CFE_ES_QueryOne_t *data) /* ** Send application status telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.OneAppPacket); - Result = CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.OneAppPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket); + Result = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.OneAppPacket); if ( Result == CFE_SUCCESS ) { CFE_ES_TaskData.CommandCounter++; @@ -1641,22 +1641,27 @@ int32 CFE_ES_WriteERLogCmd(const CFE_ES_WriteERLog_t *data) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength) { - bool result = true; - uint16 ActualLength = CFE_SB_GetTotalMsgLength(Msg); + bool result = true; + CFE_MSG_Size_t ActualLength = 0; + CFE_MSG_FcnCode_t FcnCode = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + + CFE_MSG_GetSize(MsgPtr, &ActualLength); /* ** Verify the command packet length */ if (ExpectedLength != ActualLength) { - CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(Msg); - uint16 CommandCode = CFE_SB_GetCmdCode(Msg); + CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, + (unsigned int)ActualLength, (unsigned int)ExpectedLength); result = false; CFE_ES_TaskData.CommandErrorCounter++; } @@ -1807,8 +1812,8 @@ int32 CFE_ES_SendMemPoolStatsCmd(const CFE_ES_SendMemPoolStats_t *data) /* ** Send memory statistics telemetry packet. */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.MemStatsPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_ES_TaskData.MemStatsPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_ES_TaskData.MemStatsPacket); CFE_ES_TaskData.CommandCounter++; CFE_EVS_SendEvent(CFE_ES_TLM_POOL_STATS_INFO_EID, CFE_EVS_EventType_DEBUG, diff --git a/fsw/cfe-core/src/es/cfe_es_task.h b/fsw/cfe-core/src/es/cfe_es_task.h index 83e142ac8..e687db466 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.h +++ b/fsw/cfe-core/src/es/cfe_es_task.h @@ -120,8 +120,8 @@ typedef struct /* ** ES Task operational data (not reported in housekeeping) */ - CFE_SB_MsgPtr_t MsgPtr; - CFE_SB_PipeId_t CmdPipe; + CFE_MSG_Message_t *MsgPtr; + CFE_SB_PipeId_t CmdPipe; /* ** ES Task initialization data (not reported in housekeeping) @@ -160,7 +160,7 @@ extern CFE_ES_TaskData_t CFE_ES_TaskData; */ void CFE_ES_TaskMain(void); int32 CFE_ES_TaskInit(void); -void CFE_ES_TaskPipe(CFE_SB_MsgPtr_t Msg); +void CFE_ES_TaskPipe(CFE_MSG_Message_t *MsgPtr); /* @@ -204,7 +204,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistry_t *data); ** Message Handler Helper Functions */ bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle); -bool CFE_ES_VerifyCmdLength(CFE_SB_MsgPtr_t msg, uint16 ExpectedLength); +bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength); void CFE_ES_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual); /*************************************************************************/ diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.c b/fsw/cfe-core/src/evs/cfe_evs_task.c index e5baec3cb..d9cd5f31b 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.c +++ b/fsw/cfe-core/src/evs/cfe_evs_task.c @@ -53,8 +53,8 @@ CFE_EVS_GlobalData_t CFE_EVS_GlobalData; /* ** Local function prototypes. */ -void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ); -bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength); +void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId); +bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength); /* Function Definitions */ @@ -86,8 +86,8 @@ int32 CFE_EVS_EarlyInit ( void ) memset(&CFE_EVS_GlobalData, 0, sizeof(CFE_EVS_GlobalData_t)); /* Initialize housekeeping packet */ - CFE_SB_InitMsg(&CFE_EVS_GlobalData.EVS_TlmPkt, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), - sizeof(CFE_EVS_GlobalData.EVS_TlmPkt), false); + CFE_MSG_Init(&CFE_EVS_GlobalData.EVS_TlmPkt.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_HK_TLM_MID), + sizeof(CFE_EVS_GlobalData.EVS_TlmPkt)); /* Elements stored in the hk packet that have non-zero default values */ CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_PLATFORM_EVS_DEFAULT_MSG_FORMAT_MODE; @@ -212,8 +212,8 @@ int32 CFE_EVS_CleanUpApp(CFE_ES_ResourceID_t AppID) */ void CFE_EVS_TaskMain(void) { - int32 Status; - CFE_SB_MsgPtr_t EVS_MsgPtr; /* Pointer to SB message */ + int32 Status; + CFE_MSG_Message_t *MsgPtr; /* Pointer to SB message */ CFE_ES_PerfLogEntry(CFE_MISSION_EVS_MAIN_PERF_ID); @@ -244,7 +244,7 @@ void CFE_EVS_TaskMain(void) CFE_ES_PerfLogExit(CFE_MISSION_EVS_MAIN_PERF_ID); /* Pend on receipt of packet */ - Status = CFE_SB_RcvMsg(&EVS_MsgPtr, + Status = CFE_SB_RcvMsg(&MsgPtr, CFE_EVS_GlobalData.EVS_CommandPipe, CFE_SB_PEND_FOREVER); @@ -253,7 +253,7 @@ void CFE_EVS_TaskMain(void) if (Status == CFE_SUCCESS) { /* Process cmd pipe msg */ - CFE_EVS_ProcessCommandPacket(EVS_MsgPtr); + CFE_EVS_ProcessCommandPacket(MsgPtr); }else{ CFE_ES_WriteToSysLog("EVS:Error reading cmd pipe,RC=0x%08X\n",(unsigned int)Status); }/* end if */ @@ -352,23 +352,23 @@ int32 CFE_EVS_TaskInit ( void ) ** Assumptions and Notes: ** */ -void CFE_EVS_ProcessCommandPacket ( CFE_SB_MsgPtr_t EVS_MsgPtr ) +void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr) { - CFE_SB_MsgId_t MessageID; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; - MessageID = CFE_SB_GetMsgId(EVS_MsgPtr); + CFE_MSG_GetMsgId(MsgPtr, &MessageID); /* Process all SB messages */ switch (CFE_SB_MsgIdToValue(MessageID)) { case CFE_EVS_CMD_MID: /* EVS task specific command */ - CFE_EVS_ProcessGroundCommand(EVS_MsgPtr); + CFE_EVS_ProcessGroundCommand(MsgPtr, MessageID); break; case CFE_EVS_SEND_HK_MID: /* Housekeeping request */ - CFE_EVS_ReportHousekeepingCmd((CFE_SB_CmdHdr_t*)EVS_MsgPtr); + CFE_EVS_ReportHousekeepingCmd((CFE_SB_CmdHdr_t*)MsgPtr); break; default: @@ -396,179 +396,182 @@ void CFE_EVS_ProcessCommandPacket ( CFE_SB_MsgPtr_t EVS_MsgPtr ) ** Assumptions and Notes: ** */ -void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) +void CFE_EVS_ProcessGroundCommand(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { /* status will get reset if it passes length check */ - int32 Status = CFE_STATUS_WRONG_MSG_LENGTH; + int32 Status = CFE_STATUS_WRONG_MSG_LENGTH; + CFE_MSG_FcnCode_t FcnCode = 0; + + CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); /* Process "known" EVS task ground commands */ - switch (CFE_SB_GetCmdCode(EVS_MsgPtr)) + switch (FcnCode) { case CFE_EVS_NOOP_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_Noop_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_Noop_t))) { - Status = CFE_EVS_NoopCmd((CFE_EVS_Noop_t*)EVS_MsgPtr); + Status = CFE_EVS_NoopCmd((CFE_EVS_Noop_t*)MsgPtr); } break; case CFE_EVS_RESET_COUNTERS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_ResetCounters_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetCounters_t))) { - Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCounters_t*)EVS_MsgPtr); + Status = CFE_EVS_ResetCountersCmd((CFE_EVS_ResetCounters_t*)MsgPtr); } break; case CFE_EVS_ENABLE_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_EnableEventType_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableEventType_t))) { - Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventType_t*)EVS_MsgPtr); + Status = CFE_EVS_EnableEventTypeCmd((CFE_EVS_EnableEventType_t*)MsgPtr); } break; case CFE_EVS_DISABLE_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_DisableEventType_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableEventType_t))) { - Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventType_t*)EVS_MsgPtr); + Status = CFE_EVS_DisableEventTypeCmd((CFE_EVS_DisableEventType_t*)MsgPtr); } break; case CFE_EVS_SET_EVENT_FORMAT_MODE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_SetEventFormatMode_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_SetEventFormatMode_t))) { - Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatMode_t*)EVS_MsgPtr); + Status = CFE_EVS_SetEventFormatModeCmd((CFE_EVS_SetEventFormatMode_t*)MsgPtr); } break; case CFE_EVS_ENABLE_APP_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_EnableAppEventType_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableAppEventType_t))) { - Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventType_t*)EVS_MsgPtr); + Status = CFE_EVS_EnableAppEventTypeCmd((CFE_EVS_EnableAppEventType_t*)MsgPtr); } break; case CFE_EVS_DISABLE_APP_EVENT_TYPE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_DisableAppEventType_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableAppEventType_t))) { - Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventType_t*)EVS_MsgPtr); + Status = CFE_EVS_DisableAppEventTypeCmd((CFE_EVS_DisableAppEventType_t*)MsgPtr); } break; case CFE_EVS_ENABLE_APP_EVENTS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_EnableAppEvents_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnableAppEvents_t))) { - Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEvents_t*)EVS_MsgPtr); + Status = CFE_EVS_EnableAppEventsCmd((CFE_EVS_EnableAppEvents_t*)MsgPtr); } break; case CFE_EVS_DISABLE_APP_EVENTS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_DisableAppEvents_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisableAppEvents_t))) { - Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEvents_t*)EVS_MsgPtr); + Status = CFE_EVS_DisableAppEventsCmd((CFE_EVS_DisableAppEvents_t*)MsgPtr); } break; case CFE_EVS_RESET_APP_COUNTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_ResetAppCounter_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetAppCounter_t))) { - Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounter_t*)EVS_MsgPtr); + Status = CFE_EVS_ResetAppCounterCmd((CFE_EVS_ResetAppCounter_t*)MsgPtr); } break; case CFE_EVS_SET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, (uint16) sizeof(CFE_EVS_SetFilter_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, (uint16) sizeof(CFE_EVS_SetFilter_t))) { - Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilter_t*)EVS_MsgPtr); + Status = CFE_EVS_SetFilterCmd((CFE_EVS_SetFilter_t*)MsgPtr); } break; case CFE_EVS_ENABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_EnablePorts_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_EnablePorts_t))) { - Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePorts_t*)EVS_MsgPtr); + Status = CFE_EVS_EnablePortsCmd((CFE_EVS_EnablePorts_t*)MsgPtr); } break; case CFE_EVS_DISABLE_PORTS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_DisablePorts_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DisablePorts_t))) { - Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePorts_t*)EVS_MsgPtr); + Status = CFE_EVS_DisablePortsCmd((CFE_EVS_DisablePorts_t*)MsgPtr); } break; case CFE_EVS_RESET_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_ResetFilter_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetFilter_t))) { - Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilter_t*)EVS_MsgPtr); + Status = CFE_EVS_ResetFilterCmd((CFE_EVS_ResetFilter_t*)MsgPtr); } break; case CFE_EVS_RESET_ALL_FILTERS_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_ResetAllFilters_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ResetAllFilters_t))) { - Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFilters_t*)EVS_MsgPtr); + Status = CFE_EVS_ResetAllFiltersCmd((CFE_EVS_ResetAllFilters_t*)MsgPtr); } break; case CFE_EVS_ADD_EVENT_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_AddEventFilter_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_AddEventFilter_t))) { - Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilter_t*)EVS_MsgPtr); + Status = CFE_EVS_AddEventFilterCmd((CFE_EVS_AddEventFilter_t*)MsgPtr); } break; case CFE_EVS_DELETE_EVENT_FILTER_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_DeleteEventFilter_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_DeleteEventFilter_t))) { - Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilter_t*)EVS_MsgPtr); + Status = CFE_EVS_DeleteEventFilterCmd((CFE_EVS_DeleteEventFilter_t*)MsgPtr); } break; case CFE_EVS_WRITE_APP_DATA_FILE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_WriteAppDataFile_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_WriteAppDataFile_t))) { - Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFile_t*)EVS_MsgPtr); + Status = CFE_EVS_WriteAppDataFileCmd((CFE_EVS_WriteAppDataFile_t*)MsgPtr); } break; case CFE_EVS_SET_LOG_MODE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_SetLogMode_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_SetLogMode_t))) { - Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogMode_t*)EVS_MsgPtr); + Status = CFE_EVS_SetLogModeCmd((CFE_EVS_SetLogMode_t*)MsgPtr); } break; case CFE_EVS_CLEAR_LOG_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_ClearLog_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_ClearLog_t))) { - Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLog_t *)EVS_MsgPtr); + Status = CFE_EVS_ClearLogCmd((CFE_EVS_ClearLog_t *)MsgPtr); } break; case CFE_EVS_WRITE_LOG_DATA_FILE_CC: - if (CFE_EVS_VerifyCmdLength(EVS_MsgPtr, sizeof(CFE_EVS_WriteLogDataFile_t))) + if (CFE_EVS_VerifyCmdLength(MsgPtr, sizeof(CFE_EVS_WriteLogDataFile_t))) { - Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFile_t*)EVS_MsgPtr); + Status = CFE_EVS_WriteLogDataFileCmd((CFE_EVS_WriteLogDataFile_t*)MsgPtr); } break; @@ -576,9 +579,9 @@ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) default: EVS_SendEvent(CFE_EVS_ERR_CC_EID, CFE_EVS_EventType_ERROR, - "Invalid command code -- ID = 0x%08x, CC = %d", - (unsigned int)CFE_SB_MsgIdToValue(CFE_SB_GetMsgId(EVS_MsgPtr)), - (int)CFE_SB_GetCmdCode(EVS_MsgPtr)); + "Invalid command code -- ID = 0x%08x, CC = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), + (unsigned int)FcnCode); Status = CFE_STATUS_BAD_COMMAND_CODE; break; @@ -608,23 +611,27 @@ void CFE_EVS_ProcessGroundCommand ( CFE_SB_MsgPtr_t EVS_MsgPtr ) ** Assumptions and Notes: ** */ -bool CFE_EVS_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_EVS_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength) { - bool result = true; - uint16 ActualLength = CFE_SB_GetTotalMsgLength(Msg); + bool result = true; + CFE_MSG_Size_t ActualLength = 0; + CFE_MSG_FcnCode_t FcnCode = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + + CFE_MSG_GetSize(MsgPtr, &ActualLength); /* ** Verify the command packet length */ if (ExpectedLength != ActualLength) { - CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(Msg); - uint16 CommandCode = CFE_SB_GetCmdCode(Msg); + CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); EVS_SendEvent(CFE_EVS_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, + (unsigned int)ActualLength, (unsigned int)ExpectedLength); result = false; } @@ -725,9 +732,9 @@ int32 CFE_EVS_ReportHousekeepingCmd (const CFE_SB_CmdHdr_t *data) AppTlmDataPtr->AppMessageSentCounter = 0; } - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_EVS_GlobalData.EVS_TlmPkt); return CFE_STATUS_NO_COUNTER_INCREMENT; } /* End of CFE_EVS_ReportHousekeepingCmd() */ diff --git a/fsw/cfe-core/src/evs/cfe_evs_task.h b/fsw/cfe-core/src/evs/cfe_evs_task.h index 15a1ad321..bf6007f3b 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_task.h +++ b/fsw/cfe-core/src/evs/cfe_evs_task.h @@ -140,7 +140,7 @@ extern CFE_EVS_GlobalData_t CFE_EVS_GlobalData; * Functions used within this module and by the unit test */ extern int32 CFE_EVS_TaskInit (void); -extern void CFE_EVS_ProcessCommandPacket ( CFE_SB_MsgPtr_t EVS_MsgPtr ); +extern void CFE_EVS_ProcessCommandPacket(CFE_MSG_Message_t *MsgPtr); /* * EVS Message Handler Functions diff --git a/fsw/cfe-core/src/evs/cfe_evs_utils.c b/fsw/cfe-core/src/evs/cfe_evs_utils.c index 906d808b0..41c12a961 100644 --- a/fsw/cfe-core/src/evs/cfe_evs_utils.c +++ b/fsw/cfe-core/src/evs/cfe_evs_utils.c @@ -404,8 +404,8 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 int ExpandedLength; /* Initialize EVS event packets */ - CFE_SB_InitMsg(&LongEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), - sizeof(LongEventTlm), true); + CFE_MSG_Init(&LongEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID), + sizeof(LongEventTlm)); LongEventTlm.Payload.PacketID.EventID = EventID; LongEventTlm.Payload.PacketID.EventType = EventType; @@ -428,7 +428,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId(); /* Set the packet timestamp */ - CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &LongEventTlm, *TimeStamp); + CFE_MSG_SetMsgTime((CFE_MSG_Message_t *) &LongEventTlm, *TimeStamp); /* Write event to the event log */ EVS_AddLog(&LongEventTlm); @@ -439,7 +439,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_LONG) { /* Send long event via SoftwareBus */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &LongEventTlm); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &LongEventTlm); } else if (CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode == CFE_EVS_MsgFormat_SHORT) { @@ -449,11 +449,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 * * This goes out on a separate message ID. */ - CFE_SB_InitMsg(&ShortEventTlm, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), - sizeof(ShortEventTlm), true); - CFE_SB_SetMsgTime((CFE_SB_Msg_t *) &ShortEventTlm, *TimeStamp); + CFE_MSG_Init(&ShortEventTlm.TlmHeader.BaseMsg, CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID), + sizeof(ShortEventTlm)); + CFE_MSG_SetMsgTime((CFE_MSG_Message_t *) &ShortEventTlm, *TimeStamp); ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID; - CFE_SB_SendMsg((CFE_SB_Msg_t *) &ShortEventTlm); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &ShortEventTlm); } /* Increment message send counters (prevent rollover) */ diff --git a/fsw/cfe-core/src/inc/cfe_error.h b/fsw/cfe-core/src/inc/cfe_error.h index 4a62d6ac0..b561c2bfa 100644 --- a/fsw/cfe-core/src/inc/cfe_error.h +++ b/fsw/cfe-core/src/inc/cfe_error.h @@ -856,7 +856,7 @@ typedef int32 CFE_Status_t; /** * @brief Wrong Message Type * - * This error code will be returned when a request such as #CFE_SB_SetMsgTime + * This error code will be returned when a request such as #CFE_MSG_SetMsgTime * is made on a packet that does not include a field for msg time. * */ diff --git a/fsw/cfe-core/src/inc/cfe_es_msg.h b/fsw/cfe-core/src/inc/cfe_es_msg.h index 5f6b71ff3..2f370a55f 100644 --- a/fsw/cfe-core/src/inc/cfe_es_msg.h +++ b/fsw/cfe-core/src/inc/cfe_es_msg.h @@ -1531,7 +1531,7 @@ typedef struct CFE_ES_OneAppTlm_Payload typedef struct CFE_ES_OneAppTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */ + CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ CFE_ES_OneAppTlm_Payload_t Payload; } CFE_ES_OneAppTlm_t; @@ -1547,7 +1547,7 @@ typedef struct CFE_ES_PoolStatsTlm_Payload typedef struct CFE_ES_MemStatsTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */ + CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ CFE_ES_PoolStatsTlm_Payload_t Payload; } CFE_ES_MemStatsTlm_t; @@ -1644,8 +1644,8 @@ typedef struct CFE_ES_HousekeepingTlm_Payload typedef struct CFE_ES_HousekeepingTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_ES_HousekeepingTlm_Payload_t Payload; + CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ + CFE_ES_HousekeepingTlm_Payload_t Payload; } CFE_ES_HousekeepingTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_evs_msg.h b/fsw/cfe-core/src/inc/cfe_evs_msg.h index 23e7cda08..63c9496ef 100644 --- a/fsw/cfe-core/src/inc/cfe_evs_msg.h +++ b/fsw/cfe-core/src/inc/cfe_evs_msg.h @@ -1181,7 +1181,7 @@ typedef struct CFE_EVS_HousekeepingTlm_Payload { } CFE_EVS_HousekeepingTlm_Payload_t; typedef struct CFE_EVS_HousekeepingTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_SB_TlmHdr_t TlmHeader; CFE_EVS_HousekeepingTlm_Payload_t Payload; } CFE_EVS_HousekeepingTlm_t; @@ -1224,13 +1224,13 @@ typedef struct CFE_EVS_ShortEventTlm_Payload { } CFE_EVS_ShortEventTlm_Payload_t; typedef struct CFE_EVS_LongEventTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_SB_TlmHdr_t TlmHeader; CFE_EVS_LongEventTlm_Payload_t Payload; } CFE_EVS_LongEventTlm_t; typedef struct CFE_EVS_ShortEventTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_SB_TlmHdr_t TlmHeader; CFE_EVS_ShortEventTlm_Payload_t Payload; } CFE_EVS_ShortEventTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_sb.h b/fsw/cfe-core/src/inc/cfe_sb.h index 59b9ac419..e4bb24a49 100644 --- a/fsw/cfe-core/src/inc/cfe_sb.h +++ b/fsw/cfe-core/src/inc/cfe_sb.h @@ -103,14 +103,16 @@ */ #define CFE_SB_INVALID_MSG_ID CFE_SB_MSGID_RESERVED +#ifndef CFE_OMIT_DEPRECATED_6_8 /** * \defgroup CFESBPktTypeDefs cFE SB Packet Type Defines * \{ */ -#define CFE_SB_PKTTYPE_INVALID 0 /**< \brief #CFE_SB_GetPktType response if message type can not be determined */ -#define CFE_SB_PKTTYPE_CMD 1 /**< \brief #CFE_SB_GetPktType response for command packets */ -#define CFE_SB_PKTTYPE_TLM 2 /**< \brief #CFE_SB_GetPktType response for telemetry packets */ +#define CFE_SB_PKTTYPE_INVALID CFE_MSG_Type_Invalid /**< \brief #CFE_SB_GetPktType response if message type can not be determined */ +#define CFE_SB_PKTTYPE_CMD CFE_MSG_Type_Cmd /**< \brief #CFE_SB_GetPktType response for command packets */ +#define CFE_SB_PKTTYPE_TLM CFE_MSG_Type_Tlm /**< \brief #CFE_SB_GetPktType response for telemetry packets */ /** \} */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /* ** Macro Definitions @@ -147,19 +149,21 @@ ** Type Definitions */ +#ifndef CFE_OMIT_DEPRECATED_6_8 /** \brief Software Bus generic message */ typedef CFE_MSG_Message_t CFE_SB_Msg_t; +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /** \brief Aligned Software Bus command header */ typedef union CFE_SB_CmdHdr { CFE_MSG_CommandHeader_t Cmd; - CFE_SB_Msg_t BaseMsg; + CFE_MSG_Message_t BaseMsg; } CFE_SB_CmdHdr_t; /** \brief Aligned Software Bus telemetry header */ typedef union CFE_SB_TlmHdr { CFE_MSG_TelemetryHeader_t Tlm; - CFE_SB_Msg_t BaseMsg; + CFE_MSG_Message_t BaseMsg; } CFE_SB_TlmHdr_t; #define CFE_SB_CMD_HDR_SIZE (sizeof(CFE_SB_CmdHdr_t))/**< \brief Size of #CFE_SB_CmdHdr_t in bytes */ @@ -179,11 +183,13 @@ typedef uint32 CFE_SB_TimeOut_t; */ typedef uint8 CFE_SB_PipeId_t; -/** \brief CFE_SB_MsgPtr_t defined as a pointer to an SB Message */ -typedef CFE_SB_Msg_t *CFE_SB_MsgPtr_t; +#ifndef CFE_OMIT_DEPRECATED_6_8 +/** \brief Pointer to an SB Message */ +typedef CFE_MSG_Message_t *CFE_SB_MsgPtr_t; /** \brief CFE_SB_MsgPayloadPtr_t defined as an opaque pointer to a message Payload portion */ typedef uint8 *CFE_SB_MsgPayloadPtr_t; +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /** \brief CFE_SB_ZeroCopyHandle_t to primitive type definition ** @@ -542,8 +548,8 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI ** of a telemetry message. ** ** \param[in] MsgPtr A pointer to the message to be sent. This must point -** to the first byte of the software bus message header -** (#CFE_SB_Msg_t). +** to the first byte of the message header +** (#CFE_MSG_Message_t). ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -553,7 +559,7 @@ CFE_Status_t CFE_SB_UnsubscribeLocal(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeI ** ** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_PassMsg **/ -CFE_Status_t CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr); +CFE_Status_t CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** @@ -575,8 +581,8 @@ CFE_Status_t CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr); ** sequence counter in a telemetry message. ** ** \param[in] MsgPtr A pointer to the message to be sent. This must point -** to the first byte of the software bus message header -** (#CFE_SB_Msg_t). +** to the first byte of the message header +** (#CFE_MSG_Message_t). ** ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS @@ -586,7 +592,7 @@ CFE_Status_t CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr); ** ** \sa #CFE_SB_RcvMsg, #CFE_SB_ZeroCopySend, #CFE_SB_SendMsg **/ -CFE_Status_t CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr); +CFE_Status_t CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** @@ -602,16 +608,17 @@ CFE_Status_t CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr); ** random. Therefore, it is recommended that the return code be tested ** for CFE_SUCCESS before processing the message. ** -** \param[in, out] BufPtr A pointer to a local variable of type #CFE_SB_MsgPtr_t. -** Typically a caller declares a ptr of type CFE_SB_Msg_t -** (i.e. CFE_SB_Msg_t *Ptr) then gives the address of that +** \param[in, out] BufPtr A pointer to a message pointer. +** Typically a caller declares a ptr of type CFE_MSG_Message_t +** (i.e. CFE_MSG_Message_t *Ptr) then gives the address of that ** pointer (&Ptr) as this parmeter. After a successful ** receipt of a message, *BufPtr will point to the first ** byte of the software bus message header. This should be ** used as a read-only pointer (in systems with an MMU, ** writes to this pointer may cause a memory protection fault). ** The *BufPtr is valid only until the next call to -** CFE_SB_RcvMsg for the same pipe. \n *BufPtr is a pointer to the message obtained from the pipe. Valid +** CFE_SB_RcvMsg for the same pipe. \n *BufPtr is a pointer +** to the message obtained from the pipe. Valid ** only until the next call to CFE_SB_RcvMsg for the same pipe. ** ** \param[in] PipeId The pipe ID of the pipe containing the message to be obtained. @@ -630,7 +637,7 @@ CFE_Status_t CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr); ** ** \sa #CFE_SB_SendMsg, #CFE_SB_ZeroCopySend **/ -CFE_Status_t CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut); +CFE_Status_t CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, CFE_SB_PipeId_t PipeId, int32 TimeOut); /**@}*/ /** @defgroup CFEAPISBZeroCopy cFE Zero Copy Message APIs @@ -671,8 +678,8 @@ CFE_Status_t CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, CFE_SB_PipeId_t PipeId, int ** ** \sa #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopySend **/ -CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, - CFE_SB_ZeroCopyHandle_t *BufferHandle); +CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, + CFE_SB_ZeroCopyHandle_t *BufferHandle); /*****************************************************************************/ /** @@ -701,7 +708,7 @@ CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, ** ** \sa #CFE_SB_ZeroCopyGetPtr, #CFE_SB_ZeroCopySend **/ -CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); /*****************************************************************************/ /** @@ -741,7 +748,7 @@ CFE_Status_t CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCop ** ** \sa #CFE_SB_SendMsg, #CFE_SB_RcvMsg, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr **/ -CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); /*****************************************************************************/ /** @@ -783,16 +790,19 @@ CFE_Status_t CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t B ** ** \sa #CFE_SB_PassMsg, #CFE_SB_ZeroCopySend, #CFE_SB_ZeroCopyReleasePtr, #CFE_SB_ZeroCopyGetPtr **/ -CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); +CFE_Status_t CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle); /**@}*/ /** @defgroup CFEAPISBSetMessage cFE Setting Message Characteristics APIs * @{ */ +#ifndef CFE_OMIT_DEPRECATED_6_8 + /*****************************************************************************/ /** -** \brief Initialize a buffer for a software bus message. +** \brief DEPRECATED - Initialize a buffer for a software bus message. +** \deprecated Use CFE_MSG_Init ** ** \par Description ** This routine fills in the header information needed to create a @@ -814,9 +824,6 @@ CFE_Status_t CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, CFE_SB_ZeroCopyHandle_t B ** \param[in] Clear A flag indicating whether to clear the rest of the message: ** \arg true - fill sequence count and packet data with zeroes. ** \arg false - leave sequence count and packet data unchanged. -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode **/ void CFE_SB_InitMsg(void *MsgPtr, CFE_SB_MsgId_t MsgId, @@ -825,7 +832,8 @@ void CFE_SB_InitMsg(void *MsgPtr, /*****************************************************************************/ /** -** \brief Sets the message ID of a software bus message. +** \brief DEPRECATED - Sets the message ID of a software bus message. +** \deprecated Use CFE_MSG_SetMsgId ** ** \par Description ** This routine sets the Message ID in a software bus message header. @@ -837,13 +845,10 @@ void CFE_SB_InitMsg(void *MsgPtr, ** This must point to the first byte of the message header. ** ** \param[in] MsgId The message ID to put into the message header. -** -** -** \sa #CFE_SB_GetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, +void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ /** @@ -864,15 +869,14 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, ** This must point to the first byte of the message header. ** ** \param[in] DataLength The length to set (size of the user data, in bytes). -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength); +void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr,uint16 DataLength); +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** -** \brief Sets the total length of a software bus message. +** \brief DEPRECATED: Sets the total length of a software bus message. +** \deprecated Use CFE_MSG_SetSize ** ** \par Description ** This routine sets the field in the SB message header that determines @@ -889,20 +893,18 @@ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr,uint16 DataLength); ** ** \param[in] TotalLength The length to set (total size of the message, in bytes, ** including headers). -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength); +void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr,uint16 TotalLength); /*****************************************************************************/ /** ** \brief Sets the time field in a software bus message. +** \deprecated Use CFE_MSG_SetMsgTime ** ** \par Description ** This routine sets the time of a software bus message. Most applications ** will want to use #CFE_SB_TimeStampMsg instead of this function. But, -** when needed, #CFE_SB_SetMsgTime can be used to send a group of SB messages +** when needed, this API can be used to send a group of SB messages ** with identical time stamps. ** ** \par Assumptions, External Events, and Notes: @@ -921,11 +923,10 @@ void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength); ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_SB_WRONG_MSG_TYPE \copybrief CFE_SB_WRONG_MSG_TYPE -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -CFE_Status_t CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t Time); +CFE_Status_t CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t Time); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ + /*****************************************************************************/ /** @@ -942,15 +943,14 @@ CFE_Status_t CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t Time); ** ** \param[in] MsgPtr A pointer to the buffer that contains the software bus message. ** This must point to the first byte of the message header. -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_SetCmdCode, #CFE_SB_InitMsg **/ -void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr); +void CFE_SB_TimeStampMsg(CFE_MSG_Message_t *MsgPtr); +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** -** \brief Sets the command code field in a software bus message. +** \brief DEPRECATED:Sets the command code field in a software bus message. +** \deprecated Use CFE_MSG_SetFcnCode ** ** \par Description ** This routine sets the command code of a software bus message (if SB @@ -969,11 +969,9 @@ void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr); ** \return Execution status, see \ref CFEReturnCodes ** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS ** \retval #CFE_SB_WRONG_MSG_TYPE \copybrief CFE_SB_WRONG_MSG_TYPE -** -** \sa #CFE_SB_SetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_TimeStampMsg, #CFE_SB_GetCmdCode, #CFE_SB_InitMsg **/ -CFE_Status_t CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, uint16 CmdCode); +CFE_Status_t CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CmdCode); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /******************************************************************************/ /** @@ -1030,15 +1028,15 @@ int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, ** \param[in] MsgPtr A pointer to the buffer that contains the software bus message. ** ** \return A pointer to the first byte of user data within the software bus message. -** -** \sa #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr); +void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr); + +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** -** \brief Get the message ID of a software bus message. +** \brief DEPRECATED:Get the message ID of a software bus message. +** \deprecated Use CFE_MSG_GetMsgId ** ** \par Description ** This routine returns the message ID from a software bus message. @@ -1049,11 +1047,9 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr); ** \param[in] MsgPtr A pointer to the buffer that contains the software bus message. ** ** \return The software bus Message ID from the message header. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_SetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr); +CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_MSG_Message_t *MsgPtr); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /*****************************************************************************/ /** @@ -1069,15 +1065,15 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr); ** This must point to the first byte of the message header. ** ** \return The size (in bytes) of the user data in the software bus message. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_SetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr); +uint16 CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr); + +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** -** \brief Gets the total length of a software bus message. +** \brief DEPRECATED: Gets the total length of a software bus message. +** \deprecated Use CFE_MSG_GetSize ** ** \par Description ** This routine returns the total size of the software bus message. @@ -1090,15 +1086,13 @@ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr); ** This must point to the first byte of the message header. ** ** \return The total size (in bytes) of the software bus message, including headers. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_SetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr); +uint16 CFE_SB_GetTotalMsgLength(const CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** -** \brief Gets the command code field from a software bus message. +** \brief DEPRECATED: Gets the command code field from a software bus message. +** \deprecated Use CFE_MSG_GetFcnCode ** ** \par Description ** This routine gets the command code from a software bus message (if @@ -1114,15 +1108,13 @@ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr); ** ** \return The command code included in the software bus message header (if present). ** Otherwise, returns a command code value of zero. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_SetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr); +uint16 CFE_SB_GetCmdCode(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** -** \brief Gets the time field from a software bus message. +** \brief DEPRECATED: Gets the time field from a software bus message. +** \deprecated Use CFE_MSG_GetMsgTime ** ** \par Description ** This routine gets the time from a software bus message. @@ -1137,11 +1129,9 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr); ** ** \return The system time included in the software bus message header (if present), ** otherwise, returns a time value of zero. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_SetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr); +CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_MSG_Message_t *MsgPtr); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /******************************************************************************/ /** @@ -1185,13 +1175,15 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr); int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString, uint32 DestMaxSize, uint32 SourceMaxSize); /**@}*/ +#ifndef CFE_OMIT_DEPRECATED_6_8 /** @defgroup CFEAPISBChecksum cFE Checksum Control APIs * @{ */ /*****************************************************************************/ /** -** \brief Gets the checksum field from a software bus message. +** \brief DEPRECATED:Gets the checksum field from a software bus message. +** \deprecated No use case ** ** \par Description ** This routine gets the checksum (or other message integrity check @@ -1210,16 +1202,13 @@ int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, ** ** \return The checksum included in the software bus message header (if present), otherwise, ** returns a checksum value of zero. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum -** #CFE_SB_ValidateChecksum, #CFE_SB_GenerateChecksum **/ -uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr); +uint16 CFE_SB_GetChecksum(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** -** \brief Calculates and sets the checksum of a software bus message +** \brief DEPRECATED:Calculates and sets the checksum of a software bus message +** \deprecated Use CFE_MSG_GenerateChecksum ** ** \par Description ** This routine calculates the checksum of a software bus message according @@ -1234,14 +1223,13 @@ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr); ** ** \param[in] MsgPtr A pointer to the buffer that contains the software bus message. ** This must point to the first byte of the message header. -** -** \sa #CFE_SB_ValidateChecksum, #CFE_SB_GetChecksum **/ -void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr); +void CFE_SB_GenerateChecksum(CFE_MSG_Message_t *MsgPtr); /*****************************************************************************/ /** -** \brief Validates the checksum of a software bus message. +** \brief DEPRECATED:Validates the checksum of a software bus message. +** \deprecated Use CFE_MSG_ValidateChecksum ** ** \par Description ** This routine calculates the expected checksum of a software bus message @@ -1260,11 +1248,10 @@ void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr); ** \return Boolean checksum result ** \retval true The checksum field in the packet is valid. ** \retval false The checksum field in the packet is not valid or the message type is wrong. -** -** \sa #CFE_SB_GenerateChecksum, #CFE_SB_GetChecksum **/ -bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr); +bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr); /**@}*/ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /** @defgroup CFEAPISBMessageID cFE Message ID APIs * @{ @@ -1368,6 +1355,7 @@ static inline CFE_SB_MsgId_t CFE_SB_ValueToMsgId(CFE_SB_MsgId_Atom_t MsgIdValue) return Result; } +#ifndef CFE_OMIT_DEPRECATED_6_8 /*****************************************************************************/ /** * \brief Identifies packet type given message ID @@ -1376,11 +1364,12 @@ static inline CFE_SB_MsgId_t CFE_SB_ValueToMsgId(CFE_SB_MsgId_Atom_t MsgIdValue) * Provides the packet type associated with the given message ID * * \return Packet type - * \retval #CFE_SB_PKTTYPE_CMD Command packet type - * \retval #CFE_SB_PKTTYPE_TLM Telemetry packet type - * \retval #CFE_SB_PKTTYPE_INVALID Invalid/unknown packet type + * \retval #CFE_MSG_Type_Cmd Command packet type + * \retval #CFE_MSG_Type_Tlm Telemetry packet type + * \retval #CFE_MSG_Type_Invalid Invalid/unknown packet type */ uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId); +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /**@}*/ diff --git a/fsw/cfe-core/src/inc/cfe_sb_events.h b/fsw/cfe-core/src/inc/cfe_sb_events.h index c99e55eed..464d4a519 100644 --- a/fsw/cfe-core/src/inc/cfe_sb_events.h +++ b/fsw/cfe-core/src/inc/cfe_sb_events.h @@ -713,8 +713,8 @@ **/ #define CFE_SB_BAD_CMD_CODE_EID 42 -/** \brief 'Invalid Cmd, Unexpected Msg Id: 0x\%04x' -** \event 'Invalid Cmd, Unexpected Msg Id: 0x\%04x' +/** \brief 'Invalid Cmd, Unexpected Msg Id: 0x\%x' +** \event 'Invalid Cmd, Unexpected Msg Id: 0x\%x' ** ** \par Type: ERROR ** diff --git a/fsw/cfe-core/src/inc/cfe_tbl.h b/fsw/cfe-core/src/inc/cfe_tbl.h index 4e29481d2..057a74173 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl.h +++ b/fsw/cfe-core/src/inc/cfe_tbl.h @@ -45,6 +45,7 @@ #include "common_types.h" /* Basic Data Types */ #include "cfe_time.h" #include "osconfig.h" +#include "cfe_msg_typedefs.h" /******************* Macro Definitions ***********************/ @@ -812,7 +813,7 @@ CFE_Status_t CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName); ** \sa #CFE_TBL_Register ** ******************************************************************************/ -CFE_Status_t CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, uint16 CommandCode, uint32 Parameter); +CFE_Status_t CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, uint32 Parameter); /**@}*/ #endif /* _cfe_tbl_ */ diff --git a/fsw/cfe-core/src/inc/cfe_tbl_msg.h b/fsw/cfe-core/src/inc/cfe_tbl_msg.h index b93445fea..8a758ebb6 100644 --- a/fsw/cfe-core/src/inc/cfe_tbl_msg.h +++ b/fsw/cfe-core/src/inc/cfe_tbl_msg.h @@ -762,8 +762,8 @@ typedef struct CFE_TBL_HousekeepingTlm_Payload typedef struct CFE_TBL_HousekeepingTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_TBL_HousekeepingTlm_Payload_t Payload; + CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ + CFE_TBL_HousekeepingTlm_Payload_t Payload; } CFE_TBL_HousekeepingTlm_t; @@ -810,8 +810,8 @@ typedef struct CFE_TBL_TblRegPacket_Payload typedef struct CFE_TBL_TableRegistryTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; /**< \brief cFE Software Bus Telemetry Message Header */ - CFE_TBL_TblRegPacket_Payload_t Payload; + CFE_SB_TlmHdr_t TlmHeader; /**< \brief cFE Software Bus Telemetry Message Header */ + CFE_TBL_TblRegPacket_Payload_t Payload; } CFE_TBL_TableRegistryTlm_t; diff --git a/fsw/cfe-core/src/inc/cfe_time_msg.h b/fsw/cfe-core/src/inc/cfe_time_msg.h index d381cab8d..e0f2b7b12 100644 --- a/fsw/cfe-core/src/inc/cfe_time_msg.h +++ b/fsw/cfe-core/src/inc/cfe_time_msg.h @@ -977,8 +977,8 @@ typedef struct CFE_TIME_HousekeepingTlm_Payload typedef struct CFE_TIME_HousekeepingTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; - CFE_TIME_HousekeepingTlm_Payload_t Payload; + CFE_SB_TlmHdr_t TlmHeader; + CFE_TIME_HousekeepingTlm_Payload_t Payload; } CFE_TIME_HousekeepingTlm_t; @@ -1135,7 +1135,7 @@ typedef struct CFE_TIME_DiagnosticTlm_Payload typedef struct CFE_TIME_DiagnosticTlm { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + CFE_SB_TlmHdr_t TlmHeader; CFE_TIME_DiagnosticTlm_Payload_t Payload; } CFE_TIME_DiagnosticTlm_t; diff --git a/fsw/cfe-core/src/sb/cfe_sb_api.c b/fsw/cfe-core/src/sb/cfe_sb_api.c index 736fac134..c233c2b81 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_api.c +++ b/fsw/cfe-core/src/sb/cfe_sb_api.c @@ -293,7 +293,7 @@ int32 CFE_SB_DeletePipeFull(CFE_SB_PipeId_t PipeId,CFE_ES_ResourceID_t AppId) int32 Stat; CFE_ES_ResourceID_t Owner; CFE_ES_ResourceID_t TskId; - CFE_SB_Msg_t *PipeMsgPtr; + CFE_MSG_Message_t *PipeMsgPtr; char FullName[(OS_MAX_API_NAME * 2)]; CFE_SB_RemovePipeCallback_t Args; @@ -876,7 +876,7 @@ int32 CFE_SB_SubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB.SubRprtMsg.Payload.Qos.Reliability = Quality.Reliability; CFE_SB.SubRprtMsg.Payload.SubType = CFE_SB_SUBSCRIPTION; CFE_SB_UnlockSharedData(__func__,__LINE__); - Stat = CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.SubRprtMsg); + Stat = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.SubRprtMsg); CFE_EVS_SendEventWithAppID(CFE_SB_SUBSCRIPTION_RPT_EID,CFE_EVS_EventType_DEBUG,CFE_SB.AppId, "Sending Subscription Report Msg=0x%x,Pipe=%d,Stat=0x%x", (unsigned int)CFE_SB_MsgIdToValue(MsgId), @@ -1102,7 +1102,7 @@ int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId,CFE_SB_PipeId_t PipeId, /* * Function: CFE_SB_SendMsg - See API and header file for details */ -int32 CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr) +int32 CFE_SB_SendMsg(CFE_MSG_Message_t *MsgPtr) { int32 Status = 0; @@ -1117,7 +1117,7 @@ int32 CFE_SB_SendMsg(CFE_SB_Msg_t *MsgPtr) /* * Function: CFE_SB_PassMsg - See API and header file for details */ -int32 CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr) +int32 CFE_SB_PassMsg(CFE_MSG_Message_t *MsgPtr) { int32 Status = 0; @@ -1154,17 +1154,17 @@ int32 CFE_SB_PassMsg(CFE_SB_Msg_t *MsgPtr) ** Status ** ******************************************************************************/ -int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, - uint32 TlmCntIncrements, - uint32 CopyMode) +int32 CFE_SB_SendMsgFull(CFE_MSG_Message_t *MsgPtr, + uint32 TlmCntIncrements, + uint32 CopyMode) { - CFE_SB_MsgId_t MsgId; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; int32 Status; CFE_SB_DestinationD_t *DestPtr = NULL; CFE_SB_PipeD_t *PipeDscPtr; CFE_SBR_RouteId_t RouteId; CFE_SB_BufferD_t *BufDscPtr; - uint16 TotalMsgSize; + CFE_MSG_Size_t TotalMsgSize = 0; CFE_ES_ResourceID_t AppId; CFE_ES_ResourceID_t TskId; uint32 i; @@ -1172,6 +1172,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, CFE_SB_EventBuf_t SBSndErr; char PipeName[OS_MAX_API_NAME] = {'\0'}; CFE_SB_PipeDepthStats_t *StatObj; + CFE_MSG_Type_t MsgType = CFE_MSG_Type_Invalid; SBSndErr.EvtsToSnd = 0; @@ -1192,7 +1193,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, return CFE_SB_BAD_ARGUMENT; }/* end if */ - MsgId = CFE_SB_GetMsgId(MsgPtr); + CFE_MSG_GetMsgId(MsgPtr, &MsgId); /* validate the msgid in the message */ if(!CFE_SB_IsValidMsgId(MsgId)) @@ -1212,7 +1213,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, return CFE_SB_BAD_ARGUMENT; }/* end if */ - TotalMsgSize = CFE_SB_GetTotalMsgLength(MsgPtr); + CFE_MSG_GetSize(MsgPtr, &TotalMsgSize); /* Verify the size of the pkt is < or = the mission defined max */ if(TotalMsgSize > CFE_MISSION_SB_MAX_SB_MSG_SIZE){ @@ -1294,14 +1295,15 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, /* Copy the packet into the SB memory space */ if (CopyMode != CFE_SB_SEND_ZEROCOPY){ /* Copy the packet into the SB memory space */ - memcpy( BufDscPtr->Buffer, MsgPtr, (uint16)TotalMsgSize ); + memcpy(BufDscPtr->Buffer, MsgPtr, TotalMsgSize); } /* For Tlm packets, increment the seq count if requested */ - if((CFE_SB_GetPktType(MsgId)==CFE_SB_PKTTYPE_TLM) && + CFE_MSG_GetType(MsgPtr, &MsgType); + if((MsgType == CFE_MSG_Type_Tlm) && (TlmCntIncrements==CFE_SB_INCREMENT_TLM)){ CFE_SBR_IncrementSequenceCounter(RouteId); - CFE_SB_SetMsgSeqCnt((CFE_SB_Msg_t *)BufDscPtr->Buffer, CFE_SBR_GetSequenceCounter(RouteId)); + CFE_MSG_SetSequenceCount((CFE_MSG_Message_t *)BufDscPtr->Buffer, CFE_SBR_GetSequenceCounter(RouteId)); }/* end if */ /* Send the packet to all destinations */ @@ -1458,9 +1460,9 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, /* * Function: CFE_SB_RcvMsg - See API and header file for details */ -int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, - CFE_SB_PipeId_t PipeId, - int32 TimeOut) +int32 CFE_SB_RcvMsg(CFE_MSG_Message_t **BufPtr, + CFE_SB_PipeId_t PipeId, + int32 TimeOut) { int32 Status; CFE_SB_BufferD_t *Message; @@ -1535,7 +1537,7 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, PipeDscPtr->CurrentBuff = Message; /* Set the Receivers pointer to the address of the actual message */ - *BufPtr = (CFE_SB_MsgPtr_t) Message->Buffer; + *BufPtr = (CFE_MSG_Message_t*) Message->Buffer; /* get pointer to destination to be used in decrementing msg limit cnt*/ RouteId = CFE_SBR_GetRouteId(PipeDscPtr->CurrentBuff->MsgId); @@ -1583,8 +1585,8 @@ int32 CFE_SB_RcvMsg(CFE_SB_MsgPtr_t *BufPtr, /* * Function: CFE_SB_ZeroCopyGetPtr - See API and header file for details */ -CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, - CFE_SB_ZeroCopyHandle_t *BufferHandle) +CFE_MSG_Message_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, + CFE_SB_ZeroCopyHandle_t *BufferHandle) { int32 stat1; CFE_ES_ResourceID_t AppId; @@ -1665,7 +1667,7 @@ CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, bd->Size = MsgSize; bd->Buffer = (void *)address; - return (CFE_SB_Msg_t *)address; + return (CFE_MSG_Message_t *)address; }/* CFE_SB_ZeroCopyGetPtr */ @@ -1673,7 +1675,7 @@ CFE_SB_Msg_t *CFE_SB_ZeroCopyGetPtr(uint16 MsgSize, /* * Function: CFE_SB_ZeroCopyReleasePtr - See API and header file for details */ -int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, +int32 CFE_SB_ZeroCopyReleasePtr(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Status; @@ -1725,8 +1727,8 @@ int32 CFE_SB_ZeroCopyReleasePtr(CFE_SB_Msg_t *Ptr2Release, ** Status ** ******************************************************************************/ -int32 CFE_SB_ZeroCopyReleaseDesc(CFE_SB_Msg_t *Ptr2Release, - CFE_SB_ZeroCopyHandle_t BufferHandle) +int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, + CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Stat; CFE_SB_ZeroCopyD_t *zcd = (CFE_SB_ZeroCopyD_t *) BufferHandle; @@ -1768,7 +1770,7 @@ int32 CFE_SB_ZeroCopyReleaseDesc(CFE_SB_Msg_t *Ptr2Release, /* * Function: CFE_SB_ZeroCopySend - See API and header file for details */ -int32 CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, +int32 CFE_SB_ZeroCopySend(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Status = 0; @@ -1787,7 +1789,7 @@ int32 CFE_SB_ZeroCopySend(CFE_SB_Msg_t *MsgPtr, /* * Function: CFE_SB_ZeroCopyPass - See API and header file for details */ -int32 CFE_SB_ZeroCopyPass(CFE_SB_Msg_t *MsgPtr, +int32 CFE_SB_ZeroCopyPass(CFE_MSG_Message_t *MsgPtr, CFE_SB_ZeroCopyHandle_t BufferHandle) { int32 Status = 0; diff --git a/fsw/cfe-core/src/sb/cfe_sb_init.c b/fsw/cfe-core/src/sb/cfe_sb_init.c index 2a6d25e5f..e8e711c84 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_init.c +++ b/fsw/cfe-core/src/sb/cfe_sb_init.c @@ -116,10 +116,9 @@ int32 CFE_SB_EarlyInit (void) { CFE_SBR_Init(); /* Initialize the SB Statistics Pkt */ - CFE_SB_InitMsg(&CFE_SB.StatTlmMsg, - CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), - sizeof(CFE_SB.StatTlmMsg), - true); + CFE_MSG_Init(&CFE_SB.StatTlmMsg.Hdr.BaseMsg, + CFE_SB_ValueToMsgId(CFE_SB_STATS_TLM_MID), + sizeof(CFE_SB.StatTlmMsg)); CFE_SB.ZeroCopyTail = NULL; diff --git a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c index 6aae29dcc..299dc931e 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c @@ -34,10 +34,11 @@ #include "cfe_sb_priv.h" #include "cfe_msg_api.h" +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_GetMsgId - See API and header file for details */ -CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) +CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_MSG_Message_t *MsgPtr) { CFE_SB_MsgId_t MsgId; @@ -52,7 +53,7 @@ CFE_SB_MsgId_t CFE_SB_GetMsgId(const CFE_SB_Msg_t *MsgPtr) /* * Function: CFE_SB_SetMsgId - See API and header file for details */ -void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr, +void CFE_SB_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { @@ -75,6 +76,7 @@ uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId) return type; }/* end CFE_SB_GetPktType */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /* * Function: CFE_SB_IsValidMsgId - See API and header file for details diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.c b/fsw/cfe-core/src/sb/cfe_sb_priv.c index 95798a70b..f6eeb5623 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.c +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.c @@ -302,6 +302,7 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI return destptr; } +#ifndef CFE_OMIT_DEPRECATED_6_8 /****************************************************************************** ** Function: CFE_SB_SetMsgSeqCnt() ** @@ -316,12 +317,12 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI ** Return: ** None */ -void CFE_SB_SetMsgSeqCnt(CFE_SB_MsgPtr_t MsgPtr,uint32 Count){ +void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr,uint32 Count){ CFE_MSG_SetSequenceCount(MsgPtr, Count); }/* end CFE_SB_SetMsgSeqCnt */ - +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /****************************************************************************** ** Function: CFE_SB_ValidateMsgId() @@ -607,7 +608,7 @@ int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_ResourceID_t AppId) prev = (CFE_SB_ZeroCopyD_t *) (zcd->Prev); if( CFE_ES_ResourceID_Equal(zcd->AppID, AppId) ) { - CFE_SB_ZeroCopyReleasePtr((CFE_SB_Msg_t *) zcd->Buffer, (CFE_SB_ZeroCopyHandle_t) zcd); + CFE_SB_ZeroCopyReleasePtr((CFE_MSG_Message_t *) zcd->Buffer, (CFE_SB_ZeroCopyHandle_t) zcd); } zcd = prev; } diff --git a/fsw/cfe-core/src/sb/cfe_sb_priv.h b/fsw/cfe-core/src/sb/cfe_sb_priv.h index efc015f79..a74eaf8cc 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_priv.h +++ b/fsw/cfe-core/src/sb/cfe_sb_priv.h @@ -194,7 +194,7 @@ typedef struct CFE_SB_HousekeepingTlm_t HKTlmMsg; CFE_SB_StatsTlm_t StatTlmMsg; CFE_SB_PipeId_t CmdPipe; - CFE_SB_Msg_t *CmdPipePktPtr; + CFE_MSG_Message_t *CmdPipePktPtr; CFE_SB_MemParams_t Mem; CFE_SB_AllSubscriptionsTlm_t PrevSubMsg; CFE_SB_SingleSubscriptionTlm_t SubRprtMsg; @@ -247,7 +247,7 @@ uint8 CFE_SB_GetPipeIdx(CFE_SB_PipeId_t PipeId); int32 CFE_SB_ReturnBufferToPool(CFE_SB_BufferD_t *bd); void CFE_SB_ProcessCmdPipePkt(void); void CFE_SB_ResetCounters(void); -void CFE_SB_SetMsgSeqCnt(CFE_SB_MsgPtr_t MsgPtr,uint32 Count); +void CFE_SB_SetMsgSeqCnt(CFE_MSG_Message_t *MsgPtr,uint32 Count); char *CFE_SB_GetAppTskName(CFE_ES_ResourceID_t TaskId, char* FullName); CFE_SB_BufferD_t *CFE_SB_GetBufferFromPool(CFE_SB_MsgId_t MsgId, uint16 Size); CFE_SB_BufferD_t *CFE_SB_GetBufferFromCaller(CFE_SB_MsgId_t MsgId, void *Address); @@ -266,11 +266,11 @@ int32 CFE_SB_UnsubscribeWithAppId(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, int32 CFE_SB_UnsubscribeFull(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, uint8 Scope, CFE_ES_ResourceID_t AppId); -int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr, uint32 TlmCntIncrements, uint32 CopyMode); +int32 CFE_SB_SendMsgFull(CFE_MSG_Message_t *MsgPtr, uint32 TlmCntIncrements, uint32 CopyMode); int32 CFE_SB_SendRtgInfo(const char *Filename); int32 CFE_SB_SendPipeInfo(const char *Filename); int32 CFE_SB_SendMapInfo(const char *Filename); -int32 CFE_SB_ZeroCopyReleaseDesc(CFE_SB_Msg_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); +int32 CFE_SB_ZeroCopyReleaseDesc(CFE_MSG_Message_t *Ptr2Release, CFE_SB_ZeroCopyHandle_t BufferHandle); int32 CFE_SB_ZeroCopyReleaseAppId(CFE_ES_ResourceID_t AppId); int32 CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd); int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId); @@ -356,11 +356,8 @@ CFE_SB_DestinationD_t *CFE_SB_GetDestPtr(CFE_SBR_RouteId_t RouteId, CFE_SB_PipeI ** ** \returns The number of bytes in the software bus message header for ** messages with the given \c MsgId. -** -** \sa #CFE_SB_GetUserData, #CFE_SB_GetMsgId, #CFE_SB_GetUserDataLength, #CFE_SB_GetTotalMsgLength, -** #CFE_SB_GetMsgTime, #CFE_SB_GetCmdCode, #CFE_SB_GetChecksum **/ -uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr); +uint16 CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr); /* diff --git a/fsw/cfe-core/src/sb/cfe_sb_task.c b/fsw/cfe-core/src/sb/cfe_sb_task.c index 97c587186..6991b7fab 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_task.c +++ b/fsw/cfe-core/src/sb/cfe_sb_task.c @@ -224,20 +224,17 @@ int32 CFE_SB_AppInit(void){ CFE_ES_WriteToSysLog("SB:Registered %d events for filtering\n",(int)CfgFileEventsToFilter); - CFE_SB_InitMsg(&CFE_SB.HKTlmMsg, - CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), - sizeof(CFE_SB.HKTlmMsg), - true); + CFE_MSG_Init(&CFE_SB.HKTlmMsg.Hdr.BaseMsg, + CFE_SB_ValueToMsgId(CFE_SB_HK_TLM_MID), + sizeof(CFE_SB.HKTlmMsg)); - CFE_SB_InitMsg(&CFE_SB.PrevSubMsg, - CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), - sizeof(CFE_SB.PrevSubMsg), - true); + CFE_MSG_Init(&CFE_SB.PrevSubMsg.Hdr.BaseMsg, + CFE_SB_ValueToMsgId(CFE_SB_ALLSUBS_TLM_MID), + sizeof(CFE_SB.PrevSubMsg)); - CFE_SB_InitMsg(&CFE_SB.SubRprtMsg, - CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), - sizeof(CFE_SB.SubRprtMsg), - true); + CFE_MSG_Init(&CFE_SB.SubRprtMsg.Hdr.BaseMsg, + CFE_SB_ValueToMsgId(CFE_SB_ONESUB_TLM_MID), + sizeof(CFE_SB.SubRprtMsg)); /* Populate the fixed fields in the HK Tlm Msg */ CFE_SB.HKTlmMsg.Payload.MemPoolHandle = CFE_SB.Mem.PoolHdl; @@ -323,23 +320,27 @@ int32 CFE_SB_AppInit(void){ ** Return: ** true if length is acceptable */ -bool CFE_SB_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_SB_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength) { - bool result = true; - uint16 ActualLength = CFE_SB_GetTotalMsgLength(Msg); + bool result = true; + CFE_MSG_Size_t ActualLength = 0; + CFE_MSG_FcnCode_t FcnCode = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + + CFE_MSG_GetSize(MsgPtr, &ActualLength); /* ** Verify the command packet length */ if (ExpectedLength != ActualLength) { - CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(Msg); - uint16 CommandCode = CFE_SB_GetCmdCode(Msg); + CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); CFE_EVS_SendEvent(CFE_SB_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode, - (int)ExpectedLength, (int)ActualLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, + (unsigned int)ActualLength, (unsigned int)ExpectedLength); result = false; ++CFE_SB.HKTlmMsg.Payload.CommandErrorCounter; } @@ -363,9 +364,10 @@ bool CFE_SB_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) ** none */ void CFE_SB_ProcessCmdPipePkt(void) { - CFE_SB_MsgId_t MessageID; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t FcnCode = 0; - MessageID = CFE_SB_GetMsgId(CFE_SB.CmdPipePktPtr); + CFE_MSG_GetMsgId(CFE_SB.CmdPipePktPtr, &MessageID); switch(CFE_SB_MsgIdToValue(MessageID)){ @@ -376,7 +378,8 @@ void CFE_SB_ProcessCmdPipePkt(void) { case CFE_SB_SUB_RPT_CTRL_MID: /* Note: Command counter not incremented for this command */ - switch (CFE_SB_GetCmdCode(CFE_SB.CmdPipePktPtr)) { + CFE_MSG_GetFcnCode(CFE_SB.CmdPipePktPtr, &FcnCode); + switch (FcnCode) { case CFE_SB_SEND_PREV_SUBS_CC: if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_SendPrevSubs_t))) { @@ -400,15 +403,15 @@ void CFE_SB_ProcessCmdPipePkt(void) { default: CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Command Code %d", - (int)CFE_SB_GetCmdCode(CFE_SB.CmdPipePktPtr)); + "Invalid Cmd, Unexpected Command Code %u", (unsigned int)FcnCode); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; break; } /* end switch on cmd code */ break; case CFE_SB_CMD_MID: - switch (CFE_SB_GetCmdCode(CFE_SB.CmdPipePktPtr)) { + CFE_MSG_GetFcnCode(CFE_SB.CmdPipePktPtr, &FcnCode); + switch (FcnCode) { case CFE_SB_NOOP_CC: if (CFE_SB_VerifyCmdLength(CFE_SB.CmdPipePktPtr, sizeof(CFE_SB_Noop_t))) { @@ -468,8 +471,7 @@ void CFE_SB_ProcessCmdPipePkt(void) { default: CFE_EVS_SendEvent(CFE_SB_BAD_CMD_CODE_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Command Code %d", - (int)CFE_SB_GetCmdCode(CFE_SB.CmdPipePktPtr)); + "Invalid Cmd, Unexpected Command Code %u", FcnCode); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; break; } /* end switch on cmd code */ @@ -477,7 +479,7 @@ void CFE_SB_ProcessCmdPipePkt(void) { default: CFE_EVS_SendEvent(CFE_SB_BAD_MSGID_EID,CFE_EVS_EventType_ERROR, - "Invalid Cmd, Unexpected Msg Id: 0x%04x", + "Invalid Cmd, Unexpected Msg Id: 0x%x", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); CFE_SB.HKTlmMsg.Payload.CommandErrorCounter++; break; @@ -568,8 +570,8 @@ int32 CFE_SB_SendHKTlmCmd(const CFE_SB_CmdHdr_t *data) CFE_SB.HKTlmMsg.Payload.MemInUse = CFE_SB.StatTlmMsg.Payload.MemInUse; CFE_SB.HKTlmMsg.Payload.UnmarkedMem = CFE_PLATFORM_SB_BUF_MEMORY_BYTES - CFE_SB.StatTlmMsg.Payload.PeakMemInUse; - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_SB.HKTlmMsg); - CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.HKTlmMsg); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_SB.HKTlmMsg); + CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.HKTlmMsg); return CFE_SUCCESS; }/* end CFE_SB_SendHKTlmCmd */ @@ -750,8 +752,8 @@ int32 CFE_SB_DisableRouteCmd(const CFE_SB_DisableRoute_t *data) int32 CFE_SB_SendStatsCmd(const CFE_SB_SendSbStats_t *data) { - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_SB.StatTlmMsg); - CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.StatTlmMsg); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_SB.StatTlmMsg); + CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.StatTlmMsg); CFE_EVS_SendEvent(CFE_SB_SND_STATS_EID,CFE_EVS_EventType_DEBUG, "Software Bus Statistics packet sent"); @@ -1158,7 +1160,7 @@ void CFE_SB_SendRouteSub(CFE_SBR_RouteId_t RouteId, void *ArgPtr) if(CFE_SB.PrevSubMsg.Payload.Entries >= CFE_SB_SUB_ENTRIES_PER_PKT) { CFE_SB_UnlockSharedData(__func__,__LINE__); - status = CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.PrevSubMsg); + status = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.PrevSubMsg); CFE_EVS_SendEvent(CFE_SB_FULL_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Full Sub Pkt %d Sent,Entries=%d,Stat=0x%x\n", (int)CFE_SB.PrevSubMsg.Payload.PktSegment, @@ -1216,7 +1218,7 @@ int32 CFE_SB_SendPrevSubsCmd(const CFE_SB_SendPrevSubs_t *data) /* if pkt has any number of entries, send it as a partial pkt */ if(CFE_SB.PrevSubMsg.Payload.Entries > 0) { - status = CFE_SB_SendMsg((CFE_SB_Msg_t *)&CFE_SB.PrevSubMsg); + status = CFE_SB_SendMsg((CFE_MSG_Message_t *)&CFE_SB.PrevSubMsg); CFE_EVS_SendEvent(CFE_SB_PART_SUB_PKT_EID, CFE_EVS_EventType_DEBUG, "Partial Sub Pkt %d Sent,Entries=%d,Stat=0x%x", (int)CFE_SB.PrevSubMsg.Payload.PktSegment, (int)CFE_SB.PrevSubMsg.Payload.Entries, diff --git a/fsw/cfe-core/src/sb/cfe_sb_util.c b/fsw/cfe-core/src/sb/cfe_sb_util.c index 6086f22b1..cee644719 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_util.c @@ -42,6 +42,7 @@ #include +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_InitMsg - See API and header file for details */ @@ -54,6 +55,7 @@ void CFE_SB_InitMsg(void *MsgPtr, CFE_MSG_Init((CFE_MSG_Message_t *)MsgPtr, MsgId, Length); } /* end CFE_SB_InitMsg */ +#endif /****************************************************************************** ** Function: CFE_SB_MsgHdrSize() @@ -67,7 +69,7 @@ void CFE_SB_InitMsg(void *MsgPtr, ** Return: ** Size of Message Header. */ -uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) +uint16 CFE_SB_MsgHdrSize(const CFE_MSG_Message_t *MsgPtr) { uint16 size = 0; @@ -100,7 +102,7 @@ uint16 CFE_SB_MsgHdrSize(const CFE_SB_Msg_t *MsgPtr) /* * Function: CFE_SB_GetUserData - See API and header file for details */ -void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) +void *CFE_SB_GetUserData(CFE_MSG_Message_t *MsgPtr) { uint8 *BytePtr; uint16 HdrSize; @@ -115,7 +117,7 @@ void *CFE_SB_GetUserData(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_GetUserDataLength - See API and header file for details */ -uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) +uint16 CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr) { uint32 TotalMsgSize; uint16 HdrSize; @@ -130,7 +132,7 @@ uint16 CFE_SB_GetUserDataLength(const CFE_SB_Msg_t *MsgPtr) /* * Function: CFE_SB_SetUserDataLength - See API and header file for details */ -void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) +void CFE_SB_SetUserDataLength(CFE_MSG_Message_t *MsgPtr, uint16 DataLength) { uint32 TotalMsgSize, HdrSize; @@ -141,10 +143,11 @@ void CFE_SB_SetUserDataLength(CFE_SB_MsgPtr_t MsgPtr, uint16 DataLength) }/* end CFE_SB_SetUserDataLength */ +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_GetTotalMsgLength - See API and header file for details */ -uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) +uint16 CFE_SB_GetTotalMsgLength(const CFE_MSG_Message_t *MsgPtr) { CFE_MSG_Size_t size; @@ -156,22 +159,20 @@ uint16 CFE_SB_GetTotalMsgLength(const CFE_SB_Msg_t *MsgPtr) }/* end CFE_SB_GetTotalMsgLength */ - /* * Function: CFE_SB_SetTotalMsgLength - See API and header file for details */ -void CFE_SB_SetTotalMsgLength(CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength) +void CFE_SB_SetTotalMsgLength(CFE_MSG_Message_t *MsgPtr,uint16 TotalLength) { CFE_MSG_SetSize(MsgPtr, TotalLength); }/* end CFE_SB_SetTotalMsgLength */ - /* * Function: CFE_SB_GetMsgTime - See API and header file for details */ -CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) +CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_MSG_Message_t *MsgPtr) { CFE_TIME_SysTime_t TimeFromMsg = {0}; @@ -181,32 +182,31 @@ CFE_TIME_SysTime_t CFE_SB_GetMsgTime(CFE_SB_MsgPtr_t MsgPtr) }/* end CFE_SB_GetMsgTime */ - /* * Function: CFE_SB_SetMsgTime - See API and header file for details */ -int32 CFE_SB_SetMsgTime(CFE_SB_MsgPtr_t MsgPtr, CFE_TIME_SysTime_t NewTime) +int32 CFE_SB_SetMsgTime(CFE_MSG_Message_t *MsgPtr, CFE_TIME_SysTime_t NewTime) { return CFE_MSG_SetMsgTime(MsgPtr, NewTime); }/* end CFE_SB_SetMsgTime */ - +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /* * Function: CFE_SB_TimeStampMsg - See API and header file for details */ -void CFE_SB_TimeStampMsg(CFE_SB_MsgPtr_t MsgPtr) +void CFE_SB_TimeStampMsg(CFE_MSG_Message_t *MsgPtr) { - CFE_SB_SetMsgTime(MsgPtr,CFE_TIME_GetTime()); + CFE_MSG_SetMsgTime(MsgPtr,CFE_TIME_GetTime()); }/* end CFE_SB_TimeStampMsg */ - +#ifndef CFE_OMIT_DEPRECATED_6_8 /* * Function: CFE_SB_GetCmdCode - See API and header file for details */ -uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) +uint16 CFE_SB_GetCmdCode(CFE_MSG_Message_t *MsgPtr) { CFE_MSG_FcnCode_t fc; @@ -221,7 +221,7 @@ uint16 CFE_SB_GetCmdCode(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_SetCmdCode - See API and header file for details */ -int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, +int32 CFE_SB_SetCmdCode(CFE_MSG_Message_t *MsgPtr, uint16 CmdCode) { @@ -232,7 +232,7 @@ int32 CFE_SB_SetCmdCode(CFE_SB_MsgPtr_t MsgPtr, /* * Function: CFE_SB_GetChecksum - See API and header file for details */ -uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) +uint16 CFE_SB_GetChecksum(CFE_MSG_Message_t *MsgPtr) { CFE_MSG_Type_t type = CFE_MSG_Type_Invalid; @@ -255,7 +255,7 @@ uint16 CFE_SB_GetChecksum(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_GenerateChecksum - See API and header file for details */ -void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) +void CFE_SB_GenerateChecksum(CFE_MSG_Message_t *MsgPtr) { CFE_MSG_GenerateChecksum(MsgPtr); @@ -266,7 +266,7 @@ void CFE_SB_GenerateChecksum(CFE_SB_MsgPtr_t MsgPtr) /* * Function: CFE_SB_ValidateChecksum - See API and header file for details */ -bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) +bool CFE_SB_ValidateChecksum(CFE_MSG_Message_t *MsgPtr) { bool isvalid = false; @@ -275,6 +275,7 @@ bool CFE_SB_ValidateChecksum(CFE_SB_MsgPtr_t MsgPtr) return isvalid; }/* end CFE_SB_ValidateChecksum */ +#endif /* CFE_OMIT_DEPRECATED_6_8 */ /* * Function: CFE_SB_MessageStringGet - See API and header file for details diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_api.c b/fsw/cfe-core/src/tbl/cfe_tbl_api.c index b28e72232..7eb9e2003 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_api.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_api.c @@ -1539,7 +1539,7 @@ int32 CFE_TBL_Modified( CFE_TBL_Handle_t TblHandle ) /* * Function: CFE_TBL_NotifyByMessage - See API and header file for details */ -int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, uint16 CommandCode, uint32 Parameter) +int32 CFE_TBL_NotifyByMessage(CFE_TBL_Handle_t TblHandle, CFE_SB_MsgId_t MsgId, CFE_MSG_FcnCode_t CommandCode, uint32 Parameter) { int32 Status; CFE_TBL_AccessDescriptor_t *AccessDescPtr = NULL; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c index d5334759d..1aca77d6c 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_internal.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_internal.c @@ -142,16 +142,16 @@ int32 CFE_TBL_EarlyInit (void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_SB_InitMsg(&CFE_TBL_TaskData.HkPacket, - CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), - sizeof(CFE_TBL_TaskData.HkPacket), true); + CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), + sizeof(CFE_TBL_TaskData.HkPacket)); /* ** Initialize table registry report packet (clear user data area)... */ - CFE_SB_InitMsg(&CFE_TBL_TaskData.TblRegPacket, - CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), - sizeof(CFE_TBL_TaskData.TblRegPacket), true); + CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), + sizeof(CFE_TBL_TaskData.TblRegPacket)); /* Initialize memory partition and allocate shared table buffers. */ Status = CFE_ES_PoolCreate(&CFE_TBL_TaskData.Buf.PoolHdl, @@ -1511,18 +1511,18 @@ int32 CFE_TBL_SendNotificationMsg(CFE_TBL_RegistryRec_t *RegRecPtr) /* ** Initialize notification message packet (clear user data area)... */ - CFE_SB_InitMsg(&CFE_TBL_TaskData.NotifyMsg, - RegRecPtr->NotificationMsgId, - sizeof(CFE_TBL_NotifyCmd_t), true); + CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TBL_TaskData.NotifyMsg, + RegRecPtr->NotificationMsgId, + sizeof(CFE_TBL_NotifyCmd_t)); /* Set the command code */ - CFE_SB_SetCmdCode((CFE_SB_MsgPtr_t) &CFE_TBL_TaskData.NotifyMsg, RegRecPtr->NotificationCC); + CFE_MSG_SetFcnCode((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg, RegRecPtr->NotificationCC); /* Set the command parameter */ CFE_TBL_TaskData.NotifyMsg.Payload.Parameter = RegRecPtr->NotificationParam; - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.NotifyMsg); - Status = CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.NotifyMsg); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg); + Status = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.NotifyMsg); if (Status != CFE_SUCCESS) { diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.c b/fsw/cfe-core/src/tbl/cfe_tbl_task.c index d1b4ffa59..828796f95 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.c @@ -245,29 +245,30 @@ void CFE_TBL_InitData(void) strncpy(CFE_TBL_TaskData.PipeName, CFE_TBL_TASK_PIPE_NAME, 16); /* Initialize Packet Headers */ - CFE_SB_InitMsg(&CFE_TBL_TaskData.HkPacket, - CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), - sizeof(CFE_TBL_TaskData.HkPacket), - true); + CFE_MSG_Init(&CFE_TBL_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TBL_HK_TLM_MID), + sizeof(CFE_TBL_TaskData.HkPacket)); - CFE_SB_InitMsg(&CFE_TBL_TaskData.TblRegPacket, - CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), - sizeof(CFE_TBL_TaskData.TblRegPacket), - true); + CFE_MSG_Init(&CFE_TBL_TaskData.TblRegPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TBL_REG_TLM_MID), + sizeof(CFE_TBL_TaskData.TblRegPacket)); } /* End of CFE_TBL_InitData() */ /******************************************************************************/ -void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) +void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr) { - CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(MessagePtr); - uint16 CommandCode = CFE_SB_GetCmdCode(MessagePtr); + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; int16 CmdIndx; - uint32 ActualLength; + CFE_MSG_Size_t ActualLength = 0; CFE_TBL_CmdProcRet_t CmdStatus = CFE_TBL_INC_ERR_CTR; /* Assume a failed command */ + CFE_MSG_GetMsgId(MessagePtr, &MessageID); + CFE_MSG_GetFcnCode(MessagePtr, &CommandCode); + /* Search the Command Handler Table for a matching message */ CmdIndx = CFE_TBL_SearchCmdHndlrTbl(MessageID, CommandCode); @@ -275,7 +276,7 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) if (CmdIndx >= 0) { /* Verify Message Length before processing */ - ActualLength = CFE_SB_GetTotalMsgLength(MessagePtr); + CFE_MSG_GetSize(MessagePtr, &ActualLength); if (ActualLength == CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength) { /* All checks have passed, call the appropriate message handler */ @@ -284,10 +285,10 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) else /* Bad Message Length */ { CFE_EVS_SendEvent( CFE_TBL_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid msg length -- ID = 0x%04X, CC = %d, Len = %d (!= %d)", + "Invalid msg length -- ID = 0x%X, CC = %u, Len = %u, Expected = %u", (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (int)CommandCode, (int)ActualLength, - (int)CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength ); + (unsigned int)CommandCode, (unsigned int)ActualLength, + (unsigned int)CFE_TBL_CmdHandlerTbl[CmdIndx].ExpectedLength ); } /* Only update command counters when message has a command code */ @@ -310,9 +311,9 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) if (CmdIndx == CFE_TBL_BAD_CMD_CODE) { CFE_EVS_SendEvent(CFE_TBL_CC1_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid command code -- ID = 0x%04X, CC = %d", + "Invalid command code -- ID = 0x%X, CC = %u", (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (int)CommandCode); + (unsigned int)CommandCode); /* Update the command error counter */ CFE_TBL_TaskData.CommandErrorCounter++; @@ -320,7 +321,7 @@ void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr) else /* CmdIndx == CFE_TBL_BAD_MSG_ID */ { CFE_EVS_SendEvent(CFE_TBL_MID_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid message ID -- ID = 0x%04X", + "Invalid message ID -- ID = 0x%X", (unsigned int)CFE_SB_MsgIdToValue(MessageID)); /* ** Note: we only increment the command error counter when diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task.h b/fsw/cfe-core/src/tbl/cfe_tbl_task.h index 96af49979..3a27b6a5b 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task.h @@ -197,7 +197,7 @@ typedef struct int32 ValidateInactiveIndex; /**< \brief Index to Validation Request on Inactive Table Result data */ int32 DumpControlIndex; /**< \brief Index to Dump Control Block */ CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ - uint16 NotificationCC; /**< \brief Command Code of an associated management notification message */ + CFE_MSG_FcnCode_t NotificationCC; /**< \brief Command Code of an associated management notification message */ bool CriticalTable; /**< \brief Flag indicating whether table is a Critical Table */ bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ @@ -308,7 +308,7 @@ typedef struct /* ** Task operational data (not reported in housekeeping)... */ - CFE_SB_Msg_t *MsgPtr; /**< \brief Pointer to most recently received command message */ + CFE_MSG_Message_t *MsgPtr; /**< \brief Pointer to most recently received command message */ CFE_SB_PipeId_t CmdPipe; /**< \brief Table Task command pipe ID as obtained from Software Bus */ /* @@ -404,7 +404,7 @@ int32 CFE_TBL_TaskInit(void); ** ** ******************************************************************************/ -void CFE_TBL_TaskPipe(CFE_SB_Msg_t *MessagePtr); +void CFE_TBL_TaskPipe(CFE_MSG_Message_t *MessagePtr); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c index 39048e696..68ab370c8 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.c @@ -69,8 +69,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.HkPacket); - Status = CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.HkPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.HkPacket); + Status = CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.HkPacket); if (Status != CFE_SUCCESS) { @@ -88,8 +88,8 @@ int32 CFE_TBL_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send Table Registry Info Packet */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.TblRegPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TBL_TaskData.TblRegPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.TblRegPacket); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TBL_TaskData.TblRegPacket); /* Once the data has been sent, clear the index so that we don't send it again and again */ CFE_TBL_TaskData.HkTlmTblRegIndex = CFE_TBL_NOT_FOUND; diff --git a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h index c2f4f1aeb..dbbcb7c8d 100644 --- a/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h +++ b/fsw/cfe-core/src/tbl/cfe_tbl_task_cmds.h @@ -72,8 +72,8 @@ typedef enum */ typedef struct { CFE_SB_MsgId_t MsgId; /**< \brief Acceptable Message ID */ - uint32 CmdCode; /**< \brief Acceptable Command Code (if necessary) */ - uint32 ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ + CFE_MSG_FcnCode_t CmdCode; /**< \brief Acceptable Command Code (if necessary) */ + CFE_MSG_Size_t ExpectedLength; /**< \brief Expected Message Length (in bytes) including message header */ CFE_TBL_MsgProcFuncPtr_t MsgProcFuncPtr; /**< \brief Pointer to function to handle message */ CFE_TBL_MsgType_t MsgTypes; /**< \brief Message Type (i.e. - with/without Cmd Code) */ } CFE_TBL_CmdHandlerTblRec_t; diff --git a/fsw/cfe-core/src/time/cfe_time_task.c b/fsw/cfe-core/src/time/cfe_time_task.c index 0f7ef3a50..7fbc7fa9d 100644 --- a/fsw/cfe-core/src/time/cfe_time_task.c +++ b/fsw/cfe-core/src/time/cfe_time_task.c @@ -427,23 +427,27 @@ int32 CFE_TIME_TaskInit(void) ** Return: ** true if length is acceptable */ -bool CFE_TIME_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) +bool CFE_TIME_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, CFE_MSG_Size_t ExpectedLength) { - bool result = true; - uint16 ActualLength = CFE_SB_GetTotalMsgLength(Msg); + bool result = true; + CFE_MSG_Size_t ActualLength = 0; + CFE_MSG_FcnCode_t FcnCode = 0; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + + CFE_MSG_GetSize(MsgPtr, &ActualLength); /* ** Verify the command packet length */ if (ExpectedLength != ActualLength) { - CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(Msg); - uint16 CommandCode = CFE_SB_GetCmdCode(Msg); + CFE_MSG_GetMsgId(MsgPtr, &MsgId); + CFE_MSG_GetFcnCode(MsgPtr, &FcnCode); CFE_EVS_SendEvent(CFE_TIME_LEN_ERR_EID, CFE_EVS_EventType_ERROR, - "Invalid cmd length: ID = 0x%X, CC = %d, Exp Len = %d, Len = %d", - (unsigned int)CFE_SB_MsgIdToValue(MessageID), - (int)CommandCode, (int)ExpectedLength, (int)ActualLength); + "Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u", + (unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, + (unsigned int)ActualLength, (unsigned int)ExpectedLength); result = false; ++CFE_TIME_TaskData.CommandErrorCounter; } @@ -459,40 +463,41 @@ bool CFE_TIME_VerifyCmdLength(CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) +void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr) { - CFE_SB_MsgId_t MessageID; - uint16 CommandCode; + CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID; + CFE_MSG_FcnCode_t CommandCode = 0; + + CFE_MSG_GetMsgId(MsgPtr, &MessageID); - MessageID = CFE_SB_GetMsgId(MessagePtr); switch (CFE_SB_MsgIdToValue(MessageID)) { /* ** Housekeeping telemetry request... */ case CFE_TIME_SEND_HK_MID: - CFE_TIME_HousekeepingCmd((CFE_SB_CmdHdr_t *)MessagePtr); + CFE_TIME_HousekeepingCmd((CFE_SB_CmdHdr_t *)MsgPtr); break; /* ** Time at the tone "signal"... */ case CFE_TIME_TONE_CMD_MID: - CFE_TIME_ToneSignalCmd((CFE_SB_CmdHdr_t *)MessagePtr); + CFE_TIME_ToneSignalCmd((CFE_SB_CmdHdr_t *)MsgPtr); break; /* ** Time at the tone "data"... */ case CFE_TIME_DATA_CMD_MID: - CFE_TIME_ToneDataCmd((CFE_TIME_ToneDataCmd_t *)MessagePtr); + CFE_TIME_ToneDataCmd((CFE_TIME_ToneDataCmd_t *)MsgPtr); break; /* ** Run time state machine at 1Hz... */ case CFE_TIME_1HZ_CMD_MID: - CFE_TIME_OneHzCmd((CFE_SB_CmdHdr_t *)MessagePtr); + CFE_TIME_OneHzCmd((CFE_SB_CmdHdr_t *)MsgPtr); break; /* @@ -500,7 +505,7 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) case CFE_TIME_SEND_CMD_MID: - CFE_TIME_ToneSendCmd((CFE_SB_CmdHdr_t *)MessagePtr); + CFE_TIME_ToneSendCmd((CFE_SB_CmdHdr_t *)MsgPtr); break; #endif @@ -509,48 +514,48 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) */ case CFE_TIME_CMD_MID: - CommandCode = CFE_SB_GetCmdCode(MessagePtr); + CFE_MSG_GetFcnCode(MsgPtr, &CommandCode); switch (CommandCode) { case CFE_TIME_NOOP_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_Noop_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Noop_t))) { - CFE_TIME_NoopCmd((CFE_TIME_Noop_t *)MessagePtr); + CFE_TIME_NoopCmd((CFE_TIME_Noop_t *)MsgPtr); } break; case CFE_TIME_RESET_COUNTERS_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_ResetCounters_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_ResetCounters_t))) { - CFE_TIME_ResetCountersCmd((CFE_TIME_ResetCounters_t *)MessagePtr); + CFE_TIME_ResetCountersCmd((CFE_TIME_ResetCounters_t *)MsgPtr); } break; case CFE_TIME_SEND_DIAGNOSTIC_TLM_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SendDiagnosticTlm_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SendDiagnosticTlm_t))) { - CFE_TIME_SendDiagnosticTlm((CFE_TIME_SendDiagnosticTlm_t *)MessagePtr); + CFE_TIME_SendDiagnosticTlm((CFE_TIME_SendDiagnosticTlm_t *)MsgPtr); } break; case CFE_TIME_SET_STATE_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetState_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetState_t))) { - CFE_TIME_SetStateCmd((CFE_TIME_SetState_t *)MessagePtr); + CFE_TIME_SetStateCmd((CFE_TIME_SetState_t *)MsgPtr); } break; case CFE_TIME_SET_SOURCE_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetSource_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSource_t))) { - CFE_TIME_SetSourceCmd((CFE_TIME_SetSource_t *)MessagePtr); + CFE_TIME_SetSourceCmd((CFE_TIME_SetSource_t *)MsgPtr); } break; case CFE_TIME_SET_SIGNAL_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetSignal_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSignal_t))) { - CFE_TIME_SetSignalCmd((CFE_TIME_SetSignal_t *)MessagePtr); + CFE_TIME_SetSignalCmd((CFE_TIME_SetSignal_t *)MsgPtr); } break; @@ -558,16 +563,16 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) ** Time Clients process "tone delay" commands... */ case CFE_TIME_ADD_DELAY_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_AddDelay_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_AddDelay_t))) { - CFE_TIME_AddDelayCmd((CFE_TIME_AddDelay_t *)MessagePtr); + CFE_TIME_AddDelayCmd((CFE_TIME_AddDelay_t *)MsgPtr); } break; case CFE_TIME_SUB_DELAY_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SubDelay_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SubDelay_t))) { - CFE_TIME_SubDelayCmd((CFE_TIME_SubDelay_t *)MessagePtr); + CFE_TIME_SubDelayCmd((CFE_TIME_SubDelay_t *)MsgPtr); } break; @@ -575,58 +580,58 @@ void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr) ** Time Servers process "set time" commands... */ case CFE_TIME_SET_TIME_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetTime_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetTime_t))) { - CFE_TIME_SetTimeCmd((CFE_TIME_SetTime_t *)MessagePtr); + CFE_TIME_SetTimeCmd((CFE_TIME_SetTime_t *)MsgPtr); } break; case CFE_TIME_SET_MET_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetMET_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetMET_t))) { - CFE_TIME_SetMETCmd((CFE_TIME_SetMET_t *)MessagePtr); + CFE_TIME_SetMETCmd((CFE_TIME_SetMET_t *)MsgPtr); } break; case CFE_TIME_SET_STCF_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetSTCF_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetSTCF_t))) { - CFE_TIME_SetSTCFCmd((CFE_TIME_SetSTCF_t *)MessagePtr); + CFE_TIME_SetSTCFCmd((CFE_TIME_SetSTCF_t *)MsgPtr); } break; case CFE_TIME_SET_LEAP_SECONDS_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SetLeapSeconds_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SetLeapSeconds_t))) { - CFE_TIME_SetLeapSecondsCmd((CFE_TIME_SetLeapSeconds_t *)MessagePtr); + CFE_TIME_SetLeapSecondsCmd((CFE_TIME_SetLeapSeconds_t *)MsgPtr); } break; case CFE_TIME_ADD_ADJUST_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_AddAdjust_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_AddAdjust_t))) { - CFE_TIME_AddAdjustCmd((CFE_TIME_AddAdjust_t *)MessagePtr); + CFE_TIME_AddAdjustCmd((CFE_TIME_AddAdjust_t *)MsgPtr); } break; case CFE_TIME_SUB_ADJUST_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_SubAdjust_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_SubAdjust_t))) { - CFE_TIME_SubAdjustCmd((CFE_TIME_SubAdjust_t *)MessagePtr); + CFE_TIME_SubAdjustCmd((CFE_TIME_SubAdjust_t *)MsgPtr); } break; case CFE_TIME_ADD_1HZ_ADJUSTMENT_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_Add1HZAdjustment_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Add1HZAdjustment_t))) { - CFE_TIME_Add1HZAdjustmentCmd((CFE_TIME_Add1HZAdjustment_t *)MessagePtr); + CFE_TIME_Add1HZAdjustmentCmd((CFE_TIME_Add1HZAdjustment_t *)MsgPtr); } break; case CFE_TIME_SUB_1HZ_ADJUSTMENT_CC: - if (CFE_TIME_VerifyCmdLength(MessagePtr, sizeof(CFE_TIME_Sub1HZAdjustment_t))) + if (CFE_TIME_VerifyCmdLength(MsgPtr, sizeof(CFE_TIME_Sub1HZAdjustment_t))) { - CFE_TIME_Sub1HZAdjustmentCmd((CFE_TIME_Sub1HZAdjustment_t *)MessagePtr); + CFE_TIME_Sub1HZAdjustmentCmd((CFE_TIME_Sub1HZAdjustment_t *)MsgPtr); } break; @@ -687,8 +692,8 @@ int32 CFE_TIME_HousekeepingCmd(const CFE_SB_CmdHdr_t *data) /* ** Send housekeeping telemetry packet... */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.HkPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.HkPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.HkPacket); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.HkPacket); /* ** Note: we only increment the command execution counter when @@ -883,8 +888,8 @@ int32 CFE_TIME_SendDiagnosticTlm(const CFE_TIME_SendDiagnosticTlm_t *data) /* ** Send housekeeping telemetry packet... */ - CFE_SB_TimeStampMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.DiagPacket); - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.DiagPacket); + CFE_SB_TimeStampMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.DiagPacket); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.DiagPacket); CFE_EVS_SendEvent(CFE_TIME_DIAG_EID, CFE_EVS_EventType_DEBUG, "Request diagnostics command"); diff --git a/fsw/cfe-core/src/time/cfe_time_tone.c b/fsw/cfe-core/src/time/cfe_time_tone.c index ae1ca4295..b5cfd312e 100644 --- a/fsw/cfe-core/src/time/cfe_time_tone.c +++ b/fsw/cfe-core/src/time/cfe_time_tone.c @@ -165,7 +165,7 @@ void CFE_TIME_ToneSend(void) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); /* ** Count of "time at the tone" commands sent with internal data... @@ -305,7 +305,7 @@ int32 CFE_TIME_ToneSendMET(CFE_TIME_SysTime_t NewMET) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); /* ** Count of "time at the tone" commands sent with external data... @@ -459,7 +459,7 @@ int32 CFE_TIME_ToneSendGPS(CFE_TIME_SysTime_t NewTime, int16 NewLeaps) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); /* ** Count of "time at the tone" commands sent with external data... @@ -612,7 +612,7 @@ int32 CFE_TIME_ToneSendTime(CFE_TIME_SysTime_t NewTime) /* ** Send "time at the tone" command data packet... */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneDataCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneDataCmd); /* ** Count of "time at the tone" commands sent with external data... @@ -1217,7 +1217,7 @@ void CFE_TIME_Tone1HzTask(void) /* ** Send tone signal command packet... */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneSignalCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneSignalCmd); #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) /* @@ -1225,7 +1225,7 @@ void CFE_TIME_Tone1HzTask(void) ** to send the tone to other time clients. ** (this is done by scheduler in non-fake mode) */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.ToneSendCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.ToneSendCmd); #endif /* @@ -1434,7 +1434,7 @@ void CFE_TIME_Local1HzTask(void) ** This used to be optional in previous CFE versions, but it is now required ** as TIME subscribes to this itself to do state machine tasks. */ - CFE_SB_SendMsg((CFE_SB_Msg_t *) &CFE_TIME_TaskData.Local1HzCmd); + CFE_SB_SendMsg((CFE_MSG_Message_t *) &CFE_TIME_TaskData.Local1HzCmd); CFE_TIME_TaskData.LocalTaskCounter++; } diff --git a/fsw/cfe-core/src/time/cfe_time_utils.c b/fsw/cfe-core/src/time/cfe_time_utils.c index fec19f7a9..0130d15f0 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.c +++ b/fsw/cfe-core/src/time/cfe_time_utils.c @@ -388,48 +388,48 @@ void CFE_TIME_InitData(void) /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_SB_InitMsg(&CFE_TIME_TaskData.HkPacket, - CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), - sizeof(CFE_TIME_TaskData.HkPacket), true); + CFE_MSG_Init(&CFE_TIME_TaskData.HkPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TIME_HK_TLM_MID), + sizeof(CFE_TIME_TaskData.HkPacket)); /* ** Initialize diagnostic packet (clear user data area)... */ - CFE_SB_InitMsg(&CFE_TIME_TaskData.DiagPacket, - CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), - sizeof(CFE_TIME_TaskData.DiagPacket), true); + CFE_MSG_Init(&CFE_TIME_TaskData.DiagPacket.TlmHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TIME_DIAG_TLM_MID), + sizeof(CFE_TIME_TaskData.DiagPacket)); /* ** Initialize "time at the tone" signal command packet... */ - CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneSignalCmd, - CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), - sizeof(CFE_TIME_TaskData.ToneSignalCmd), true); + CFE_MSG_Init(&CFE_TIME_TaskData.ToneSignalCmd.CmdHeader.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TIME_TONE_CMD_MID), + sizeof(CFE_TIME_TaskData.ToneSignalCmd)); /* ** Initialize "time at the tone" data command packet... */ #if (CFE_PLATFORM_TIME_CFG_SERVER == true) - CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneDataCmd, - CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), - sizeof(CFE_TIME_TaskData.ToneDataCmd), true); + CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TIME_TaskData.ToneDataCmd, + CFE_SB_ValueToMsgId(CFE_TIME_DATA_CMD_MID), + sizeof(CFE_TIME_TaskData.ToneDataCmd)); #endif /* ** Initialize simulated tone send message ("fake tone" mode only)... */ #if (CFE_MISSION_TIME_CFG_FAKE_TONE == true) - CFE_SB_InitMsg(&CFE_TIME_TaskData.ToneSendCmd, - CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), - sizeof(CFE_TIME_TaskData.ToneSendCmd), true); + CFE_MSG_Init(&CFE_TIME_TaskData.ToneSendCmd.BaseMsg, + CFE_SB_ValueToMsgId(CFE_TIME_SEND_CMD_MID), + sizeof(CFE_TIME_TaskData.ToneSendCmd)); #endif /* ** Initialize local 1Hz "wake-up" command packet (optional)... */ - CFE_SB_InitMsg(&CFE_TIME_TaskData.Local1HzCmd, + CFE_MSG_Init((CFE_MSG_Message_t *)&CFE_TIME_TaskData.Local1HzCmd, CFE_SB_ValueToMsgId(CFE_TIME_1HZ_CMD_MID), - sizeof(CFE_TIME_TaskData.Local1HzCmd), true); + sizeof(CFE_TIME_TaskData.Local1HzCmd)); return; diff --git a/fsw/cfe-core/src/time/cfe_time_utils.h b/fsw/cfe-core/src/time/cfe_time_utils.h index d89f19350..facd2d773 100644 --- a/fsw/cfe-core/src/time/cfe_time_utils.h +++ b/fsw/cfe-core/src/time/cfe_time_utils.h @@ -183,8 +183,8 @@ typedef struct /* ** Task operational data (not reported in housekeeping)... */ - CFE_SB_MsgPtr_t MsgPtr; - CFE_SB_PipeId_t CmdPipe; + CFE_MSG_Message_t *MsgPtr; + CFE_SB_PipeId_t CmdPipe; /* ** Task initialization data (not reported in housekeeping)... @@ -349,7 +349,7 @@ CFE_TIME_SysTime_t CFE_TIME_LatchClock(void); ** Function prototypes (Time Services utilities data)... */ int32 CFE_TIME_TaskInit (void); -void CFE_TIME_TaskPipe(CFE_SB_MsgPtr_t MessagePtr); +void CFE_TIME_TaskPipe(CFE_MSG_Message_t *MsgPtr); void CFE_TIME_InitData(void); void CFE_TIME_QueryResetVars(void); void CFE_TIME_UpdateResetVars(const CFE_TIME_Reference_t *Reference);