From ca2c4fcc13c8a68973f5c838bba154f6e122088c Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 13 Feb 2023 15:39:25 -0500 Subject: [PATCH] Fix #15, use CFE_MSG_PTR macro This requires headers to be named correctly per CFE_MSG definitions. Includes other remaining cleanup items --- fsw/inc/fm_msg.h | 42 +++++++++++++++++++++--------------------- fsw/src/fm_app.c | 8 ++++---- fsw/src/fm_child.c | 12 ++++++------ fsw/src/fm_cmds.c | 16 ++++++++-------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/fsw/inc/fm_msg.h b/fsw/inc/fm_msg.h index e6e51d6..7b88a17 100644 --- a/fsw/inc/fm_msg.h +++ b/fsw/inc/fm_msg.h @@ -44,7 +44,7 @@ */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } FM_HousekeepingCmd_t; /** @@ -54,7 +54,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } FM_NoopCmd_t; /** @@ -64,7 +64,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } FM_ResetCmd_t; /** @@ -88,7 +88,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */ } FM_CopyFileCmd_t; @@ -100,7 +100,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_OvwSourceTargetFilename_Payload_t Payload; /**< \brief Command payload */ @@ -124,7 +124,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_SourceTargetFileName_Payload_t Payload; /**< \brief Command payload */ } FM_RenameFileCmd_t; @@ -204,7 +204,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_TwoSourceOneTarget_Payload_t Payload; /**< \brief Command Payload */ } FM_ConcatCmd_t; @@ -227,7 +227,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_FilenameAndCRC_Payload_t Payload; /**< \brief Command Payload */ } FM_GetFileInfoCmd_t; @@ -239,7 +239,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } FM_GetOpenFilesCmd_t; /** @@ -249,7 +249,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */ } FM_CreateDirCmd_t; @@ -261,7 +261,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_DirectoryName_Payload_t Payload; /**< \brief Command Payload */ } FM_DeleteDirCmd_t; @@ -287,7 +287,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_GetDirectoryToFile_Payload_t Payload; /**< \brief Command Payload */ } FM_GetDirFileCmd_t; @@ -313,7 +313,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_GetDirectoryToPkt_Payload_t Payload; /**< \brief Command Payload */ } FM_GetDirPktCmd_t; @@ -325,7 +325,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ } FM_MonitorFilesystemSpaceCmd_t; /** @@ -346,7 +346,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_TableIndexAndState_Payload_t Payload; /**< \brief Command Payload */ } FM_SetTableStateCmd_t; @@ -369,7 +369,7 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ FM_FilenameAndMode_Payload_t Payload; } FM_SetPermCmd_t; @@ -415,7 +415,7 @@ typedef struct */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ FM_DirListPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_DirListPkt_t; @@ -462,7 +462,7 @@ typedef struct */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ FM_FileInfoPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_FileInfoPkt_t; @@ -496,7 +496,7 @@ typedef struct */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ FM_OpenFilesPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_OpenFilesPkt_t; @@ -531,7 +531,7 @@ typedef struct */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ FM_MonitorReportPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_MonitorReportPkt_t; @@ -568,7 +568,7 @@ typedef struct */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry Header */ + CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry Header */ FM_HousekeepingPkt_Payload_t Payload; /**< \brief Telemetry Payload */ } FM_HousekeepingPkt_t; diff --git a/fsw/src/fm_app.c b/fsw/src/fm_app.c index d6650cd..cf1ecbd 100644 --- a/fsw/src/fm_app.c +++ b/fsw/src/fm_app.c @@ -394,7 +394,7 @@ void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg) FM_HousekeepingPkt_Payload_t *PayloadPtr; /* Verify command packet length */ - Result = FM_IsValidCmdPktLength(&Msg->Msg, sizeof(FM_HousekeepingCmd_t), FM_HK_REQ_ERR_EID, CmdText); + Result = FM_IsValidCmdPktLength(CFE_MSG_PTR(*Msg), sizeof(FM_HousekeepingCmd_t), FM_HK_REQ_ERR_EID, CmdText); if (Result == true) { @@ -403,7 +403,7 @@ void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg) FM_AcquireTablePointers(); /* Initialize housekeeping telemetry message */ - CFE_MSG_Init(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_HK_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_HK_TLM_MID), sizeof(FM_HousekeepingPkt_t)); PayloadPtr = &FM_GlobalData.HousekeepingPkt.Payload; @@ -425,7 +425,7 @@ void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg) PayloadPtr->ChildCurrentCC = FM_GlobalData.ChildCurrentCC; PayloadPtr->ChildPreviousCC = FM_GlobalData.ChildPreviousCC; - CFE_SB_TimeStampMsg(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg); - CFE_SB_TransmitMsg(&FM_GlobalData.HousekeepingPkt.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.HousekeepingPkt.TelemetryHeader), true); } } diff --git a/fsw/src/fm_child.c b/fsw/src/fm_child.c index 35e2e78..a484395 100644 --- a/fsw/src/fm_child.c +++ b/fsw/src/fm_child.c @@ -825,7 +825,7 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) */ /* Initialize file info packet (set all data to zero) */ - CFE_MSG_Init(&FM_GlobalData.FileInfoPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_FILE_INFO_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_FILE_INFO_TLM_MID), sizeof(FM_FileInfoPkt_t)); ReportPtr = &FM_GlobalData.FileInfoPkt.Payload; @@ -941,8 +941,8 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs) } /* Timestamp and send file info telemetry packet */ - CFE_SB_TimeStampMsg(&FM_GlobalData.FileInfoPkt.TlmHeader.Msg); - CFE_SB_TransmitMsg(&FM_GlobalData.FileInfoPkt.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.FileInfoPkt.TelemetryHeader), true); FM_GlobalData.ChildCmdCounter++; @@ -1183,7 +1183,7 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) else { /* Initialize the directory list telemetry packet */ - CFE_MSG_Init(&FM_GlobalData.DirListPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_DIR_LIST_TLM_MID), + CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader), CFE_SB_ValueToMsgId(FM_DIR_LIST_TLM_MID), sizeof(FM_DirListPkt_t)); ReportPtr = &FM_GlobalData.DirListPkt.Payload; @@ -1253,8 +1253,8 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs) OS_DirectoryClose(DirId); /* Timestamp and send directory listing telemetry packet */ - CFE_SB_TimeStampMsg(&FM_GlobalData.DirListPkt.TlmHeader.Msg); - CFE_SB_TransmitMsg(&FM_GlobalData.DirListPkt.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.DirListPkt.TelemetryHeader), true); /* Send command completion event (info) */ CFE_EVS_SendEvent(FM_GET_DIR_PKT_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command: offset = %d, dir = %s", CmdText, diff --git a/fsw/src/fm_cmds.c b/fsw/src/fm_cmds.c index 4fc3fe0..6f5de2b 100644 --- a/fsw/src/fm_cmds.c +++ b/fsw/src/fm_cmds.c @@ -596,8 +596,8 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) if (CommandResult == true) { /* Initialize open files telemetry packet */ - CFE_MSG_Init(&FM_GlobalData.OpenFilesPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_OPEN_FILES_TLM_MID), - sizeof(FM_OpenFilesPkt_t)); + CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader), + CFE_SB_ValueToMsgId(FM_OPEN_FILES_TLM_MID), sizeof(FM_OpenFilesPkt_t)); /* Get list of open files and count */ NumOpenFiles = FM_GetOpenFilesData(ReportPtr->OpenFilesList); @@ -605,8 +605,8 @@ bool FM_GetOpenFilesCmd(const CFE_SB_Buffer_t *BufPtr) ReportPtr->NumOpenFiles = NumOpenFiles; /* Timestamp and send open files telemetry packet */ - CFE_SB_TimeStampMsg(&FM_GlobalData.OpenFilesPkt.TlmHeader.Msg); - CFE_SB_TransmitMsg(&FM_GlobalData.OpenFilesPkt.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.OpenFilesPkt.TelemetryHeader), true); /* Send command completion event (debug) */ CFE_EVS_SendEvent(FM_GET_OPEN_FILES_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText); @@ -880,8 +880,8 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) else { /* Initialize the file system free space telemetry packet */ - CFE_MSG_Init(&FM_GlobalData.MonitorReportPkt.TlmHeader.Msg, CFE_SB_ValueToMsgId(FM_FREE_SPACE_TLM_MID), - sizeof(FM_MonitorReportPkt_t)); + CFE_MSG_Init(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader), + CFE_SB_ValueToMsgId(FM_FREE_SPACE_TLM_MID), sizeof(FM_MonitorReportPkt_t)); /* Process enabled file system table entries */ MonitorPtr = FM_GlobalData.MonitorTablePtr->Entries; @@ -931,8 +931,8 @@ bool FM_MonitorFilesystemSpaceCmd(const CFE_SB_Buffer_t *BufPtr) } /* Timestamp and send file system free space telemetry packet */ - CFE_SB_TimeStampMsg(&FM_GlobalData.MonitorReportPkt.TlmHeader.Msg); - CFE_SB_TransmitMsg(&FM_GlobalData.MonitorReportPkt.TlmHeader.Msg, true); + CFE_SB_TimeStampMsg(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader)); + CFE_SB_TransmitMsg(CFE_MSG_PTR(FM_GlobalData.MonitorReportPkt.TelemetryHeader), true); /* Send command completion event (debug) */ CFE_EVS_SendEvent(FM_MONITOR_FILESYSTEM_SPACE_CMD_EID, CFE_EVS_EventType_DEBUG, "%s command", CmdText);