Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #123, use CFE_MSG_PTR conversion macro #124

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fsw/src/sc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ CFE_Status_t SC_AppInit(void)
SC_AppData.NextCmdTime[SC_RTP] = SC_MAX_TIME;

/* Initialize the SC housekeeping packet */
CFE_MSG_Init(&SC_OperData.HkPacket.TlmHeader.Msg, CFE_SB_ValueToMsgId(SC_HK_TLM_MID), sizeof(SC_HkTlm_t));
CFE_MSG_Init(CFE_MSG_PTR(SC_OperData.HkPacket), CFE_SB_ValueToMsgId(SC_HK_TLM_MID), sizeof(SC_HkTlm_t));

/* Select auto-exec RTS to start during first HK request */
if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON)
Expand Down
16 changes: 8 additions & 8 deletions fsw/src/sc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void SC_ProcessAtpCmd(void)
if (!SC_AppData.EnableHeaderUpdate)
{
/* If header update is NOT enabled, confirm this table entry has a valid checksum already */
CFE_MSG_ValidateChecksum(&EntryPtr->Msg, &ChecksumValid);
CFE_MSG_ValidateChecksum(CFE_MSG_PTR(EntryPtr->Msg), &ChecksumValid);
}
if (ChecksumValid)
{
Expand All @@ -127,8 +127,8 @@ void SC_ProcessAtpCmd(void)
** SC immediately executes the switch command.
*/

CFE_MSG_GetMsgId(&EntryPtr->Msg, &MessageID);
CFE_MSG_GetFcnCode(&EntryPtr->Msg, &CommandCode);
CFE_MSG_GetMsgId(CFE_MSG_PTR(EntryPtr->Msg), &MessageID);
CFE_MSG_GetFcnCode(CFE_MSG_PTR(EntryPtr->Msg), &CommandCode);

if (CommandCode == SC_SWITCH_ATS_CC && CFE_SB_MsgIdToValue(MessageID) == SC_CMD_MID)
{
Expand Down Expand Up @@ -156,7 +156,7 @@ void SC_ProcessAtpCmd(void)
}
else
{
Result = CFE_SB_TransmitMsg(&EntryPtr->Msg, SC_AppData.EnableHeaderUpdate);
Result = CFE_SB_TransmitMsg(CFE_MSG_PTR(EntryPtr->Msg), SC_AppData.EnableHeaderUpdate);

if (Result == CFE_SUCCESS)
{
Expand Down Expand Up @@ -338,15 +338,15 @@ void SC_ProcessRtpCommand(void)
if (!SC_AppData.EnableHeaderUpdate)
{
/* If header update is NOT enabled, confirm this table entry has a valid checksum already */
CFE_MSG_ValidateChecksum(&EntryPtr->Msg, &ChecksumValid);
CFE_MSG_ValidateChecksum(CFE_MSG_PTR(EntryPtr->Msg), &ChecksumValid);
}
if (ChecksumValid)
{
/*
** Try Sending the command on the Software Bus
*/

Result = CFE_SB_TransmitMsg(&EntryPtr->Msg, SC_AppData.EnableHeaderUpdate);
Result = CFE_SB_TransmitMsg(CFE_MSG_PTR(EntryPtr->Msg), SC_AppData.EnableHeaderUpdate);

if (Result == CFE_SUCCESS)
{
Expand Down Expand Up @@ -473,8 +473,8 @@ void SC_SendHkPacket(void)
} /* end for */

/* send the status packet */
CFE_SB_TimeStampMsg(&SC_OperData.HkPacket.TlmHeader.Msg);
CFE_SB_TransmitMsg(&SC_OperData.HkPacket.TlmHeader.Msg, true);
CFE_SB_TimeStampMsg(CFE_MSG_PTR(SC_OperData.HkPacket));
CFE_SB_TransmitMsg(CFE_MSG_PTR(SC_OperData.HkPacket), true);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down
12 changes: 6 additions & 6 deletions fsw/src/sc_loads.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void SC_LoadAts(uint16 AtsIndex)
SC_OperData.AtsCmdStatusTblAddr[AtsIndex][SC_ATS_CMD_NUM_TO_INDEX(AtsCmdNum)] == SC_EMPTY)
{
/* get message size */
CFE_MSG_GetSize(&EntryPtr->Msg, &MessageSize);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &MessageSize);

/* if the length of the command is valid */
if (MessageSize >= SC_PACKET_MIN_SIZE && MessageSize <= SC_PACKET_MAX_SIZE)
Expand Down Expand Up @@ -403,12 +403,12 @@ bool SC_ParseRts(uint32 Buffer32[])
*/
EntryPtr = (SC_RtsEntry_t *)&Buffer32[i];

CFE_MSG_GetSize(&EntryPtr->Msg, &CmdSize);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CmdSize);

/* Add header size, round up to boundary, convert to index delta */
IndexDelta = (CmdSize + SC_RTS_HEADER_SIZE + SC_ROUND_UP_BYTES) / sizeof(Buffer32[0]);

CFE_MSG_GetMsgId(&EntryPtr->Msg, &MessageID);
CFE_MSG_GetMsgId(CFE_MSG_PTR(EntryPtr->Msg), &MessageID);

if (!CFE_SB_IsValidMsgId(MessageID))
{
Expand Down Expand Up @@ -556,7 +556,7 @@ void SC_UpdateAppend(void)
}
else
{
CFE_MSG_GetSize(&EntryPtr->Msg, &CommandBytes);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CommandBytes);
CommandWords = (CommandBytes + SC_ROUND_UP_BYTES) / SC_BYTES_IN_WORD;

if ((CommandBytes < SC_PACKET_MIN_SIZE) || (CommandBytes > SC_PACKET_MAX_SIZE))
Expand Down Expand Up @@ -642,7 +642,7 @@ void SC_ProcessAppend(uint16 AtsIndex)
SC_OperData.AtsCmdStatusTblAddr[AtsIndex][CmdIndex] = SC_LOADED;

/* update entry index to point to the next entry */
CFE_MSG_GetSize(&EntryPtr->Msg, &CommandBytes);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CommandBytes);
CommandWords = (CommandBytes + SC_ROUND_UP_BYTES) / SC_BYTES_IN_WORD;
EntryIndex += (SC_ATS_HDR_NOPKT_WORDS + CommandWords);
}
Expand Down Expand Up @@ -795,7 +795,7 @@ int32 SC_VerifyAtsEntry(uint32 *Buffer32, int32 EntryIndex, int32 BufferWords)
else
{
/* Start with the byte length of the command packet */
CFE_MSG_GetSize(&EntryPtr->Msg, &CommandBytes);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CommandBytes);

