Skip to content

Commit

Permalink
Merge pull request #2472 from thnkslprpt:fix-2057-update-docs-and-UT-…
Browse files Browse the repository at this point in the history
…with-CFE_MSG_PTR

Fix #2057, Update docs and UT to use CFE_MSG_PTR
  • Loading branch information
dzbaker committed Dec 12, 2023
2 parents ee18742 + 23c7991 commit 68da2a7
Show file tree
Hide file tree
Showing 7 changed files with 243 additions and 197 deletions.
18 changes: 9 additions & 9 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ FILE: sample_app.h
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader;
CFE_MSG_TelemetryHeader_t TelemetryHeader;

/*
** Task command interface counters...
Expand Down Expand Up @@ -1949,7 +1949,7 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
int32 Status;

...
Status = CFE_MSG_Init(&SAMPLE_AppData.HkPacket.TlmHeader.Msg, /* Address of SB Message Data Buffer */
Status = CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_AppData.HkPacket.TelemetryHeader), /* Location of SB Message Data Buffer */
SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */
sizeof(SAMPLE_AppData.HkPacket)); /* Size of Buffer */
...
Expand Down Expand Up @@ -2107,8 +2107,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
/*
** Send housekeeping telemetry packet...
*/
CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg);
CFE_SB_TransmitMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, true);
CFE_SB_TimeStampMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader));
CFE_SB_TransmitMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader), true);
...
}
```
Expand Down Expand Up @@ -2222,7 +2222,7 @@ FILE: sample_app.h
*/
typedef struct
{
CFE_MSG_CommandHeader_t TlmHeader;
CFE_MSG_CommandHeader_t TelemetryHeader;

/*
** Task command interface counters...
Expand Down Expand Up @@ -2255,17 +2255,17 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
*/
SAMPLE_AppData.BigPktBuf = (SAMPLE_BigPkt_Buffer_t *)CFE_SB_AllocateMessageBuffer(sizeof(SAMPLE_BigPkt_t));

CFE_MSG_Init(SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg, SAMPLE_BIG_TLM_MID,
sizeof(SAMPLE_AppData.BigPktBuf->Pkt);
CFE_MSG_Init(SAMPLE_AppData.BigPktBuf->Pkt.TelemetryHeader.Msg, SAMPLE_BIG_TLM_MID,
sizeof(SAMPLE_AppData.BigPktBuf->Pkt));

/*
** ...Fill Packet with Data...
*/

/*
/*
** Send Message after time tagging it with current time
*/
CFE_SB_TimeStampMsg(&SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg);
CFE_SB_TimeStampMsg(&SAMPLE_AppData.BigPktBuf->Pkt.TelemetryHeader.Msg);
CFE_SB_TransmitBuffer(SAMPLE_AppData.BigPktBuf, BufferHandle, true);
/* SAMPLE_AppData.BigPktBuf is no longer a valid pointer */
...
Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_testcase/src/sb_sendrecv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ typedef struct
typedef union
{
CFE_MSG_Message_t Hdr;
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_TelemetryHeader_t TlmHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CFE_MSG_TelemetryHeader_t TelemetryHeader;
uint8 MaxSize[CFE_MISSION_SB_MAX_SB_MSG_SIZE + 16];
char StringBuffer[CFE_FT_STRINGBUF_SIZE];
} CFE_FT_TestBigMessage_t;
Expand Down
284 changes: 163 additions & 121 deletions modules/es/ut-coverage/es_UT.c

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions modules/evs/ut-coverage/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void Test_Init(void)
{
CFE_EVS_EnablePortsCmd_t bitmaskcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_SB_MsgId_t msgid = CFE_SB_INVALID_MSG_ID;
CFE_SB_MsgId_t msgid = CFE_SB_INVALID_MSG_ID;

UtPrintf("Begin Test Init");

Expand Down Expand Up @@ -695,7 +695,7 @@ void Test_Format(void)

CFE_TIME_SysTime_t time = {0, 0};
CFE_EVS_SetEventFormatModeCmd_t modecmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_PacketID_t CapturedMsg;
UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID),
.SnapshotBuffer = &CapturedMsg,
Expand Down Expand Up @@ -821,7 +821,7 @@ void Test_Format(void)
*/
void Test_Ports(void)
{
CFE_EVS_EnablePortsCmd_t bitmaskcmd;
CFE_EVS_EnablePortsCmd_t bitmaskcmd;
UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)};
CFE_TIME_SysTime_t PacketTime;

Expand Down Expand Up @@ -1074,9 +1074,9 @@ void Test_WriteApp(void)
{
union
{
CFE_EVS_ResetCountersCmd_t ResetCountersCmd;
CFE_EVS_WriteAppDataFileCmd_t AppDataCmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_ResetCountersCmd_t ResetCountersCmd;
CFE_EVS_WriteAppDataFileCmd_t AppDataCmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
} CmdBuf;

UtPrintf("Begin Test Write App");
Expand Down Expand Up @@ -1157,10 +1157,10 @@ void Test_WriteApp(void)
*/
void Test_BadAppCmd(void)
{
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
CFE_EVS_AddEventFilterCmd_t appmaskcmd;
CFE_EVS_ResetFilterCmd_t appcmdcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
CFE_EVS_AddEventFilterCmd_t appmaskcmd;
CFE_EVS_ResetFilterCmd_t appcmdcmd;
uint32 TestAppIndex;

UtPrintf("Begin Test Bad App Command");
Expand Down Expand Up @@ -1425,11 +1425,11 @@ void Test_BadAppCmd(void)
*/
void Test_EventCmd(void)
{
uint16 EventCount[4];
CFE_EVS_EnablePortsCmd_t bitmaskcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)};
uint16 EventCount[4];
CFE_EVS_EnablePortsCmd_t bitmaskcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
UT_SoftwareBusSnapshot_Entry_t LocalSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)};

memset(&bitmaskcmd, 0, sizeof(bitmaskcmd));

Expand Down Expand Up @@ -1602,10 +1602,10 @@ void Test_EventCmd(void)
void Test_FilterCmd(void)
{
int i;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
CFE_EVS_AddEventFilterCmd_t appmaskcmd;
CFE_EVS_ResetFilterCmd_t appcmdcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EnableAppEventsCmd_t appnamecmd;
CFE_EVS_AddEventFilterCmd_t appmaskcmd;
CFE_EVS_ResetFilterCmd_t appcmdcmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;

UtPrintf("Begin Test Filter Command");

Expand Down Expand Up @@ -2124,4 +2124,4 @@ void Test_Misc(void)
EVS_AppDataSetUsed(&CFE_EVS_Global.AppData[i], AppID);
}
UtAssert_UINT32_EQ(CFE_EVS_ReportHousekeepingCmd(NULL), CFE_STATUS_NO_COUNTER_INCREMENT);
}
}
Loading

0 comments on commit 68da2a7

Please sign in to comment.