Skip to content

Commit

Permalink
Fix nasa#13, Use CFE_MSG_PTR instead of &(x).Msg
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Dec 5, 2023
1 parent d9c1034 commit 3a69a87
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 223 deletions.
22 changes: 11 additions & 11 deletions fsw/inc/cs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ typedef struct
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief cFE SB Tlm Msg Hdr */
CS_HkPacket_Payload_t Payload; /**< \brief CS HK Payload */
CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief cFE SB Tlm Msg Hdr */
CS_HkPacket_Payload_t Payload; /**< \brief CS HK Payload */
} CS_HkPacket_t;

/**\}*/
Expand Down Expand Up @@ -120,8 +120,8 @@ typedef struct
*/
typedef struct
{
cpuaddr Address; /**< \brief Address to start checksum */
uint32 Size; /**< \brief Number of bytes to checksum */
cpuaddr Address; /**< \brief Address to start checksum */
uint32 Size; /**< \brief Number of bytes to checksum */
uint32 MaxBytesPerCycle; /**< \brief Max Number of bytes to compute per cycle. Value of Zero to use platform config
value */
} CS_OneShotCmd_Payload_t;
Expand All @@ -137,7 +137,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_CommandHeader_t CommandHeader;
} CS_NoArgsCmd_t;

/**
Expand All @@ -147,7 +147,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CS_GetEntryIDCmd_Payload_t Payload;
} CS_GetEntryIDCmd_t;

Expand All @@ -159,8 +159,8 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CS_EntryCmd_Payload_t Payload;
CFE_MSG_CommandHeader_t CommandHeader;
CS_EntryCmd_Payload_t Payload;
} CS_EntryCmd_t;

/**
Expand All @@ -171,7 +171,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CS_TableNameCmd_Payload_t Payload;
} CS_TableNameCmd_t;

Expand All @@ -183,7 +183,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CS_AppNameCmd_Payload_t Payload;
} CS_AppNameCmd_t;

Expand All @@ -194,7 +194,7 @@ typedef struct
*/
typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CS_OneShotCmd_Payload_t Payload;
} CS_OneShotCmd_t;

Expand Down
10 changes: 5 additions & 5 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,13 @@ void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr)
CFE_MSG_FcnCode_t CommandCode = 0;
size_t ActualLength = 0;

CFE_MSG_GetSize(&CmdPtr->CmdHeader.Msg, &ActualLength);
CFE_MSG_GetSize(CFE_MSG_PTR(CmdPtr->CommandHeader), &ActualLength);

/* Verify the command packet length */
if (ExpectedLength != ActualLength)
{
CFE_MSG_GetMsgId(&CmdPtr->CmdHeader.Msg, &MessageID);
CFE_MSG_GetFcnCode(&CmdPtr->CmdHeader.Msg, &CommandCode);
CFE_MSG_GetMsgId(CFE_MSG_PTR(CmdPtr->CommandHeader), &MessageID);
CFE_MSG_GetFcnCode(CFE_MSG_PTR(CmdPtr->CommandHeader), &CommandCode);

CFE_EVS_SendEvent(CS_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid msg length: ID = 0x%08lX, CC = %d, Len = %lu, Expected = %lu",
Expand All @@ -599,8 +599,8 @@ void CS_HousekeepingCmd(const CS_NoArgsCmd_t *CmdPtr)
else
{
/* Send housekeeping telemetry packet */
CFE_SB_TimeStampMsg(&CS_AppData.HkPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&CS_AppData.HkPacket.TlmHeader.Msg, true);
CFE_SB_TimeStampMsg(CFE_MSG_PTR(CS_AppData.HkPacket.TelemetryHeader));
CFE_SB_TransmitMsg(CFE_MSG_PTR(CS_AppData.HkPacket.TelemetryHeader), true);
}
}

Expand Down
Loading

0 comments on commit 3a69a87

Please sign in to comment.