Skip to content

Commit

Permalink
Fix nasa#1397, Rename overloaded EVS_PacketID_t to `EVS_EventContex…
Browse files Browse the repository at this point in the history
…t_t`
  • Loading branch information
thnkslprpt committed Dec 3, 2023
1 parent b72dd4e commit 4cc2a65
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 53 deletions.
22 changes: 11 additions & 11 deletions modules/evs/config/default_cfe_evs_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ typedef struct CFE_EVS_HousekeepingTlm_Payload

/** Telemetry packet structures */

typedef struct CFE_EVS_PacketID
typedef struct CFE_EVS_EventContext
{
char AppName[CFE_MISSION_MAX_API_LEN]; /**< \cfetlmmnemonic \EVS_APPNAME
\brief Application name */
\brief Application name */
uint16 EventID; /**< \cfetlmmnemonic \EVS_EVENTID
\brief Numerical event identifier */
uint16 EventType; /**< \cfetlmmnemonic \EVS_EVENTTYPE
Expand All @@ -231,28 +231,28 @@ typedef struct CFE_EVS_PacketID
\brief Spacecraft identifier */
uint32 ProcessorID; /**< \cfetlmmnemonic \EVS_PROCESSORID
\brief Numerical processor identifier */
} CFE_EVS_PacketID_t;
} CFE_EVS_EventContext_t;

/**
** \cfeevstlm Event Message Telemetry Packet (Long format)
**/
typedef struct CFE_EVS_LongEventTlm_Payload
{
CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */
char Message[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; /**< \cfetlmmnemonic \EVS_EVENT
\brief Event message string */
uint8 Spare1; /**< \cfetlmmnemonic \EVS_SPARE1
\brief Structure padding */
uint8 Spare2; /**< \cfetlmmnemonic \EVS_SPARE2
\brief Structure padding */
CFE_EVS_EventContext_t EventContext; /**< \brief Event packet context */
char Message[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH]; /**< \cfetlmmnemonic \EVS_EVENT
\brief Event message string */
uint8 Spare1; /**< \cfetlmmnemonic \EVS_SPARE1
\brief Structure padding */
uint8 Spare2; /**< \cfetlmmnemonic \EVS_SPARE2
\brief Structure padding */
} CFE_EVS_LongEventTlm_Payload_t;

/**
** \cfeevstlm Event Message Telemetry Packet (Short format)
**/
typedef struct CFE_EVS_ShortEventTlm_Payload
{
CFE_EVS_PacketID_t PacketID; /**< \brief Event packet information */
CFE_EVS_EventContext_t EventContext; /**< \brief Event packet context */
} CFE_EVS_ShortEventTlm_Payload_t;

#endif
6 changes: 3 additions & 3 deletions modules/evs/eds/cfe_evs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
</EntryList>
</ContainerDataType>

<ContainerDataType name="PacketID" shortDescription="Telemetry packet structures">
<ContainerDataType name="EventContext" shortDescription="Telemetry packet structures">
<EntryList>
<Entry name="AppName" type="BASE_TYPES/ApiName" shortDescription="Application name">
<LongDescription>
Expand Down Expand Up @@ -295,7 +295,7 @@

<ContainerDataType name="LongEventTlm_Payload" shortDescription="Event Message Telemetry Payload Long Format">
<EntryList>
<Entry name="PacketID" type="PacketID" shortDescription="Event packet information" />
<Entry name="EventContext" type="EventContext" shortDescription="Event packet context" />
<Entry name="Message" type="EventMessage" shortDescription="Event message string">
<LongDescription>
\cfetlmmnemonic \EVS_EVENT
Expand All @@ -306,7 +306,7 @@

<ContainerDataType name="ShortEventTlm_Payload" shortDescription="Event Message Telemetry Payload Short Format">
<EntryList>
<Entry name="PacketID" type="PacketID" shortDescription="Event packet information" />
<Entry name="EventContext" type="EventContext" shortDescription="Event packet context" />
</EntryList>
</ContainerDataType>

Expand Down
20 changes: 10 additions & 10 deletions modules/evs/fsw/src/cfe_evs_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
/* Initialize EVS event packets */
CFE_MSG_Init(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_LONG_EVENT_MSG_MID),
sizeof(LongEventTlm));
LongEventTlm.Payload.PacketID.EventID = EventID;
LongEventTlm.Payload.PacketID.EventType = EventType;
LongEventTlm.Payload.EventContext.EventID = EventID;
LongEventTlm.Payload.EventContext.EventType = EventType;

/* vsnprintf() returns the total expanded length of the formatted string */
/* vsnprintf() copies and zero terminates portion that fits in the buffer */
Expand All @@ -482,10 +482,10 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
}

/* Obtain task and system information */
CFE_ES_GetAppName((char *)LongEventTlm.Payload.PacketID.AppName, EVS_AppDataGetID(AppDataPtr),
sizeof(LongEventTlm.Payload.PacketID.AppName));
LongEventTlm.Payload.PacketID.SpacecraftID = CFE_PSP_GetSpacecraftId();
LongEventTlm.Payload.PacketID.ProcessorID = CFE_PSP_GetProcessorId();
CFE_ES_GetAppName((char *)LongEventTlm.Payload.EventContext.AppName, EVS_AppDataGetID(AppDataPtr),
sizeof(LongEventTlm.Payload.EventContext.AppName));
LongEventTlm.Payload.EventContext.SpacecraftID = CFE_PSP_GetSpacecraftId();
LongEventTlm.Payload.EventContext.ProcessorID = CFE_PSP_GetProcessorId();

/* Set the packet timestamp */
CFE_MSG_SetMsgTime(CFE_MSG_PTR(LongEventTlm.TelemetryHeader), *TimeStamp);
Expand All @@ -512,7 +512,7 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1
CFE_MSG_Init(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), CFE_SB_ValueToMsgId(CFE_EVS_SHORT_EVENT_MSG_MID),
sizeof(ShortEventTlm));
CFE_MSG_SetMsgTime(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), *TimeStamp);
ShortEventTlm.Payload.PacketID = LongEventTlm.Payload.PacketID;
ShortEventTlm.Payload.EventContext = LongEventTlm.Payload.EventContext;
CFE_SB_TransmitMsg(CFE_MSG_PTR(ShortEventTlm.TelemetryHeader), true);
}

Expand Down Expand Up @@ -546,9 +546,9 @@ void EVS_SendViaPorts(CFE_EVS_LongEventTlm_t *EVS_PktPtr)
CFE_TIME_Print(TimeBuffer, PktTime);

snprintf(PortMessage, sizeof(PortMessage), "%s %u/%u/%s %u: %s", TimeBuffer,
(unsigned int)EVS_PktPtr->Payload.PacketID.SpacecraftID,
(unsigned int)EVS_PktPtr->Payload.PacketID.ProcessorID, EVS_PktPtr->Payload.PacketID.AppName,
(unsigned int)EVS_PktPtr->Payload.PacketID.EventID, EVS_PktPtr->Payload.Message);
(unsigned int)EVS_PktPtr->Payload.EventContext.SpacecraftID,
(unsigned int)EVS_PktPtr->Payload.EventContext.ProcessorID, EVS_PktPtr->Payload.EventContext.AppName,
(unsigned int)EVS_PktPtr->Payload.EventContext.EventID, EVS_PktPtr->Payload.Message);

if (CFE_EVS_Global.EVS_TlmPkt.Payload.OutputPort & CFE_EVS_PORT1_BIT)
{
Expand Down
58 changes: 29 additions & 29 deletions modules/evs/ut-coverage/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ static const UT_TaskPipeDispatchId_t UT_TPID_CFE_EVS_SEND_HK = {.MsgId = CFE_SB_

static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_LONGFMT_SNAPSHOTDATA = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID),
.SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID.EventID),
.SnapshotOffset = offsetof(CFE_EVS_LongEventTlm_t, Payload.EventContext.EventID),
.SnapshotSize = sizeof(uint16)};

static const UT_SoftwareBusSnapshot_Entry_t UT_EVS_SHORTFMT_SNAPSHOTDATA = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID.EventID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.EventContext.EventID),
.SnapshotSize = sizeof(uint16)};

typedef struct
Expand Down 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,17 +695,17 @@ void Test_Format(void)

CFE_TIME_SysTime_t time = {0, 0};
CFE_EVS_SetEventFormatModeCmd_t modecmd;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_PacketID_t CapturedMsg;
CFE_EVS_EnableAppEventTypeCmd_t appbitcmd;
CFE_EVS_EventContext_t CapturedMsg;
UT_SoftwareBusSnapshot_Entry_t LongFmtSnapshotData = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID),
.SnapshotBuffer = &CapturedMsg,
.SnapshotOffset =
offsetof(CFE_EVS_LongEventTlm_t, Payload.PacketID),
offsetof(CFE_EVS_LongEventTlm_t, Payload.EventContext),
.SnapshotSize = sizeof(CapturedMsg)};
UT_SoftwareBusSnapshot_Entry_t ShortFmtSnapshotData = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_SHORT_EVENT_MSG_MID),
.SnapshotBuffer = &CapturedMsg,
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.PacketID),
.SnapshotOffset = offsetof(CFE_EVS_ShortEventTlm_t, Payload.EventContext),
.SnapshotSize = sizeof(CapturedMsg)};
EVS_AppData_t * AppDataPtr;
CFE_ES_AppId_t AppID;
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 @@ -1929,13 +1929,13 @@ void Test_Squelching(void)
if (i < CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST)
{
UtAssert_UINT32_EQ(SnapshotData.Count, i + 1);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);
}
else if (i == CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST)
{
UtAssert_UINT32_EQ(SnapshotData.Count, i + 1);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_EVS_APP_SQUELCHED);
}
else
Expand All @@ -1954,7 +1954,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 2);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);

/*
Expand All @@ -1963,7 +1963,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 3);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, CFE_EVS_SQUELCHED_ERR_EID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_EVS_APP_SQUELCHED);

/*
Expand All @@ -1983,7 +1983,7 @@ void Test_Squelching(void)
UT_SetDataBuffer(UT_KEY(CFE_PSP_GetTime), &InjectedTime, sizeof(InjectedTime), false);
EVS_Retval = SendEventFuncs[j](EVENT_ID);
UtAssert_UINT32_EQ(SnapshotData.Count, CFE_PLATFORM_EVS_MAX_APP_EVENT_BURST + 4);
UtAssert_UINT32_EQ(CapturedTlm.Payload.PacketID.EventID, EVENT_ID);
UtAssert_UINT32_EQ(CapturedTlm.Payload.EventContext.EventID, EVENT_ID);
UtAssert_UINT32_EQ(EVS_Retval, CFE_SUCCESS);
UtAssert_UINT32_EQ(AppDataPtr->SquelchedCount, CFE_EVS_MAX_SQUELCH_COUNT);

Expand Down

0 comments on commit 4cc2a65

Please sign in to comment.