/* Convert packet byte length to word length (round up odd bytes) */
CommandWords = (CommandBytes + SC_ROUND_UP_BYTES) / SC_BYTES_IN_WORD;
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/sc_rtsrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ void SC_AutoStartRts(uint16 RtsNumber)
/*
** Format the command packet to start the first RTS
*/
CFE_MSG_Init(&CmdPkt.CmdHeader.Msg, CFE_SB_ValueToMsgId(SC_CMD_MID), sizeof(CmdPkt));
CFE_MSG_Init(CFE_MSG_PTR(CmdPkt), CFE_SB_ValueToMsgId(SC_CMD_MID), sizeof(CmdPkt));

CFE_MSG_SetFcnCode(&CmdPkt.CmdHeader.Msg, SC_START_RTS_CC);
CFE_MSG_SetFcnCode(CFE_MSG_PTR(CmdPkt), SC_START_RTS_CC);

/*
** Get the RTS ID to start.
Expand All @@ -563,7 +563,7 @@ void SC_AutoStartRts(uint16 RtsNumber)
/*
** Now send the command back to SC
*/
CFE_SB_TransmitMsg(&CmdPkt.CmdHeader.Msg, true);
CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdPkt), true);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sc_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void SC_GetNextRtsCommand(void)
CmdOffset = SC_OperData.RtsInfoTblAddr[RtsIndex].NextCommandPtr;
EntryPtr = (SC_RtsEntry_t *)&SC_OperData.RtsTblAddr[RtsIndex][CmdOffset];

CFE_MSG_GetSize(&EntryPtr->Msg, &CmdLength);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CmdLength);
CmdLength += SC_RTS_HEADER_SIZE;

/*
Expand Down Expand Up @@ -196,7 +196,7 @@ void SC_GetNextRtsCommand(void)
/*
** get the length of the new command
*/
CFE_MSG_GetSize(&EntryPtr->Msg, &CmdLength);
CFE_MSG_GetSize(CFE_MSG_PTR(EntryPtr->Msg), &CmdLength);
CmdLength += SC_RTS_HEADER_SIZE;

/*
Expand Down
6 changes: 3 additions & 3 deletions unit-test/sc_dispatch_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void SC_VerifyCmdLength_Test_Nominal(void)
UT_SC_Dispatch_SetMsgSize(MsgSize);

/* Execute the function being tested */
UtAssert_BOOL_TRUE(SC_VerifyCmdLength(&CmdPacket.CmdHeader.Msg, sizeof(CmdPacket)));
UtAssert_BOOL_TRUE(SC_VerifyCmdLength(CFE_MSG_PTR(CmdPacket), sizeof(CmdPacket)));

/* Verify results */
UtAssert_UINT32_EQ(SC_OperData.HkPacket.Payload.CmdErrCtr, 0);
Expand All @@ -122,7 +122,7 @@ void SC_VerifyCmdLength_Test_LenError(void)
UT_SC_Dispatch_SetMsgSize(MsgSize);

/* Execute the function being tested */
UtAssert_BOOL_FALSE(SC_VerifyCmdLength(&CmdPacket.CmdHeader.Msg, 999));
UtAssert_BOOL_FALSE(SC_VerifyCmdLength(CFE_MSG_PTR(CmdPacket), 999));

/* Verify results */
UtAssert_UINT32_EQ(SC_OperData.HkPacket.Payload.CmdCtr, 0);
Expand All @@ -144,7 +144,7 @@ void SC_VerifyCmdLength_Test_LenErrorNotMID(void)
UT_SC_Dispatch_SetMsgSize(MsgSize);

/* Execute the function being tested */
UtAssert_BOOL_FALSE(SC_VerifyCmdLength(&CmdPacket.CmdHeader.Msg, 999));
UtAssert_BOOL_FALSE(SC_VerifyCmdLength(CFE_MSG_PTR(CmdPacket), 999));

/* Verify results */
UtAssert_UINT32_EQ(SC_OperData.HkPacket.Payload.CmdCtr, 0);
Expand Down
Loading