Skip to content

Commit

Permalink
Fix nasa#15, use CFE_MSG_PTR macro
Browse files Browse the repository at this point in the history
This requires headers to be named correctly per CFE_MSG definitions.
Includes other remaining cleanup items
  • Loading branch information
jphickey committed Mar 7, 2023
1 parent 2be3511 commit ca2c4fc
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
42 changes: 21 additions & 21 deletions fsw/inc/fm_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

/**
Expand All @@ -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;

/**
Expand All @@ -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;
Expand All @@ -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 */

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;

/**
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;

/**
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/fm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand All @@ -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);
}
}
12 changes: 6 additions & 6 deletions fsw/src/fm_child.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/fm_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,17 +596,17 @@ 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);

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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ca2c4fc

Please sign in to comment.