From 37288bc8c07b3a52cec9ba4ab74ce1b2606de3a7 Mon Sep 17 00:00:00 2001 From: havencarlson Date: Wed, 2 Aug 2023 11:42:23 -0400 Subject: [PATCH] Fix #56, cmd and tlm messages use payload sub-structure --- docs/dox_src/cfs_md.dox | 8 +- fsw/inc/md_msg.h | 93 +++++++++++++++------- fsw/inc/md_msgdefs.h | 34 ++++---- fsw/src/md_app.c | 20 ++--- fsw/src/md_cmds.c | 84 ++++++++++---------- fsw/src/md_dwell_pkt.c | 14 ++-- unit-test/md_app_tests.c | 124 ++++++++++++++--------------- unit-test/md_cmds_tests.c | 138 ++++++++++++++++----------------- unit-test/md_dwell_pkt_tests.c | 24 +++--- 9 files changed, 289 insertions(+), 250 deletions(-) diff --git a/docs/dox_src/cfs_md.dox b/docs/dox_src/cfs_md.dox index 8dfc870..196ba39 100644 --- a/docs/dox_src/cfs_md.dox +++ b/docs/dox_src/cfs_md.dox @@ -284,7 +284,7 @@ (Q) Which MD telemetry can be used to confirm that dwell packet processing is proceeding?

