From 329aff4ce279e56cab031bfc28e5b26dc256789e Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Wed, 24 May 2023 13:24:44 +1000 Subject: [PATCH] Fix #1397, Rename overloaded `EVS_PacketID_t` to `EVS_EventContext_t` --- .../evs/config/default_cfe_evs_msgstruct.h | 22 +++++++++---------- modules/evs/eds/cfe_evs.xml | 6 ++--- modules/evs/fsw/src/cfe_evs_utils.c | 20 ++++++++--------- modules/evs/ut-coverage/evs_UT.c | 20 ++++++++--------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/evs/config/default_cfe_evs_msgstruct.h b/modules/evs/config/default_cfe_evs_msgstruct.h index ba0b394a7..cdc435be7 100644 --- a/modules/evs/config/default_cfe_evs_msgstruct.h +++ b/modules/evs/config/default_cfe_evs_msgstruct.h @@ -360,10 +360,10 @@ typedef struct CFE_EVS_HousekeepingTlm /** 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 @@ -372,20 +372,20 @@ 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; /** @@ -393,7 +393,7 @@ typedef struct CFE_EVS_LongEventTlm_Payload **/ 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; typedef struct CFE_EVS_LongEventTlm diff --git a/modules/evs/eds/cfe_evs.xml b/modules/evs/eds/cfe_evs.xml index 99297ab1d..a9c0561e6 100644 --- a/modules/evs/eds/cfe_evs.xml +++ b/modules/evs/eds/cfe_evs.xml @@ -263,7 +263,7 @@ - + @@ -295,7 +295,7 @@ - + \cfetlmmnemonic \EVS_EVENT @@ -306,7 +306,7 @@ - + diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index bf6057b05..660864f8c 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -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 */ @@ -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); @@ -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); } @@ -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) { diff --git a/modules/evs/ut-coverage/evs_UT.c b/modules/evs/ut-coverage/evs_UT.c index d122dba1d..b0bcacfaf 100644 --- a/modules/evs/ut-coverage/evs_UT.c +++ b/modules/evs/ut-coverage/evs_UT.c @@ -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 @@ -696,16 +696,16 @@ void Test_Format(void) CFE_TIME_SysTime_t time = {0, 0}; CFE_EVS_SetEventFormatModeCmd_t modecmd; CFE_EVS_AppNameBitMaskCmd_t appbitcmd; - CFE_EVS_PacketID_t CapturedMsg; + 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; @@ -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 @@ -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); /* @@ -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); /* @@ -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);