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 9, 2023
1 parent 2be3511 commit 5039f7c
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 301 deletions.
68 changes: 34 additions & 34 deletions fsw/inc/fm_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */
} FM_HousekeepingCmd_t;
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} FM_SendHkCmd_t;

/**
* \brief No-Operation command packet structure
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,8 +64,8 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */
} FM_ResetCmd_t;
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */
} FM_ResetCountersCmd_t;

/**
* \brief Copy/Move File command payload structure
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 All @@ -146,7 +146,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */

FM_SingleFilename_Payload_t Payload; /**< \brief Command Payload */
} FM_DeleteFileCmd_t;
Expand All @@ -168,10 +168,10 @@ 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_DeleteAllCmd_t;
} FM_DeleteAllFilesCmd_t;

/**
* \brief Decompress File command packet structure
Expand All @@ -180,10 +180,10 @@ 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_DecompressCmd_t;
} FM_DecompressFileCmd_t;

/**
* \brief Two source, one target filename command payload structure
Expand All @@ -204,10 +204,10 @@ 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;
} FM_ConcatFilesCmd_t;

/**
* \brief Filename and CRC command payload structure
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,10 +249,10 @@ 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;
} FM_CreateDirectoryCmd_t;

/**
* \brief Delete Directory command packet structure
Expand All @@ -261,10 +261,10 @@ 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;
} FM_DeleteDirectoryCmd_t;

/**
* \brief Get Directory and output to file command payload
Expand All @@ -287,10 +287,10 @@ 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;
} FM_GetDirListFileCmd_t;

/**
* \brief Get Directory and output to message command payload
Expand All @@ -313,10 +313,10 @@ 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;
} FM_GetDirListPktCmd_t;

/**
* \brief Get Free Space command packet structure
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,10 +369,10 @@ 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;
} FM_SetPermissionsCmd_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
18 changes: 9 additions & 9 deletions fsw/inc/fm_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* - #FM_HousekeepingPkt_Payload_t.ChildCmdWarnCounter
*
* \par Command Packet Structure
* #FM_ResetCmd_t
* #FM_ResetCountersCmd_t
*
* \par Command Success Verification
* - Command counters will be set to zero (see description)
Expand Down Expand Up @@ -351,7 +351,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_DeleteAllCmd_t
* #FM_DeleteAllFilesCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -418,7 +418,7 @@
* will generate an error event.
*
* \par Command Packet Structure
* #FM_DecompressCmd_t
* #FM_DecompressFileCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -474,7 +474,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_ConcatCmd_t
* #FM_ConcatFilesCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -628,7 +628,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_CreateDirCmd_t
* #FM_CreateDirectoryCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -676,7 +676,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_DeleteDirCmd_t
* #FM_DeleteDirectoryCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -731,7 +731,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_GetDirFileCmd_t
* #FM_GetDirListFileCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down Expand Up @@ -811,7 +811,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_GetDirPktCmd_t
* #FM_GetDirListPktCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified with
Expand Down Expand Up @@ -943,7 +943,7 @@
* the child task interface queue.
*
* \par Command Packet Structure
* #FM_SetPermCmd_t
* #FM_SetPermissionsCmd_t
*
* \par Command Success Verification
* - #FM_HousekeepingPkt_Payload_t.CommandCounter will increment after validation
Expand Down
12 changes: 6 additions & 6 deletions fsw/src/fm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void FM_ProcessPkt(const CFE_SB_Buffer_t *BufPtr)
{
/* Housekeeping request */
case FM_SEND_HK_MID:
FM_ReportHK((CFE_MSG_CommandHeader_t *)BufPtr);
FM_SendHkCmd(BufPtr);
break;

/* FM ground commands */
Expand Down Expand Up @@ -387,14 +387,14 @@ void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
/* FM application -- housekeeping request packet processor */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void FM_ReportHK(const CFE_MSG_CommandHeader_t *Msg)
void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
{
const char * CmdText = "HK Request";
bool Result = true;
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(*BufPtr), sizeof(FM_SendHkCmd_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);
}
}
Loading

0 comments on commit 5039f7c

Please sign in to comment.