- #MD_HkTlm_t.Countdown should change each time a Wakeup Message is received + #MD_HkTlm_Payload_t.Countdown should change each time a Wakeup Message is received for all dwell streams that are being actively processed. @@ -333,9 +333,9 @@ 1) An information event, #MD_JAM_DWELL_INF_EID, will be issued showing the table number and entry number affected. 2) The following housekeeping parameters for the corresponding dwell table may be affected: - - #MD_HkTlm_t.DwellTblAddrCount - - #MD_HkTlm_t.NumWaitsPerPkt - - #MD_HkTlm_t.ByteCount + - #MD_HkTlm_Payload_t.DwellTblAddrCount + - #MD_HkTlm_Payload_t.NumWaitsPerPkt + - #MD_HkTlm_Payload_t.ByteCount diff --git a/fsw/inc/md_msg.h b/fsw/inc/md_msg.h index 0fd37aa..661dc4e 100644 --- a/fsw/inc/md_msg.h +++ b/fsw/inc/md_msg.h @@ -48,6 +48,41 @@ typedef struct char SymName[OS_MAX_SYM_LEN]; /**< \brief Symbol name string */ } MD_SymAddr_t; +/** + * \brief Start and Stop Dwell Commands Payload + */ +typedef struct +{ + uint16 TableMask; /**< \brief 0x0001=TBL1 bit, 0x0002=TBL2 bit, 0x0004=TBL3 bit, etc. */ + uint16 Padding; /**< \brief structure padding */ +} MD_CmdStartStop_Payload_t; + +/** + * \brief Jam Dwell Command Payload + */ +typedef struct +{ + uint16 TableId; /**< \brief Table Id: 1..#MD_NUM_DWELL_TABLES */ + uint16 EntryId; /**< \brief Address index: 1..#MD_DWELL_TABLE_SIZE */ + uint16 FieldLength; /**< \brief Length of Dwell Field : 0, 1, 2, or 4 */ + uint16 DwellDelay; /**< \brief Dwell Delay (number of task wakeup calls before following dwell) */ + MD_SymAddr_t DwellAddress; /**< \brief Dwell Address in #MD_SymAddr_t format */ +} MD_CmdJam_Payload_t; + +#if MD_SIGNATURE_OPTION == 1 + +/** + * \brief Set Signature Command Payload + */ +typedef struct +{ + uint16 TableId; /**< \brief Table Id: 1..MD_NUM_DWELL_TABLES */ + uint16 Padding; /**< \brief Padding */ + char Signature[MD_SIGNATURE_FIELD_LENGTH]; /**< \brief Sigature */ +} MD_CmdSetSignature_Payload_t; + +#endif + /** * \brief Generic "no arguments" command * @@ -70,10 +105,8 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t Header; /**< \brief Command header */ - - uint16 TableMask; /**< \brief 0x0001=TBL1 bit, 0x0002=TBL2 bit, 0x0004=TBL3 bit, etc. */ - uint16 Padding; /**< \brief structure padding */ + CFE_MSG_CommandHeader_t Header; /**< \brief Command header */ + MD_CmdStartStop_Payload_t Payload; } MD_CmdStartStop_t; /** @@ -84,12 +117,7 @@ typedef struct typedef struct { CFE_MSG_CommandHeader_t Header; /**< \brief Command header */ - - uint16 TableId; /**< \brief Table Id: 1..#MD_NUM_DWELL_TABLES */ - uint16 EntryId; /**< \brief Address index: 1..#MD_DWELL_TABLE_SIZE */ - uint16 FieldLength; /**< \brief Length of Dwell Field : 0, 1, 2, or 4 */ - uint16 DwellDelay; /**< \brief Dwell Delay (number of task wakeup calls before following dwell) */ - MD_SymAddr_t DwellAddress; /**< \brief Dwell Address in #MD_SymAddr_t format */ + MD_CmdJam_Payload_t Payload; } MD_CmdJam_t; #if MD_SIGNATURE_OPTION == 1 @@ -101,11 +129,8 @@ typedef struct */ typedef struct { - CFE_MSG_CommandHeader_t Header; /**< \brief Command Header */ - - uint16 TableId; /**< \brief Table Id: 1..MD_NUM_DWELL_TABLES */ - uint16 Padding; /**< \brief Padding */ - char Signature[MD_SIGNATURE_FIELD_LENGTH]; /**< \brief Sigature */ + CFE_MSG_CommandHeader_t Header; /**< \brief Command Header */ + MD_CmdSetSignature_Payload_t Payload; } MD_CmdSetSignature_t; #endif @@ -118,12 +143,10 @@ typedef struct */ /** - * \brief Memory Dwell HK Telemetry format + * \brief Memory Dwell HK Telemetry Payload */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - uint8 InvalidCmdCntr; /**< \brief Count of invalid commands received */ uint8 ValidCmdCntr; /**< \brief Count of valid commands received */ uint16 DwellEnabledMask; /**< \brief Dwell table enable bitmask 0x0001=TBL1, etc */ @@ -135,20 +158,13 @@ typedef struct uint16 DwellTblEntry[MD_NUM_DWELL_TABLES]; /**< \brief Next dwell table entry to be processed */ uint16 Countdown[MD_NUM_DWELL_TABLES]; /**< \brief Current value of countdown timer */ -} MD_HkTlm_t; +} MD_HkTlm_Payload_t; /** - * \brief Memory Dwell Housekeeping telemetry packet length - */ -#define MD_HK_TLM_LNGTH sizeof(MD_HkTlm_t) - -/** - * \brief Memory Dwell Telemetry Packet format + * \brief Memory Dwell Telemetry Packet Payload */ typedef struct { - CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ - uint8 TableId; /**< \brief TableId from 1 to #MD_NUM_DWELL_TABLES */ uint8 AddrCount; /**< \brief Number of addresses being sent - 1..#MD_DWELL_TABLE_SIZE valid */ uint16 ByteCount; /**< \brief Number of bytes of dwell data contained in packet */ @@ -159,6 +175,29 @@ typedef struct #endif uint8 Data[MD_DWELL_TABLE_SIZE * 4]; /**< \brief Dwell data (can be variable size based on dfn) */ +} MD_DwellPkt_Payload_t; + +/** + * \brief Memory Dwell HK Telemetry format + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + MD_HkTlm_Payload_t Payload; +} MD_HkTlm_t; + +/** + * \brief Memory Dwell Housekeeping telemetry packet length + */ +#define MD_HK_TLM_LNGTH sizeof(MD_HkTlm_t) + +/** + * \brief Memory Dwell Telemetry Packet format + */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */ + MD_DwellPkt_Payload_t Payload; } MD_DwellPkt_t; /** diff --git a/fsw/inc/md_msgdefs.h b/fsw/inc/md_msgdefs.h index e46b6fb..39bb3fd 100644 --- a/fsw/inc/md_msgdefs.h +++ b/fsw/inc/md_msgdefs.h @@ -48,7 +48,7 @@ * \par Command Verification * Successful execution of this command may be verified with the * following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr will increment + * - #MD_HkTlm_Payload_t.ValidCmdCntr will increment * - The #MD_NOOP_INF_EID informational event message will * be generated * @@ -58,7 +58,7 @@ * * Evidence of an unexpected command length error may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr will increment. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr will increment. * - The #MD_CMD_LEN_ERR_EID error event message will be issued. * * \par Criticality @@ -81,8 +81,8 @@ * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr will be set to zero. - * - #MD_HkTlm_t.InvalidCmdCntr will be set to zero. + * - #MD_HkTlm_Payload_t.ValidCmdCntr will be set to zero. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr will be set to zero. * - The #MD_RESET_CNTRS_DBG_EID debug event message will be generated. * * \par Error Conditions @@ -91,7 +91,7 @@ * * Evidence of an unexpected command length error may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr will increment. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr will increment. * - The #MD_CMD_LEN_ERR_EID error event message will be issued. * * \par Criticality @@ -144,8 +144,8 @@ * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr will increment. - * - #MD_HkTlm_t.DwellEnabledMask will be enabled (bit 1 = TBL1, etc) + * - #MD_HkTlm_Payload_t.ValidCmdCntr will increment. + * - #MD_HkTlm_Payload_t.DwellEnabledMask will be enabled (bit 1 = TBL1, etc) * - The #MD_START_DWELL_INF_EID informational event message * will be issued. * @@ -156,12 +156,12 @@ * * Evidence of an unexpected command length error may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr increments. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * - The #MD_CMD_LEN_ERR_EID error event message is issued. * * Evidence of an invalid value for Dwell Table mask argument may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr increments. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * - The #MD_EMPTY_TBLMASK_ERR_EID error event message is issued. * ** @@ -197,8 +197,8 @@ * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr increments. - * - #MD_HkTlm_t.DwellEnabledMask will be disabled (bit 1 = TBL1, etc) + * - #MD_HkTlm_Payload_t.ValidCmdCntr increments. + * - #MD_HkTlm_Payload_t.DwellEnabledMask will be disabled (bit 1 = TBL1, etc) * - The #MD_STOP_DWELL_INF_EID informational event message is issued. * * \par Error Conditions @@ -208,12 +208,12 @@ * * Evidence of an unexpected command length error may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr increments. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * - The #MD_CMD_LEN_ERR_EID error event message is issued. * * Evidence of an invalid value for Dwell Table argument may be found * in the following telemetry: - * - #MD_HkTlm_t.InvalidCmdCntr increments. + * - #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * - The #MD_EMPTY_TBLMASK_ERR_EID error event message is issued. * * \par Criticality @@ -247,7 +247,7 @@ * \par Command Verification * Nominal successful execution of this command may be verified with * the following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr increments. + * - #MD_HkTlm_Payload_t.ValidCmdCntr increments. * - The #MD_JAM_DWELL_INF_EID or #MD_JAM_NULL_DWELL_INF_EID informational event message is issued. * * \par Error Conditions @@ -261,7 +261,7 @@ * - Specified Dwell Address is not properly aligned for the specified Dwell Length * (Event message #MD_JAM_ADDR_NOT_32BIT_ERR_EID or #MD_JAM_ADDR_NOT_16BIT_ERR_EID is issued) * - * Any time the command fails, #MD_HkTlm_t.InvalidCmdCntr increments. + * Any time the command fails, #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * * \par Criticality * None. @@ -282,14 +282,14 @@ * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #MD_HkTlm_t.ValidCmdCntr will increment. + * - #MD_HkTlm_Payload_t.ValidCmdCntr will increment. * * \par Error Conditions * This command may fail for the following reason(s): * - Unexpected command length. (Event message #MD_CMD_LEN_ERR_EID is issued) * - Dwell Table ID is invalid. (Event message #MD_INVALID_SIGNATURE_TABLE_ERR_EID is issued) * - * Any time the command fails, #MD_HkTlm_t.InvalidCmdCntr increments. + * Any time the command fails, #MD_HkTlm_Payload_t.InvalidCmdCntr increments. * * \par Criticality * None. diff --git a/fsw/src/md_app.c b/fsw/src/md_app.c index 9a4891f..b6a9493 100644 --- a/fsw/src/md_app.c +++ b/fsw/src/md_app.c @@ -261,7 +261,7 @@ CFE_Status_t MD_InitSoftwareBusServices(void) MD_DWELL_PKT_LNGTH); /* this is max pkt size */ #if MD_SIGNATURE_OPTION == 1 - MD_AppData.MD_DwellPkt[TblIndex].Signature[0] = '\0'; + MD_AppData.MD_DwellPkt[TblIndex].Payload.Signature[0] = '\0'; #endif } @@ -664,8 +664,8 @@ void MD_HkStatus() /* Assign values for command counters */ - HkPktPtr->ValidCmdCntr = MD_AppData.CmdCounter; - HkPktPtr->InvalidCmdCntr = MD_AppData.ErrCounter; + HkPktPtr->Payload.ValidCmdCntr = MD_AppData.CmdCounter; + HkPktPtr->Payload.InvalidCmdCntr = MD_AppData.ErrCounter; for (TblIndex = 0; TblIndex < MD_NUM_DWELL_TABLES; TblIndex++) { @@ -686,15 +686,15 @@ void MD_HkStatus() /* ** Insert current values for each dwell stream */ - HkPktPtr->DwellTblAddrCount[TblIndex] = ThisDwellTablePtr->AddrCount; - HkPktPtr->NumWaitsPerPkt[TblIndex] = ThisDwellTablePtr->Rate; - HkPktPtr->DwellPktOffset[TblIndex] = ThisDwellTablePtr->PktOffset; - HkPktPtr->ByteCount[TblIndex] = ThisDwellTablePtr->DataSize; - HkPktPtr->DwellTblEntry[TblIndex] = ThisDwellTablePtr->CurrentEntry; - HkPktPtr->Countdown[TblIndex] = ThisDwellTablePtr->Countdown; + HkPktPtr->Payload.DwellTblAddrCount[TblIndex] = ThisDwellTablePtr->AddrCount; + HkPktPtr->Payload.NumWaitsPerPkt[TblIndex] = ThisDwellTablePtr->Rate; + HkPktPtr->Payload.DwellPktOffset[TblIndex] = ThisDwellTablePtr->PktOffset; + HkPktPtr->Payload.ByteCount[TblIndex] = ThisDwellTablePtr->DataSize; + HkPktPtr->Payload.DwellTblEntry[TblIndex] = ThisDwellTablePtr->CurrentEntry; + HkPktPtr->Payload.Countdown[TblIndex] = ThisDwellTablePtr->Countdown; } - HkPktPtr->DwellEnabledMask = MemDwellEnableBits; + HkPktPtr->Payload.DwellEnabledMask = MemDwellEnableBits; /* ** Send housekeeping telemetry packet... diff --git a/fsw/src/md_cmds.c b/fsw/src/md_cmds.c index 3884d6e..36b068f 100644 --- a/fsw/src/md_cmds.c +++ b/fsw/src/md_cmds.c @@ -55,7 +55,7 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr) /* Check that there's at least one valid table specified. */ for (TableId = 1; TableId <= MD_NUM_DWELL_TABLES; TableId++) { - if (MD_TableIsInMask(TableId, Start->TableMask)) + if (MD_TableIsInMask(TableId, Start->Payload.TableMask)) { /* At least one valid Table Id is in Mask */ AnyTablesInMask = true; @@ -72,7 +72,7 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr) for (TableId = 1; TableId <= MD_NUM_DWELL_TABLES; TableId++) { - if (MD_TableIsInMask(TableId, Start->TableMask)) + if (MD_TableIsInMask(TableId, Start->Payload.TableMask)) { NumTblInMask++; @@ -107,14 +107,14 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr) CFE_EVS_SendEvent(MD_START_DWELL_INF_EID, CFE_EVS_EventType_INFORMATION, "Start Dwell Table command processed successfully for table mask 0x%04X", - Start->TableMask); + Start->Payload.TableMask); } else { MD_AppData.ErrCounter++; CFE_EVS_SendEvent(MD_START_DWELL_ERR_EID, CFE_EVS_EventType_ERROR, - "Start Dwell Table for mask 0x%04X failed for %d of %d tables", Start->TableMask, + "Start Dwell Table for mask 0x%04X failed for %d of %d tables", Start->Payload.TableMask, ErrorCount, NumTblInMask); } } @@ -123,7 +123,7 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr) MD_AppData.ErrCounter++; CFE_EVS_SendEvent(MD_EMPTY_TBLMASK_ERR_EID, CFE_EVS_EventType_ERROR, "%s command rejected because no tables were specified in table mask (0x%04X)", "Start Dwell", - Start->TableMask); + Start->Payload.TableMask); } } @@ -141,7 +141,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr) for (TableId = 1; TableId <= MD_NUM_DWELL_TABLES; TableId++) { - if (MD_TableIsInMask(TableId, Stop->TableMask)) + if (MD_TableIsInMask(TableId, Stop->Payload.TableMask)) { NumTblInMask++; TableIndex = TableId - 1; @@ -166,7 +166,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr) if (ErrorCount == 0) { CFE_EVS_SendEvent(MD_STOP_DWELL_INF_EID, CFE_EVS_EventType_INFORMATION, - "Stop Dwell Table command processed successfully for table mask 0x%04X", Stop->TableMask); + "Stop Dwell Table command processed successfully for table mask 0x%04X", Stop->Payload.TableMask); MD_AppData.CmdCounter++; } @@ -175,7 +175,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr) MD_AppData.ErrCounter++; CFE_EVS_SendEvent(MD_STOP_DWELL_ERR_EID, CFE_EVS_EventType_ERROR, - "Stop Dwell Table for mask 0x%04X failed for %d of %d tables", Stop->TableMask, + "Stop Dwell Table for mask 0x%04X failed for %d of %d tables", Stop->Payload.TableMask, ErrorCount, NumTblInMask); } } @@ -183,7 +183,7 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr) { CFE_EVS_SendEvent(MD_EMPTY_TBLMASK_ERR_EID, CFE_EVS_EventType_ERROR, "%s command rejected because no tables were specified in table mask (0x%04X)", "Stop Dwell", - Stop->TableMask); + Stop->Payload.TableMask); MD_AppData.ErrCounter++; } } @@ -208,25 +208,25 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) Jam = (MD_CmdJam_t *)BufPtr; /* In case Dwell Address sym name isn't null terminated, do it now. */ - Jam->DwellAddress.SymName[OS_MAX_SYM_LEN - 1] = '\0'; + Jam->Payload.DwellAddress.SymName[OS_MAX_SYM_LEN - 1] = '\0'; /* ** Check that TableId and EntryId command arguments, ** which are used as array indexes, are valid. */ - if (!MD_ValidTableId(Jam->TableId)) + if (!MD_ValidTableId(Jam->Payload.TableId)) { CFE_EVS_SendEvent(MD_INVALID_JAM_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, - "Jam Cmd rejected due to invalid Tbl Id arg = %d (Expect 1.. %d)", Jam->TableId, + "Jam Cmd rejected due to invalid Tbl Id arg = %d (Expect 1.. %d)", Jam->Payload.TableId, MD_NUM_DWELL_TABLES); AllInputsValid = false; } - else if (!MD_ValidEntryId(Jam->EntryId)) + else if (!MD_ValidEntryId(Jam->Payload.EntryId)) { CFE_EVS_SendEvent(MD_INVALID_ENTRY_ARG_ERR_EID, CFE_EVS_EventType_ERROR, - "Jam Cmd rejected due to invalid Entry Id arg = %d (Expect 1.. %d)", Jam->EntryId, + "Jam Cmd rejected due to invalid Entry Id arg = %d (Expect 1.. %d)", Jam->Payload.EntryId, MD_DWELL_TABLE_SIZE); AllInputsValid = false; @@ -241,12 +241,12 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) */ if (AllInputsValid == true) { - TableIndex = Jam->TableId - 1; - EntryIndex = Jam->EntryId - 1; + TableIndex = Jam->Payload.TableId - 1; + EntryIndex = Jam->Payload.EntryId - 1; DwellEntryPtr = (MD_DwellControlEntry_t *)&MD_AppData.MD_DwellTables[TableIndex].Entry[EntryIndex]; - if (Jam->FieldLength == 0) + if (Jam->Payload.FieldLength == 0) /* ** Jam a null entry. Set all entry fields to zero. */ @@ -265,14 +265,14 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) if (Status == CFE_SUCCESS) { CFE_EVS_SendEvent(MD_JAM_NULL_DWELL_INF_EID, CFE_EVS_EventType_INFORMATION, - "Successful Jam of a Null Dwell Entry to Dwell Tbl#%d Entry #%d", Jam->TableId, - Jam->EntryId); + "Successful Jam of a Null Dwell Entry to Dwell Tbl#%d Entry #%d", Jam->Payload.TableId, + Jam->Payload.EntryId); } else { CFE_EVS_SendEvent(MD_JAM_NULL_DWELL_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed Jam of a Null Dwell Entry to Dwell Tbl#%d Entry #%d", Jam->TableId, - Jam->EntryId); + "Failed Jam of a Null Dwell Entry to Dwell Tbl#%d Entry #%d", Jam->Payload.TableId, + Jam->Payload.EntryId); AllInputsValid = false; } @@ -287,22 +287,22 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) */ /* Resolve and Validate Dwell Address */ - if (MD_ResolveSymAddr(&Jam->DwellAddress, &ResolvedAddr) == false) + if (MD_ResolveSymAddr(&Jam->Payload.DwellAddress, &ResolvedAddr) == false) { /* If DwellAddress argument couldn't be resolved, issue error event */ CFE_EVS_SendEvent(MD_CANT_RESOLVE_JAM_ADDR_ERR_EID, CFE_EVS_EventType_ERROR, "Jam Cmd rejected because symbolic address '%s' couldn't be resolved", - Jam->DwellAddress.SymName); + Jam->Payload.DwellAddress.SymName); AllInputsValid = false; } - else if (!MD_ValidFieldLength(Jam->FieldLength)) + else if (!MD_ValidFieldLength(Jam->Payload.FieldLength)) { CFE_EVS_SendEvent(MD_INVALID_LEN_ARG_ERR_EID, CFE_EVS_EventType_ERROR, "Jam Cmd rejected due to invalid Field Length arg = %d (Expect 0,1,2,or 4)", - Jam->FieldLength); + Jam->Payload.FieldLength); AllInputsValid = false; } - else if (!MD_ValidAddrRange(ResolvedAddr, Jam->FieldLength)) + else if (!MD_ValidAddrRange(ResolvedAddr, Jam->Payload.FieldLength)) { /* Issue event message that ResolvedAddr is invalid */ CFE_EVS_SendEvent(MD_INVALID_JAM_ADDR_ERR_EID, CFE_EVS_EventType_ERROR, @@ -311,14 +311,14 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) AllInputsValid = false; } #if MD_ENFORCE_DWORD_ALIGN == 0 - else if ((Jam->FieldLength == 4) && MD_Verify16Aligned(ResolvedAddr, (uint32)Jam->FieldLength) != true) + else if ((Jam->Payload.FieldLength == 4) && MD_Verify16Aligned(ResolvedAddr, (uint32)Jam->Payload.FieldLength) != true) { CFE_EVS_SendEvent(MD_JAM_ADDR_NOT_16BIT_ERR_EID, CFE_EVS_EventType_ERROR, "Jam Cmd rejected because address 0x%08X is not 16-bit aligned", ResolvedAddr); AllInputsValid = false; } #else - else if ((Jam->FieldLength == 4) && MD_Verify32Aligned(ResolvedAddr, (uint32)Jam->FieldLength) != true) + else if ((Jam->Payload.FieldLength == 4) && MD_Verify32Aligned(ResolvedAddr, (uint32)Jam->Payload.FieldLength) != true) { CFE_EVS_SendEvent(MD_JAM_ADDR_NOT_32BIT_ERR_EID, CFE_EVS_EventType_ERROR, "Jam Cmd rejected because address 0x%08X is not 32-bit aligned", @@ -326,7 +326,7 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) AllInputsValid = false; } #endif - else if ((Jam->FieldLength == 2) && MD_Verify16Aligned(ResolvedAddr, (uint32)Jam->FieldLength) != true) + else if ((Jam->Payload.FieldLength == 2) && MD_Verify16Aligned(ResolvedAddr, (uint32)Jam->Payload.FieldLength) != true) { CFE_EVS_SendEvent(MD_JAM_ADDR_NOT_16BIT_ERR_EID, CFE_EVS_EventType_ERROR, "Jam Cmd rejected because address 0x%08X is not 16-bit aligned", @@ -347,28 +347,28 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) { /* Jam the new values into Application control structure */ DwellEntryPtr->ResolvedAddress = ResolvedAddr; - DwellEntryPtr->Length = Jam->FieldLength; - DwellEntryPtr->Delay = Jam->DwellDelay; + DwellEntryPtr->Length = Jam->Payload.FieldLength; + DwellEntryPtr->Delay = Jam->Payload.DwellDelay; /* Update values in Table Services buffer */ - NewDwellAddress.Offset = Jam->DwellAddress.Offset; + NewDwellAddress.Offset = Jam->Payload.DwellAddress.Offset; - strncpy(NewDwellAddress.SymName, Jam->DwellAddress.SymName, OS_MAX_SYM_LEN - 1); + strncpy(NewDwellAddress.SymName, Jam->Payload.DwellAddress.SymName, OS_MAX_SYM_LEN - 1); NewDwellAddress.SymName[OS_MAX_SYM_LEN - 1] = '\0'; - Status = MD_UpdateTableDwellEntry(TableIndex, EntryIndex, Jam->FieldLength, Jam->DwellDelay, + Status = MD_UpdateTableDwellEntry(TableIndex, EntryIndex, Jam->Payload.FieldLength, Jam->Payload.DwellDelay, NewDwellAddress); /* Issue event */ if (Status == CFE_SUCCESS) { CFE_EVS_SendEvent(MD_JAM_DWELL_INF_EID, CFE_EVS_EventType_INFORMATION, - "Successful Jam to Dwell Tbl#%d Entry #%d", Jam->TableId, Jam->EntryId); + "Successful Jam to Dwell Tbl#%d Entry #%d", Jam->Payload.TableId, Jam->Payload.EntryId); } else { CFE_EVS_SendEvent(MD_JAM_DWELL_ERR_EID, CFE_EVS_EventType_ERROR, - "Failed Jam to Dwell Tbl#%d Entry #%d", Jam->TableId, Jam->EntryId); + "Failed Jam to Dwell Tbl#%d Entry #%d", Jam->Payload.TableId, Jam->Payload.EntryId); AllInputsValid = false; } @@ -394,7 +394,7 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) { CFE_EVS_SendEvent(MD_ZERO_RATE_CMD_INF_EID, CFE_EVS_EventType_INFORMATION, "Dwell Table %d is enabled with a delay of zero so no processing will occur", - Jam->TableId); + Jam->Payload.TableId); } } else @@ -413,14 +413,14 @@ void MD_ProcessSignatureCmd(const CFE_SB_Buffer_t *BufPtr) uint16 TblId = 0; uint16 StringLength; - TblId = SignatureCmd->TableId; + TblId = SignatureCmd->Payload.TableId; /* ** Check for Null Termination of string */ for (StringLength = 0; StringLength < MD_SIGNATURE_FIELD_LENGTH; StringLength++) { - if (SignatureCmd->Signature[StringLength] == '\0') + if (SignatureCmd->Payload.Signature[StringLength] == '\0') break; } @@ -451,15 +451,15 @@ void MD_ProcessSignatureCmd(const CFE_SB_Buffer_t *BufPtr) */ { /* Copy signature field to local dwell control structure */ - strncpy(MD_AppData.MD_DwellTables[TblId - 1].Signature, SignatureCmd->Signature, MD_SIGNATURE_FIELD_LENGTH - 1); + strncpy(MD_AppData.MD_DwellTables[TblId - 1].Signature, SignatureCmd->Payload.Signature, MD_SIGNATURE_FIELD_LENGTH - 1); MD_AppData.MD_DwellTables[TblId - 1].Signature[MD_SIGNATURE_FIELD_LENGTH - 1] = '\0'; /* Update signature in Table Services buffer */ - Status = MD_UpdateTableSignature(TblId - 1, SignatureCmd->Signature); + Status = MD_UpdateTableSignature(TblId - 1, SignatureCmd->Payload.Signature); if (Status == CFE_SUCCESS) { CFE_EVS_SendEvent(MD_SET_SIGNATURE_INF_EID, CFE_EVS_EventType_INFORMATION, - "Successfully set signature for Dwell Tbl#%d to '%s'", TblId, SignatureCmd->Signature); + "Successfully set signature for Dwell Tbl#%d to '%s'", TblId, SignatureCmd->Payload.Signature); MD_AppData.CmdCounter++; } diff --git a/fsw/src/md_dwell_pkt.c b/fsw/src/md_dwell_pkt.c index 7ab2b0e..ef27f65 100644 --- a/fsw/src/md_dwell_pkt.c +++ b/fsw/src/md_dwell_pkt.c @@ -188,7 +188,7 @@ int32 MD_GetDwellData(uint16 TblIndex, uint16 EntryIndex) /* didn't read. */ if (Status == CFE_SUCCESS) { - memcpy(&MD_AppData.MD_DwellPkt[TblIndex].Data[TblPtr->PktOffset], &MemReadVal, NumBytes); + memcpy(&MD_AppData.MD_DwellPkt[TblIndex].Payload.Data[TblPtr->PktOffset], &MemReadVal, NumBytes); } /* Update write location in dwell packet */ @@ -210,15 +210,15 @@ void MD_SendDwellPkt(uint16 TableIndex) /* ** Assign packet fields. */ - PktPtr->TableId = TableIndex + 1; - PktPtr->AddrCount = TblPtr->AddrCount; - PktPtr->Rate = TblPtr->Rate; + PktPtr->Payload.TableId = TableIndex + 1; + PktPtr->Payload.AddrCount = TblPtr->AddrCount; + PktPtr->Payload.Rate = TblPtr->Rate; #if MD_SIGNATURE_OPTION == 1 - strncpy(PktPtr->Signature, TblPtr->Signature, MD_SIGNATURE_FIELD_LENGTH - 1); + strncpy(PktPtr->Payload.Signature, TblPtr->Signature, MD_SIGNATURE_FIELD_LENGTH - 1); /* Make sure string is null-terminated. */ - PktPtr->Signature[MD_SIGNATURE_FIELD_LENGTH - 1] = '\0'; + PktPtr->Payload.Signature[MD_SIGNATURE_FIELD_LENGTH - 1] = '\0'; #endif - PktPtr->ByteCount = TblPtr->DataSize; + PktPtr->Payload.ByteCount = TblPtr->DataSize; /* ** Set packet length in header. diff --git a/unit-test/md_app_tests.c b/unit-test/md_app_tests.c index b3d5a2c..4290903 100644 --- a/unit-test/md_app_tests.c +++ b/unit-test/md_app_tests.c @@ -609,11 +609,11 @@ void MD_InitSoftwareBusServices_Test_Nominal(void) /* Verify results */ #if MD_SIGNATURE_OPTION == 1 - UtAssert_True(MD_AppData.MD_DwellPkt[0].Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == ''"); #endif UtAssert_True(Result == CFE_SUCCESS, "Result == CFE_SUCCESS"); @@ -640,11 +640,11 @@ void MD_InitSoftwareBusServices_Test_CreatePipeError(void) /* Verify results */ #if MD_SIGNATURE_OPTION == 1 - UtAssert_True(MD_AppData.MD_DwellPkt[0].Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == ''"); #endif UtAssert_True(Result == -1, "Result == -1"); @@ -678,11 +678,11 @@ void MD_InitSoftwareBusServices_Test_SubscribeHkError(void) /* Verify results */ #if MD_SIGNATURE_OPTION == 1 - UtAssert_True(MD_AppData.MD_DwellPkt[0].Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == ''"); #endif UtAssert_True(Result == -1, "Result == -1"); @@ -716,11 +716,11 @@ void MD_InitSoftwareBusServices_Test_SubscribeCmdError(void) /* Verify results */ #if MD_SIGNATURE_OPTION == 1 - UtAssert_True(MD_AppData.MD_DwellPkt[0].Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == ''"); #endif UtAssert_True(Result == -1, "Result == -1"); @@ -755,11 +755,11 @@ void MD_InitSoftwareBusServices_Test_SubscribeWakeupError(void) /* Verify results */ #if MD_SIGNATURE_OPTION == 1 - UtAssert_True(MD_AppData.MD_DwellPkt[0].Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Signature[0] == ''"); - UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == '\0', - "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == '\0', "MD_AppData.MD_DwellPkt[0].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES / 2].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES/2].Payload.Signature[0] == ''"); + UtAssert_True(MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == '\0', + "MD_AppData.MD_DwellPkt[MD_NUM_DWELL_TABLES - 1].Payload.Signature[0] == ''"); #endif UtAssert_True(Result == -1, "Result == -1"); @@ -1713,43 +1713,43 @@ void MD_HkStatus_Test(void) MD_HkStatus(); /* Verify results */ - UtAssert_True(MD_AppData.HkPkt.ValidCmdCntr == 1, "MD_AppData.HkPkt.ValidCmdCntr == 1"); - UtAssert_True(MD_AppData.HkPkt.InvalidCmdCntr == 2, "MD_AppData.HkPkt.InvalidCmdCntr == 2"); - - UtAssert_True(MD_AppData.HkPkt.DwellTblAddrCount[0] == 1, "MD_AppData.HkPkt.DwellTblAddrCount[0] == 1"); - UtAssert_True(MD_AppData.HkPkt.NumWaitsPerPkt[0] == 2, "MD_AppData.HkPkt.NumWaitsPerPkt[0] == 2"); - UtAssert_True(MD_AppData.HkPkt.DwellPktOffset[0] == 3, "MD_AppData.HkPkt.DwellPktOffset[0] == 3"); - UtAssert_True(MD_AppData.HkPkt.ByteCount[0] == 4, "MD_AppData.HkPkt.ByteCount[0] == 4"); - UtAssert_True(MD_AppData.HkPkt.DwellTblEntry[0] == 5, "MD_AppData.HkPkt.DwellTblEntry[0] == 5"); - UtAssert_True(MD_AppData.HkPkt.Countdown[0] == 6, "MD_AppData.HkPkt.Countdown[0] == 6"); - - UtAssert_True(MD_AppData.HkPkt.DwellTblAddrCount[MD_NUM_DWELL_TABLES / 2] == 7, - "MD_AppData.HkPkt.DwellTblAddrCount[MD_NUM_DWELL_TABLES / 2] == 7"); - UtAssert_True(MD_AppData.HkPkt.NumWaitsPerPkt[MD_NUM_DWELL_TABLES / 2] == 8, - "MD_AppData.HkPkt.NumWaitsPerPkt[MD_NUM_DWELL_TABLES / 2] == 8"); - UtAssert_True(MD_AppData.HkPkt.DwellPktOffset[MD_NUM_DWELL_TABLES / 2] == 9, - "MD_AppData.HkPkt.DwellPktOffset[MD_NUM_DWELL_TABLES / 2] == 9"); - UtAssert_True(MD_AppData.HkPkt.ByteCount[MD_NUM_DWELL_TABLES / 2] == 10, - "MD_AppData.HkPkt.ByteCount[MD_NUM_DWELL_TABLES / 2] == 10"); - UtAssert_True(MD_AppData.HkPkt.DwellTblEntry[MD_NUM_DWELL_TABLES / 2] == 11, - "MD_AppData.HkPkt.DwellTblEntry[MD_NUM_DWELL_TABLES / 2] == 11"); - UtAssert_True(MD_AppData.HkPkt.Countdown[MD_NUM_DWELL_TABLES / 2] == 12, - "MD_AppData.HkPkt.Countdown[MD_NUM_DWELL_TABLES / 2] == 12"); - - UtAssert_True(MD_AppData.HkPkt.DwellTblAddrCount[MD_NUM_DWELL_TABLES - 1] == 13, - "MD_AppData.HkPkt.DwellTblAddrCount[MD_NUM_DWELL_TABLES - 1] == 13"); - UtAssert_True(MD_AppData.HkPkt.NumWaitsPerPkt[MD_NUM_DWELL_TABLES - 1] == 14, - "MD_AppData.HkPkt.NumWaitsPerPkt[MD_NUM_DWELL_TABLES - 1] == 14"); - UtAssert_True(MD_AppData.HkPkt.DwellPktOffset[MD_NUM_DWELL_TABLES - 1] == 15, - "MD_AppData.HkPkt.DwellPktOffset[MD_NUM_DWELL_TABLES - 1] == 15"); - UtAssert_True(MD_AppData.HkPkt.ByteCount[MD_NUM_DWELL_TABLES - 1] == 16, - "MD_AppData.HkPkt.ByteCount[MD_NUM_DWELL_TABLES - 1] == 16"); - UtAssert_True(MD_AppData.HkPkt.DwellTblEntry[MD_NUM_DWELL_TABLES - 1] == 17, - "MD_AppData.HkPkt.DwellTblEntry[MD_NUM_DWELL_TABLES - 1] == 17"); - UtAssert_True(MD_AppData.HkPkt.Countdown[MD_NUM_DWELL_TABLES - 1] == 18, - "MD_AppData.HkPkt.Countdown[MD_NUM_DWELL_TABLES - 1] == 18"); - - UtAssert_True(MD_AppData.HkPkt.DwellEnabledMask == 1, "MD_AppData.HkPkt.DwellEnabledMask == 1"); + UtAssert_True(MD_AppData.HkPkt.Payload.ValidCmdCntr == 1, "MD_AppData.HkPkt.Payload.ValidCmdCntr == 1"); + UtAssert_True(MD_AppData.HkPkt.Payload.InvalidCmdCntr == 2, "MD_AppData.HkPkt.Payload.InvalidCmdCntr == 2"); + + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblAddrCount[0] == 1, "MD_AppData.HkPkt.Payload.DwellTblAddrCount[0] == 1"); + UtAssert_True(MD_AppData.HkPkt.Payload.NumWaitsPerPkt[0] == 2, "MD_AppData.HkPkt.Payload.NumWaitsPerPkt[0] == 2"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellPktOffset[0] == 3, "MD_AppData.HkPkt.Payload.DwellPktOffset[0] == 3"); + UtAssert_True(MD_AppData.HkPkt.Payload.ByteCount[0] == 4, "MD_AppData.HkPkt.Payload.ByteCount[0] == 4"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblEntry[0] == 5, "MD_AppData.HkPkt.Payload.DwellTblEntry[0] == 5"); + UtAssert_True(MD_AppData.HkPkt.Payload.Countdown[0] == 6, "MD_AppData.HkPkt.Payload.Countdown[0] == 6"); + + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblAddrCount[MD_NUM_DWELL_TABLES / 2] == 7, + "MD_AppData.HkPkt.Payload.DwellTblAddrCount[MD_NUM_DWELL_TABLES / 2] == 7"); + UtAssert_True(MD_AppData.HkPkt.Payload.NumWaitsPerPkt[MD_NUM_DWELL_TABLES / 2] == 8, + "MD_AppData.HkPkt.Payload.NumWaitsPerPkt[MD_NUM_DWELL_TABLES / 2] == 8"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellPktOffset[MD_NUM_DWELL_TABLES / 2] == 9, + "MD_AppData.HkPkt.Payload.DwellPktOffset[MD_NUM_DWELL_TABLES / 2] == 9"); + UtAssert_True(MD_AppData.HkPkt.Payload.ByteCount[MD_NUM_DWELL_TABLES / 2] == 10, + "MD_AppData.HkPkt.Payload.ByteCount[MD_NUM_DWELL_TABLES / 2] == 10"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblEntry[MD_NUM_DWELL_TABLES / 2] == 11, + "MD_AppData.HkPkt.Payload.DwellTblEntry[MD_NUM_DWELL_TABLES / 2] == 11"); + UtAssert_True(MD_AppData.HkPkt.Payload.Countdown[MD_NUM_DWELL_TABLES / 2] == 12, + "MD_AppData.HkPkt.Payload.Countdown[MD_NUM_DWELL_TABLES / 2] == 12"); + + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblAddrCount[MD_NUM_DWELL_TABLES - 1] == 13, + "MD_AppData.HkPkt.Payload.DwellTblAddrCount[MD_NUM_DWELL_TABLES - 1] == 13"); + UtAssert_True(MD_AppData.HkPkt.Payload.NumWaitsPerPkt[MD_NUM_DWELL_TABLES - 1] == 14, + "MD_AppData.HkPkt.Payload.NumWaitsPerPkt[MD_NUM_DWELL_TABLES - 1] == 14"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellPktOffset[MD_NUM_DWELL_TABLES - 1] == 15, + "MD_AppData.HkPkt.Payload.DwellPktOffset[MD_NUM_DWELL_TABLES - 1] == 15"); + UtAssert_True(MD_AppData.HkPkt.Payload.ByteCount[MD_NUM_DWELL_TABLES - 1] == 16, + "MD_AppData.HkPkt.Payload.ByteCount[MD_NUM_DWELL_TABLES - 1] == 16"); + UtAssert_True(MD_AppData.HkPkt.Payload.DwellTblEntry[MD_NUM_DWELL_TABLES - 1] == 17, + "MD_AppData.HkPkt.Payload.DwellTblEntry[MD_NUM_DWELL_TABLES - 1] == 17"); + UtAssert_True(MD_AppData.HkPkt.Payload.Countdown[MD_NUM_DWELL_TABLES - 1] == 18, + "MD_AppData.HkPkt.Payload.Countdown[MD_NUM_DWELL_TABLES - 1] == 18"); + + UtAssert_True(MD_AppData.HkPkt.Payload.DwellEnabledMask == 1, "MD_AppData.HkPkt.Payload.DwellEnabledMask == 1"); call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent)); diff --git a/unit-test/md_cmds_tests.c b/unit-test/md_cmds_tests.c index 7771eab..aae259a 100644 --- a/unit-test/md_cmds_tests.c +++ b/unit-test/md_cmds_tests.c @@ -95,7 +95,7 @@ void MD_ProcessStartCmd_Test_ZeroRate(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 1; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 1; MD_AppData.MD_DwellTables[0].Rate = 0; @@ -154,7 +154,7 @@ void MD_ProcessStartCmd_Test_Success(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 1; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 1; MD_AppData.MD_DwellTables[0].Rate = 1; @@ -204,7 +204,7 @@ void MD_ProcessStartCmd_Test_EmptyTableMask(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 0; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 0; /* Execute the function being tested */ MD_ProcessStartCmd(&UT_CmdBuf.Buf); @@ -237,7 +237,7 @@ void MD_ProcessStartCmd_Test_NoUpdateTableEnabledField(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 1; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 1; MD_AppData.MD_DwellTables[0].Rate = 1; /* Prevents segmentation fault in call to subfunction MD_UpdateTableEnabledField */ @@ -281,7 +281,7 @@ void MD_ProcessStopCmd_Test_Success(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 1; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 1; /* Prevents segmentation fault in call to subfunction MD_UpdateTableEnabledField */ UT_SetHookFunction(UT_KEY(CFE_TBL_GetAddress), &MD_CMDS_TEST_CFE_TBL_GetAddressHook, NULL); @@ -329,7 +329,7 @@ void MD_ProcessStopCmd_Test_EmptyTableMask(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 0; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 0; /* Execute the function being tested */ MD_ProcessStopCmd(&UT_CmdBuf.Buf); @@ -362,7 +362,7 @@ void MD_ProcessStopCmd_Test_NoUpdateTableEnabledField(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdStartStop.TableMask = 1; + UT_CmdBuf.CmdStartStop.Payload.TableMask = 1; /* Prevents segmentation fault in call to subfunction MD_UpdateTableEnabledField */ UT_SetHookFunction(UT_KEY(CFE_TBL_GetAddress), &MD_CMDS_TEST_CFE_TBL_GetAddressHook, NULL); @@ -411,8 +411,8 @@ void MD_ProcessJamCmd_Test_InvalidJamTable(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 99; - UT_CmdBuf.CmdJam.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.TableId = 99; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; /* Execute the function being tested */ MD_ProcessJamCmd(&UT_CmdBuf.Buf); @@ -445,8 +445,8 @@ void MD_ProcessJamCmd_Test_InvalidEntryArg(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 99; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 99; UT_SetDeferredRetcode(UT_KEY(MD_ValidTableId), 1, true); @@ -484,9 +484,9 @@ void MD_ProcessJamCmd_Test_SuccessNullZeroRate(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 0; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 0; MD_AppData.MD_DwellTables[0].Rate = 1; MD_AppData.MD_DwellTables[0].Enabled = MD_DWELL_STREAM_ENABLED; @@ -547,9 +547,9 @@ void MD_ProcessJamCmd_Test_NullTableDwell(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 0; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 0; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == true" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -595,9 +595,9 @@ void MD_ProcessJamCmd_Test_NoUpdateTableDwell(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == true" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -644,11 +644,11 @@ void MD_ProcessJamCmd_Test_CantResolveJamAddr(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 1; - strncpy(UT_CmdBuf.CmdJam.DwellAddress.SymName, "address", sizeof(UT_CmdBuf.CmdJam.DwellAddress.SymName) - 1); + strncpy(UT_CmdBuf.CmdJam.Payload.DwellAddress.SymName, "address", sizeof(UT_CmdBuf.CmdJam.Payload.DwellAddress.SymName) - 1); /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == FALSE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, false); @@ -687,9 +687,9 @@ void MD_ProcessJamCmd_Test_InvalidLenArg(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -729,9 +729,9 @@ void MD_ProcessJamCmd_Test_InvalidJamAddr(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -773,10 +773,10 @@ void MD_ProcessJamCmd_Test_JamAddrNot16BitFieldLength4(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 4; - UT_CmdBuf.CmdJam.DwellAddress.Offset = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 4; + UT_CmdBuf.CmdJam.Payload.DwellAddress.Offset = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -819,10 +819,10 @@ void MD_ProcessJamCmd_Test_JamAddrNot32Bit(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 4; - UT_CmdBuf.CmdJam.DwellAddress.Offset = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 4; + UT_CmdBuf.CmdJam.Payload.DwellAddress.Offset = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -864,10 +864,10 @@ void MD_ProcessJamCmd_Test_JamAddrNot16BitFieldLength2(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 2; - UT_CmdBuf.CmdJam.DwellAddress.Offset = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 2; + UT_CmdBuf.CmdJam.Payload.DwellAddress.Offset = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -908,10 +908,10 @@ void MD_ProcessJamCmd_Test_JamAddrNot16BitNot32Aligned(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 4; - UT_CmdBuf.CmdJam.DwellAddress.Offset = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 4; + UT_CmdBuf.CmdJam.Payload.DwellAddress.Offset = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -952,10 +952,10 @@ void MD_ProcessJamCmd_Test_JamFieldLength4Addr32Aligned(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 4; - UT_CmdBuf.CmdJam.DwellAddress.Offset = 1; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 4; + UT_CmdBuf.CmdJam.Payload.DwellAddress.Offset = 1; /* Set to satisfy condition "MD_ResolveSymAddr(&Jam->DwellAddress,&ResolvedAddr) == TRUE" */ UT_SetDeferredRetcode(UT_KEY(MD_ResolveSymAddr), 1, true); @@ -999,10 +999,10 @@ void MD_ProcessJamCmd_Test_SuccessNonNullZeroRate(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 2; - UT_CmdBuf.CmdJam.DwellDelay = 3; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 2; + UT_CmdBuf.CmdJam.Payload.DwellDelay = 3; MD_AppData.MD_DwellTables[0].Entry[1].Delay = 1; @@ -1063,10 +1063,10 @@ void MD_ProcessJamCmd_Test_SuccessZeroRateStreamDisabled(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 2; - UT_CmdBuf.CmdJam.DwellDelay = 3; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 2; + UT_CmdBuf.CmdJam.Payload.DwellDelay = 3; MD_AppData.MD_DwellTables[0].Entry[1].Delay = 1; @@ -1116,10 +1116,10 @@ void MD_ProcessJamCmd_Test_SuccessRateNotZero(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdJam.TableId = 1; - UT_CmdBuf.CmdJam.EntryId = 2; - UT_CmdBuf.CmdJam.FieldLength = 2; - UT_CmdBuf.CmdJam.DwellDelay = 3; + UT_CmdBuf.CmdJam.Payload.TableId = 1; + UT_CmdBuf.CmdJam.Payload.EntryId = 2; + UT_CmdBuf.CmdJam.Payload.FieldLength = 2; + UT_CmdBuf.CmdJam.Payload.DwellDelay = 3; MD_AppData.MD_DwellTables[0].Entry[1].Delay = 1; @@ -1174,9 +1174,9 @@ void MD_ProcessSignatureCmd_Test_InvalidSignatureLength(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - for (i = 0; i < sizeof(UT_CmdBuf.CmdSetSignature.Signature); i++) + for (i = 0; i < sizeof(UT_CmdBuf.CmdSetSignature.Payload.Signature); i++) { - UT_CmdBuf.CmdSetSignature.Signature[i] = 'x'; + UT_CmdBuf.CmdSetSignature.Payload.Signature[i] = 'x'; } /* Execute the function being tested */ @@ -1212,7 +1212,7 @@ void MD_ProcessSignatureCmd_Test_InvalidSignatureTable(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdSetSignature.TableId = 0; + UT_CmdBuf.CmdSetSignature.Payload.TableId = 0; /* Execute the function being tested */ MD_ProcessSignatureCmd(&UT_CmdBuf.Buf); @@ -1247,8 +1247,8 @@ void MD_ProcessSignatureCmd_Test_Success(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdSetSignature.TableId = 1; - strncpy(UT_CmdBuf.CmdSetSignature.Signature, "signature", sizeof(UT_CmdBuf.CmdSetSignature.Signature) - 1); + UT_CmdBuf.CmdSetSignature.Payload.TableId = 1; + strncpy(UT_CmdBuf.CmdSetSignature.Payload.Signature, "signature", sizeof(UT_CmdBuf.CmdSetSignature.Payload.Signature) - 1); /* Prevents segmentation fault in call to subfunction MD_UpdateTableSignature */ UT_SetHookFunction(UT_KEY(CFE_TBL_GetAddress), &MD_CMDS_TEST_CFE_TBL_GetAddressHook, NULL); @@ -1291,8 +1291,8 @@ void MD_ProcessSignatureCmd_Test_NoUpdateTableSignature(void) TestMsgId = CFE_SB_ValueToMsgId(MD_CMD_MID); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); - UT_CmdBuf.CmdSetSignature.TableId = 1; - strncpy(UT_CmdBuf.CmdSetSignature.Signature, "signature", sizeof(UT_CmdBuf.CmdSetSignature.Signature) - 1); + UT_CmdBuf.CmdSetSignature.Payload.TableId = 1; + strncpy(UT_CmdBuf.CmdSetSignature.Payload.Signature, "signature", sizeof(UT_CmdBuf.CmdSetSignature.Payload.Signature) - 1); /* Prevents segmentation fault in call to subfunction MD_UpdateTableSignature */ UT_SetHookFunction(UT_KEY(CFE_TBL_GetAddress), &MD_CMDS_TEST_CFE_TBL_GetAddressHook, NULL); diff --git a/unit-test/md_dwell_pkt_tests.c b/unit-test/md_dwell_pkt_tests.c index 48be95b..81bcf0d 100644 --- a/unit-test/md_dwell_pkt_tests.c +++ b/unit-test/md_dwell_pkt_tests.c @@ -508,18 +508,18 @@ void MD_SendDwellPkt_Test(void) MD_SendDwellPkt(TableIndex); /* Verify results */ - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].TableId == 2, "MD_AppData.MD_DwellPkt[TableIndex].TableId == 2"); - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].AddrCount == 3, - "MD_AppData.MD_DwellPkt[TableIndex].AddrCount == 3"); - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Rate == 4, "MD_AppData.MD_DwellPkt[TableIndex].Rate == 4"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.TableId == 2, "MD_AppData.MD_DwellPkt[TableIndex].Payload.TableId == 2"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.AddrCount == 3, + "MD_AppData.MD_DwellPkt[TableIndex].Payload.AddrCount == 3"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.Rate == 4, "MD_AppData.MD_DwellPkt[TableIndex].Payload.Rate == 4"); #if MD_SIGNATURE_OPTION == 1 UtAssert_True( strncmp(MD_AppData.MD_DwellTables[TableIndex].Signature, "signature", MD_SIGNATURE_FIELD_LENGTH - 1) == 0, - "MD_AppData.MD_DwellTables[TableIndex].Signature, 'signature', MD_SIGNATURE_FIELD_LENGTH - 1) == 0"); + "MD_AppData.MD_DwellTables[TableIndex].Payload.Signature, 'signature', MD_SIGNATURE_FIELD_LENGTH - 1) == 0"); UtAssert_True(MD_AppData.MD_DwellTables[TableIndex].Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == '\0', - "MD_AppData.MD_DwellTables[TableIndex].Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == ''"); + "MD_AppData.MD_DwellTables[TableIndex].Payload.Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == ''"); #endif UtAssert_True(MD_AppData.MD_DwellTables[TableIndex].DataSize == 5, @@ -546,18 +546,18 @@ void MD_NoDwellRate_Test(void) MD_SendDwellPkt(TableIndex); /* Verify results */ - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].TableId == 2, "MD_AppData.MD_DwellPkt[TableIndex].TableId == 2"); - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].AddrCount == 3, - "MD_AppData.MD_DwellPkt[TableIndex].AddrCount == 3"); - UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Rate == 0, "MD_AppData.MD_DwellPkt[TableIndex].Rate == 0"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.TableId == 2, "MD_AppData.MD_DwellPkt[TableIndex].Payload.TableId == 2"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.AddrCount == 3, + "MD_AppData.MD_DwellPkt[TableIndex].Payload.AddrCount == 3"); + UtAssert_True(MD_AppData.MD_DwellPkt[TableIndex].Payload.Rate == 0, "MD_AppData.MD_DwellPkt[TableIndex].Payload.Rate == 0"); #if MD_SIGNATURE_OPTION == 1 UtAssert_True( strncmp(MD_AppData.MD_DwellTables[TableIndex].Signature, "signature", MD_SIGNATURE_FIELD_LENGTH - 1) == 0, - "MD_AppData.MD_DwellTables[TableIndex].Signature, 'signature', MD_SIGNATURE_FIELD_LENGTH - 1) == 0"); + "MD_AppData.MD_DwellTables[TableIndex].Payload.Signature, 'signature', MD_SIGNATURE_FIELD_LENGTH - 1) == 0"); UtAssert_True(MD_AppData.MD_DwellTables[TableIndex].Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == '\0', - "MD_AppData.MD_DwellTables[TableIndex].Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == ''"); + "MD_AppData.MD_DwellTables[TableIndex].Payload.Signature[MD_SIGNATURE_FIELD_LENGTH - 1] == ''"); #endif UtAssert_True(MD_AppData.MD_DwellTables[TableIndex].DataSize == 5,