From 573cdcac743324f58fd2d4a026106ae05511e6c5 Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 11 Jul 2023 14:41:13 -0400 Subject: [PATCH] Fix #394, revert merge of PR #383. This reverts commit 4e97d3b9076c2d785ca6020cd35cd508fd5b2d46, reversing changes made to 913b5fcc76d76fe8d1596c96bbed9ff7a8944c59. --- fsw/inc/cf_msg.h | 108 +++-- fsw/src/cf_app.c | 8 +- fsw/src/cf_app.h | 2 +- fsw/src/cf_cfdp.c | 34 +- fsw/src/cf_cfdp_dispatch.c | 6 +- fsw/src/cf_cfdp_r.c | 36 +- fsw/src/cf_cfdp_s.c | 25 +- fsw/src/cf_cfdp_sbintf.c | 8 +- fsw/src/cf_cmd.c | 141 +++--- fsw/src/cf_utils.h | 18 +- unit-test/cf_app_tests.c | 4 +- unit-test/cf_cfdp_dispatch_tests.c | 6 +- unit-test/cf_cfdp_r_tests.c | 34 +- unit-test/cf_cfdp_s_tests.c | 48 +- unit-test/cf_cfdp_sbintf_tests.c | 25 +- unit-test/cf_cfdp_tests.c | 26 +- unit-test/cf_cmd_tests.c | 697 ++++++++++++++--------------- unit-test/cf_utils_tests.c | 28 +- 18 files changed, 630 insertions(+), 624 deletions(-) diff --git a/fsw/inc/cf_msg.h b/fsw/inc/cf_msg.h index 4c5ab8e7..27587c51 100644 --- a/fsw/inc/cf_msg.h +++ b/fsw/inc/cf_msg.h @@ -40,6 +40,15 @@ * \{ */ +/** + * \brief Housekeeping command counters + */ +typedef struct CF_HkCmdCounters +{ + uint16 cmd; /**< \brief Command success counter */ + uint16 err; /**< \brief Command error counter */ +} CF_HkCmdCounters_t; + /** * \brief Housekeeping sent counters */ @@ -113,10 +122,9 @@ typedef struct CF_HkChannel_Data */ typedef struct CF_HkPacket { - CFE_MSG_TelemetryHeader_t tlm_header; /**< \brief Telemetry header */ - uint8 CommandCounter; /**< \brief Command success counter */ - uint8 CommandErrorCounter; /**< \brief Command error counter */ - uint8 spare[6]; /**< \brief Alignment spare */ + CFE_MSG_TelemetryHeader_t tlm_header; /**< \brief Telemetry header */ + CF_HkCmdCounters_t counters; /**< \brief Command counters */ + uint8 spare[4]; /**< \brief Alignment spare (CF_HkCmdCounters_t is 4 bytes) */ CF_HkChannel_Data_t channel_hk[CF_NUM_CHANNELS]; /**< \brief Per channel housekeeping data */ } CF_HkPacket_t; @@ -171,7 +179,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_NOOP * * \par Error Conditions @@ -179,7 +187,7 @@ typedef enum * - Command packet length not as expected, #CF_EID_ERR_CMD_GCMD_LEN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -203,7 +211,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_RESET * * \par Error Conditions @@ -212,7 +220,7 @@ typedef enum * - Invalid counter type, #CF_EID_ERR_CMD_RESET_INVALID * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -231,7 +239,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_TX_FILE * * \par Error Conditions @@ -241,7 +249,7 @@ typedef enum * - Transaction initialization failure, #CF_EID_ERR_CMD_TX_FILE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -263,7 +271,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_PLAYBACK_DIR * * \par Error Conditions @@ -273,7 +281,7 @@ typedef enum * - Playback initialization failure, #CF_EID_ERR_CMD_PLAYBACK_DIR * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -298,7 +306,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_FREEZE * * \par Error Conditions @@ -308,7 +316,7 @@ typedef enum * - Command processing failure, #CF_EID_ERR_CMD_FREEZE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -332,7 +340,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_THAW * * \par Error Conditions @@ -342,7 +350,7 @@ typedef enum * - Command processing failure, #CF_EID_ERR_CMD_THAW * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -366,7 +374,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_SUSPRES * * \par Error Conditions @@ -378,7 +386,7 @@ typedef enum * - No matching transaction, #CF_EID_ERR_CMD_SUSPRES_CHAN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -402,7 +410,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_SUSPRES * * \par Error Conditions @@ -414,7 +422,7 @@ typedef enum * - No matching transaction, #CF_EID_ERR_CMD_SUSPRES_CHAN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -437,7 +445,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_CANCEL * * \par Error Conditions @@ -448,7 +456,7 @@ typedef enum * - No matching transaction, #CF_EID_ERR_CMD_CANCEL_CHAN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -471,7 +479,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_ABANDON * * \par Error Conditions @@ -482,7 +490,7 @@ typedef enum * - No matching transaction, #CF_EID_ERR_CMD_ABANDON_CHAN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -503,7 +511,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_GETSET1 * * \par Error Conditions @@ -514,7 +522,7 @@ typedef enum * - Parameter value failed validation, #CF_EID_ERR_CMD_GETSET_VALIDATE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -535,7 +543,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_GETSET2 * * \par Error Conditions @@ -545,7 +553,7 @@ typedef enum * - Invalid channel number, #CF_EID_ERR_CMD_GETSET_CHAN * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -566,7 +574,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_WQ * * \par Error Conditions @@ -581,7 +589,7 @@ typedef enum * - Write TX history data failed, #CF_EID_ERR_CMD_WQ_WRITEHIST_TX * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -604,7 +612,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_ENABLE_DEQUEUE * * \par Error Conditions @@ -614,7 +622,7 @@ typedef enum * - Enable dequeue failed, #CF_EID_ERR_CMD_ENABLE_DEQUEUE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -637,7 +645,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_DISABLE_DEQUEUE * * \par Error Conditions @@ -647,7 +655,7 @@ typedef enum * - Disable dequeue failed, #CF_EID_INF_CMD_DISABLE_DEQUEUE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -676,7 +684,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_ENABLE_POLLDIR * * \par Error Conditions @@ -687,7 +695,7 @@ typedef enum * - Enable directory polling failed, #CF_EID_ERR_CMD_ENABLE_POLLDIR * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -716,7 +724,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_DISABLE_POLLDIR * * \par Error Conditions @@ -727,7 +735,7 @@ typedef enum * - Disable directory polling failed, #CF_EID_ERR_CMD_DISABLE_POLLDIR * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -757,7 +765,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_PURGE_QUEUE * * \par Error Conditions @@ -768,7 +776,7 @@ typedef enum * - Purge queue failed, #CF_EID_ERR_CMD_PURGE_QUEUE * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -790,7 +798,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_ENABLE_ENGINE * * \par Error Conditions @@ -800,7 +808,7 @@ typedef enum * - Engine already enabled, #CF_EID_ERR_CMD_ENG_ALREADY_ENA * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -823,7 +831,7 @@ typedef enum * \par Command Verification * Successful execution of this command may be verified with * the following telemetry: - * - #CF_HkPacket_t.CommandCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.cmd will increment * - #CF_EID_INF_CMD_DISABLE_ENGINE * * \par Error Conditions @@ -832,7 +840,7 @@ typedef enum * - Engine already disabled, #CF_EID_ERR_CMD_ENG_ALREADY_DIS * * \par Evidence of failure may be found in the following telemetry: - * - #CF_HkPacket_t.CommandErrorCounter will increment + * - #CF_HkPacket_t.counters #CF_HkCmdCounters_t.err will increment * * \par Criticality * None @@ -862,6 +870,16 @@ typedef struct CF_NoArgsCmd CFE_MSG_CommandHeader_t cmd_header; /**< \brief Command header */ } CF_NoArgsCmd_t; +/** + * \brief Command payload argument union to support 4 uint8's, 2 uint16's or 1 uint32 + */ +typedef union CF_UnionArgs_Payload +{ + uint32 dword; /**< \brief Generic uint32 argument */ + uint16 hword[2]; /**< \brief Generic uint16 array of arguments */ + uint8 byte[4]; /**< \brief Generic uint8 array of arguments */ +} CF_UnionArgs_Payload_t; + /** * \brief Generic command structure with arguments supports common handling on multiple command types * @@ -871,7 +889,7 @@ typedef struct CF_NoArgsCmd typedef struct { CFE_MSG_CommandHeader_t cmd_header; /**< \brief Command header */ - uint8 byte[4]; /**< \brief Generic uint8 array of arguments */ + CF_UnionArgs_Payload_t data; /**< \brief Generic command arguments */ } CF_UnionArgsCmd_t; /** diff --git a/fsw/src/cf_app.c b/fsw/src/cf_app.c index 70bc0262..919d8597 100644 --- a/fsw/src/cf_app.c +++ b/fsw/src/cf_app.c @@ -46,8 +46,8 @@ CF_AppData_t CF_AppData; *-----------------------------------------------------------------*/ void CF_HkCmd(void) { - CFE_MSG_SetMsgTime(&CF_AppData.HkPacket.tlm_header.Msg, CFE_TIME_GetTime()); - /* return value ignored */ CFE_SB_TransmitMsg(&CF_AppData.HkPacket.tlm_header.Msg, true); + CFE_MSG_SetMsgTime(&CF_AppData.hk.tlm_header.Msg, CFE_TIME_GetTime()); + /* return value ignored */ CFE_SB_TransmitMsg(&CF_AppData.hk.tlm_header.Msg, true); } /*---------------------------------------------------------------- @@ -205,7 +205,7 @@ CFE_Status_t CF_Init(void) CF_AppData.run_status = CFE_ES_RunStatus_APP_RUN; - CFE_MSG_Init(&CF_AppData.HkPacket.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_HK_TLM_MID), sizeof(CF_AppData.HkPacket)); + CFE_MSG_Init(&CF_AppData.hk.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_HK_TLM_MID), sizeof(CF_AppData.hk)); status = CFE_EVS_Register(NULL, 0, CFE_EVS_EventFilter_BINARY); if (status != CFE_SUCCESS) @@ -301,7 +301,7 @@ void CF_ProcessMsg(CFE_SB_Buffer_t *msg) break; default: - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; CFE_EVS_SendEvent(CF_EID_ERR_INIT_CMD_LENGTH, CFE_EVS_EventType_ERROR, "CF: invalid command packet id=0x%lx", (unsigned long)CFE_SB_MsgIdToValue(msg_id)); break; diff --git a/fsw/src/cf_app.h b/fsw/src/cf_app.h index ee32f553..0830de7e 100644 --- a/fsw/src/cf_app.h +++ b/fsw/src/cf_app.h @@ -77,7 +77,7 @@ */ typedef struct { - CF_HkPacket_t HkPacket; + CF_HkPacket_t hk; uint32 run_status; diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 2d87ec2f..07bcb5dc 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -598,7 +598,7 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_TRUNCATION, CFE_EVS_EventType_ERROR, "CF: PDU rejected due to EID/seq number field truncation"); - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[chan_num].counters.recv.error; ret = CF_ERROR; } /* @@ -611,7 +611,7 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_LARGE_FILE, CFE_EVS_EventType_ERROR, "CF: PDU with large file bit received (unsupported)"); - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[chan_num].counters.recv.error; ret = CF_ERROR; } else @@ -625,13 +625,13 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_SHORT_HEADER, CFE_EVS_EventType_ERROR, "CF: PDU too short (%lu received)", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[chan_num].counters.recv.error; ret = CF_SHORT_PDU_ERROR; } else { /* PDU is ok, so continue processing */ - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.pdu; + ++CF_AppData.hk.channel_hk[chan_num].counters.recv.pdu; } } @@ -656,7 +656,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_MD_SHORT, CFE_EVS_EventType_ERROR, "CF: metadata packet too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else @@ -678,7 +678,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_SRC_LEN, CFE_EVS_EventType_ERROR, "CF: metadata PDU rejected due to invalid length in source filename of 0x%02x", md->source_filename.length); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else @@ -690,7 +690,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_DST_LEN, CFE_EVS_EventType_ERROR, "CF: metadata PDU rejected due to invalid length in dest filename of 0x%02x", md->dest_filename.length); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else @@ -735,7 +735,7 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_SHORT, CFE_EVS_EventType_ERROR, "CF: filedata PDU too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_SHORT_PDU_ERROR; } else if (ph->pdu_header.segment_meta_flag) @@ -744,7 +744,7 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_UNSUPPORTED, CFE_EVS_EventType_ERROR, "CF: filedata PDU with segment metadata received"); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_ERROR; } @@ -850,7 +850,7 @@ CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) *-----------------------------------------------------------------*/ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.dropped; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped; } /*---------------------------------------------------------------- @@ -918,14 +918,14 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_IDLE_MD, CFE_EVS_EventType_ERROR, "CF: got invalid md PDU -- abandoning transaction"); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; /* leave state as idle, which will reset below */ } break; default: CFE_EVS_SendEvent(CF_EID_ERR_CFDP_FD_UNHANDLED, CFE_EVS_EventType_ERROR, "CF: unhandled file directive code 0x%02x in idle state", fdh->directive_code); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; break; } } @@ -1327,7 +1327,7 @@ static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *s { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_OPENDIR, CFE_EVS_EventType_ERROR, "CF: failed to open playback directory %s, error=%ld", src_filename, (long)ret); - ++CF_AppData.HkPacket.channel_hk[chan].counters.fault.directory_read; + ++CF_AppData.hk.channel_hk[chan].counters.fault.directory_read; } else { @@ -1482,7 +1482,7 @@ static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *c) { CF_CFDP_ProcessPlaybackDirectory(c, &c->playback[i]); CF_CFDP_UpdatePollPbCounted(&c->playback[i], c->playback[i].busy, - &CF_AppData.HkPacket.channel_hk[chan_index].playback_counter); + &CF_AppData.hk.channel_hk[chan_index].playback_counter); } } @@ -1551,7 +1551,7 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) count_check = 1; } - CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.HkPacket.channel_hk[chan_index].poll_counter); + CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter); } } @@ -1576,7 +1576,7 @@ void CF_CFDP_CycleEngine(void) /* consume all received messages, even if channel is frozen */ CF_CFDP_ReceiveMessage(c); - if (!CF_AppData.HkPacket.channel_hk[i].frozen) + if (!CF_AppData.hk.channel_hk[i].frozen) { /* handle ticks before tx cycle. Do this because there may be a limited number of TX messages available * this cycle, and it's important to respond to class 2 ACK/NAK more than it is to send new filedata @@ -1829,7 +1829,7 @@ void CF_CFDP_DisableEngine(void) } /* finally all queue counters must be reset */ - memset(&CF_AppData.HkPacket.channel_hk[i].q_size, 0, sizeof(CF_AppData.HkPacket.channel_hk[i].q_size)); + memset(&CF_AppData.hk.channel_hk[i].q_size, 0, sizeof(CF_AppData.hk.channel_hk[i].q_size)); CFE_SB_DeletePipe(c->pipe); } diff --git a/fsw/src/cf_cfdp_dispatch.c b/fsw/src/cf_cfdp_dispatch.c index fa9460ad..085c1019 100644 --- a/fsw/src/cf_cfdp_dispatch.c +++ b/fsw/src/cf_cfdp_dispatch.c @@ -59,7 +59,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } else { - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious; CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_DC_INV, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, @@ -74,7 +74,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } else { - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.dropped; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped; } } @@ -118,7 +118,7 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } else { - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious; CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_DC_INV, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 01534c68..8d037429 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -99,7 +99,7 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)t->crc.result, (unsigned long)expected_crc); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.crc_mismatch; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch; ret = 1; } @@ -156,7 +156,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) "CF R%d(%lu:%lu): NAK limited reach", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); send_fin = 1; - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.nak_limit; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit; /* don't use CF_CFDP_R2_SetFinTxnStatus because many places in this function set send_fin */ CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NAK_LIMIT_REACHED); t->state_data.r.r2.acknak_count = 0; /* reset for fin/ack */ @@ -213,7 +213,7 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)fd->offset, (long)fret); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; ret = CF_ERROR; /* connection will reset in caller */ } } @@ -228,13 +228,13 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)fd->data_len, (long)fret); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_write; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_write; ret = CF_ERROR; /* connection will reset in caller */ } else { t->state_data.r.cached_pos = fd->data_len + fd->offset; - CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.file_data_bytes += fd->data_len; + CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes += fd->data_len; } } @@ -264,7 +264,7 @@ CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer "CF R%d(%lu:%lu): EOF file size mismatch: got %lu expected %lu", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)eof->size, (unsigned long)t->fsize); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_size_mismatch; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; ret = CF_REC_PDU_FSIZE_MISMATCH_ERROR; } } @@ -273,7 +273,7 @@ CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_EOF, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid EOF packet", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; ret = CF_REC_PDU_BAD_EOF_ERROR; } @@ -524,7 +524,7 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) that function we need to test handling it here */ if (sret == CFE_SUCCESS) { - CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.nak_segment_requests += cret; + CF_AppData.hk.channel_hk[t->chan_num].counters.sent.nak_segment_requests += cret; ret = CFE_SUCCESS; } } @@ -593,7 +593,7 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) "CF R%d(%lu:%lu): failed to create file %s for writing, error=%ld", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, t->history->fnames.dst_filename, (long)ret); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ if (t->state == CF_TxnState_R2) { @@ -660,7 +660,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)t->state_data.r.r2.rx_crc_calc_bytes, (long)fret); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; success = false; break; } @@ -674,7 +674,7 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)read_size, (long)fret); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_read; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; success = false; break; } @@ -765,7 +765,7 @@ void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_FINACK, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid fin-ack", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; } } @@ -807,7 +807,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (unsigned long)t->fsize, (unsigned long)t->state_data.r.r2.eof_size); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_size_mismatch; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); success = false; } @@ -831,7 +831,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) (unsigned long)t->history->seq_num, (long)status); t->fd = OS_OBJECT_ID_UNDEFINED; CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_rename; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_rename; success = false; } else @@ -845,7 +845,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)ret); CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ success = false; } @@ -865,7 +865,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_MD, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid md received", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; /* do nothing here, since it will be NAK'd again later */ } } @@ -945,7 +945,7 @@ void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_INACT_TIMER, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): inactivity timer expired", (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.inactivity_timer; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer; } /*---------------------------------------------------------------- @@ -1036,7 +1036,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) "CF R2(%lu:%lu): ACK limit reached, no fin-ack", (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_FIN); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.ack_limit; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; CF_CFDP_R2_Reset(t); success = false; } diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index 2fe6c1fc..f7d3a903 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -171,7 +171,7 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by "CF S%d(%lu:%lu): error seeking to offset %ld, got %ld", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)foffs, (long)status); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; success = false; } } @@ -185,7 +185,7 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by "CF S%d(%lu:%lu): error reading bytes: expected %ld, got %ld", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)actual_bytes, (long)status); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_read; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; success = false; } } @@ -207,7 +207,7 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by } else { - CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes += actual_bytes; + CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes += actual_bytes; CF_Assert((foffs + actual_bytes) <= t->fsize); /* sanity check */ if (calc_crc) @@ -355,7 +355,7 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) "CF S%d(%lu:%lu): file %s already open", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, t->history->fnames.src_filename); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; success = false; } @@ -368,7 +368,7 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) "CF S%d(%lu:%lu): failed to open file %s, error=%ld", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, t->history->fnames.src_filename, (long)ret); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ success = false; } @@ -383,7 +383,7 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) "CF S%d(%lu:%lu): failed to seek end file %s, error=%ld", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, t->history->fnames.src_filename, (long)status); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; success = false; } } @@ -399,7 +399,7 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) "CF S%d(%lu:%lu): failed to seek begin file %s, got %ld", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, t->history->fnames.src_filename, (long)status); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; success = false; } } @@ -528,8 +528,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } } - CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.nak_segment_requests += - nak->segment_list.num_segments; + CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests += nak->segment_list.num_segments; if (bad_sr) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_INVALID_SR, CFE_EVS_EventType_ERROR, @@ -542,7 +541,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_PDU_NAK, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): received invalid NAK PDU", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; } } @@ -585,7 +584,7 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_PDU_EOF, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): received invalid EOF PDU", (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; } } @@ -714,7 +713,7 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) (unsigned long)t->history->seq_num); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_INACTIVITY_DETECTED); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.inactivity_timer; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer; CF_CFDP_S_Reset(t); } else @@ -737,7 +736,7 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) "CF S2(%lu:%lu), ack limit reached, no eof-ack", (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_EOF); - ++CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.ack_limit; + ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; /* no reason to reset this timer, as it isn't used again */ CF_CFDP_S_Reset(t); diff --git a/fsw/src/cf_cfdp_sbintf.c b/fsw/src/cf_cfdp_sbintf.c index 6d33590c..12495c71 100644 --- a/fsw/src/cf_cfdp_sbintf.c +++ b/fsw/src/cf_cfdp_sbintf.c @@ -85,7 +85,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent success = false; } - if (success && !CF_AppData.HkPacket.channel_hk[t->chan_num].frozen && !t->flags.com.suspended) + if (success && !CF_AppData.hk.channel_hk[t->chan_num].frozen && !t->flags.com.suspended) { /* first, check if there's room in the pipe for the message we want to build */ if (OS_ObjectIdDefined(c->sem_id)) @@ -160,7 +160,7 @@ void CF_CFDP_Send(uint8 chan_num, const CF_Logical_PduBuffer_t *ph) CFE_MSG_SetMsgTime(&CF_AppData.engine.out.msg->Msg, CFE_TIME_GetTime()); CFE_SB_TransmitBuffer(CF_AppData.engine.out.msg, true); - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.sent.pdu; + ++CF_AppData.hk.channel_hk[chan_num].counters.sent.pdu; CF_AppData.engine.out.msg = NULL; } @@ -252,7 +252,7 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) } /* NOTE: recv and recv_spurious will both be incremented */ - ++CF_AppData.HkPacket.channel_hk[chan_num].counters.recv.spurious; + ++CF_AppData.hk.channel_hk[chan_num].counters.recv.spurious; } CFE_ES_PerfLogExit(CF_PERF_ID_PDURCVD(chan_num)); @@ -264,7 +264,7 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) if (ph->pdu_header.destination_eid == CF_AppData.config_table->local_eid) { /* we didn't find a match, so assign it to a transaction */ - if (CF_AppData.HkPacket.channel_hk[chan_num].q_size[CF_QueueIdx_RX] == CF_MAX_SIMULTANEOUS_RX) + if (CF_AppData.hk.channel_hk[chan_num].q_size[CF_QueueIdx_RX] == CF_MAX_SIMULTANEOUS_RX) { CFE_EVS_SendEvent( CF_EID_ERR_CFDP_RX_DROPPED, CFE_EVS_EventType_ERROR, diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index da09e0d1..e87b1d72 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -48,7 +48,7 @@ void CF_CmdNoop(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_NOOP, CFE_EVS_EventType_INFORMATION, "CF: No-Op received, Version %d.%d.%d.%d", CF_MAJOR_VERSION, CF_MINOR_VERSION, CF_REVISION, CF_MISSION_REV); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } /*---------------------------------------------------------------- @@ -62,7 +62,7 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) CF_UnionArgsCmd_t *cmd = (CF_UnionArgsCmd_t *)msg; static const char *names[5] = {"all", "cmd", "fault", "up", "down"}; /* 0=all, 1=cmd, 2=fault 3=up 4=down */ - uint8 param = cmd->byte[0]; + uint8 param = cmd->data.byte[0]; int i; int acc = 1; @@ -70,7 +70,7 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_RESET_INVALID, CFE_EVS_EventType_ERROR, "CF: Received RESET COUNTERS command with invalid parameter %d", param); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } else { @@ -81,9 +81,8 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) if ((param == CF_Reset_all) || (param == CF_Reset_command)) { /* command counters */ - CF_AppData.HkPacket.CommandCounter = 0; - CF_AppData.HkPacket.CommandErrorCounter = 0; - acc = 0; /* don't increment accept counter on command counter reset */ + memset(&CF_AppData.hk.counters, 0, sizeof(CF_AppData.hk.counters)); + acc = 0; /* don't increment accept counter on command counter reset */ } /* if the param is CF_Reset_fault, or all counters */ @@ -91,8 +90,8 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) { /* fault counters */ for (i = 0; i < CF_NUM_CHANNELS; ++i) - memset(&CF_AppData.HkPacket.channel_hk[i].counters.fault, 0, - sizeof(CF_AppData.HkPacket.channel_hk[i].counters.fault)); + memset(&CF_AppData.hk.channel_hk[i].counters.fault, 0, + sizeof(CF_AppData.hk.channel_hk[i].counters.fault)); } /* if the param is CF_Reset_up, or all counters */ @@ -100,8 +99,8 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) { /* up counters */ for (i = 0; i < CF_NUM_CHANNELS; ++i) - memset(&CF_AppData.HkPacket.channel_hk[i].counters.recv, 0, - sizeof(CF_AppData.HkPacket.channel_hk[i].counters.recv)); + memset(&CF_AppData.hk.channel_hk[i].counters.recv, 0, + sizeof(CF_AppData.hk.channel_hk[i].counters.recv)); } /* if the param is CF_Reset_down, or all counters */ @@ -109,13 +108,13 @@ void CF_CmdReset(CFE_SB_Buffer_t *msg) { /* down counters */ for (i = 0; i < CF_NUM_CHANNELS; ++i) - memset(&CF_AppData.HkPacket.channel_hk[i].counters.sent, 0, - sizeof(CF_AppData.HkPacket.channel_hk[i].counters.sent)); + memset(&CF_AppData.hk.channel_hk[i].counters.sent, 0, + sizeof(CF_AppData.hk.channel_hk[i].counters.sent)); } if (acc) { - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } } } @@ -141,7 +140,7 @@ void CF_CmdTxFile(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_BAD_PARAM, CFE_EVS_EventType_ERROR, "CF: bad parameter in CF_CmdTxFile(): chan=%u, class=%u keep=%u", (unsigned int)tx->chan_num, (unsigned int)tx->cfdp_class, (unsigned int)tx->keep); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; return; } @@ -154,12 +153,12 @@ void CF_CmdTxFile(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_TX_FILE, CFE_EVS_EventType_INFORMATION, "CF: file transfer successfully initiated"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_TX_FILE, CFE_EVS_EventType_ERROR, "CF: file transfer initiation failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -184,7 +183,7 @@ void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_BAD_PARAM, CFE_EVS_EventType_ERROR, "CF: bad parameter in CF_CmdPlaybackDir(): chan=%u, class=%u keep=%u", (unsigned int)tx->chan_num, (unsigned int)tx->cfdp_class, (unsigned int)tx->keep); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; return; } @@ -197,13 +196,13 @@ void CF_CmdPlaybackDir(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_PLAYBACK_DIR, CFE_EVS_EventType_INFORMATION, "CF: directory playback initiation successful"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_PLAYBACK_DIR, CFE_EVS_EventType_ERROR, "CF: directory playback initiation failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -221,22 +220,22 @@ CFE_Status_t CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_Chan /* this function is generic for any ground command that takes a single channel * argument which must be less than CF_NUM_CHANNELS or 255 which is a special * value that means apply command to all channels */ - if (cmd->byte[0] == CF_ALL_CHANNELS) + if (cmd->data.byte[0] == CF_ALL_CHANNELS) { /* apply to all channels */ for (i = 0; i < CF_NUM_CHANNELS; ++i) ret |= fn(i, context); } - else if (cmd->byte[0] < CF_NUM_CHANNELS) + else if (cmd->data.byte[0] < CF_NUM_CHANNELS) { - ret = fn(cmd->byte[0], context); + ret = fn(cmd->data.byte[0], context); } else { /* bad parameter */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_CHAN_PARAM, CFE_EVS_EventType_ERROR, - "CF: %s: channel parameter out of range. received %d", errstr, cmd->byte[0]); - ret = CF_ERROR; + "CF: %s: channel parameter out of range. received %d", errstr, cmd->data.byte[0]); + ret = -1; } return ret; @@ -251,7 +250,7 @@ CFE_Status_t CF_DoChanAction(CF_UnionArgsCmd_t *cmd, const char *errstr, CF_Chan CFE_Status_t CF_DoFreezeThaw(uint8 chan_num, const CF_ChanAction_BoolArg_t *context) { /* no need to bounds check chan_num, done in caller */ - CF_AppData.HkPacket.channel_hk[chan_num].frozen = context->barg; + CF_AppData.hk.channel_hk[chan_num].frozen = context->barg; return CFE_SUCCESS; } @@ -268,12 +267,12 @@ void CF_CmdFreeze(CFE_SB_Buffer_t *msg) if (CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "freeze", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg) == CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_FREEZE, CFE_EVS_EventType_INFORMATION, "CF: freeze successful"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_FREEZE, CFE_EVS_EventType_ERROR, "CF: freeze cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -290,12 +289,12 @@ void CF_CmdThaw(CFE_SB_Buffer_t *msg) if (CF_DoChanAction((CF_UnionArgsCmd_t *)msg, "thaw", (CF_ChanActionFn_t)CF_DoFreezeThaw, &barg) == CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_THAW, CFE_EVS_EventType_INFORMATION, "CF: thaw successful"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_THAW, CFE_EVS_EventType_ERROR, "CF: thaw cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -417,20 +416,20 @@ void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action) /* A single transaction was mached, and it was already set the same way */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_SUSPRES_SAME, CFE_EVS_EventType_ERROR, "CF: %s cmd: setting suspend flag to current value of %d", msgstr[action], action); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } else if (ret <= 0) { /* No transaction was matched for the given combination of chan + eid + ts */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_SUSPRES_CHAN, CFE_EVS_EventType_ERROR, "CF: %s cmd: no transaction found", msgstr[action]); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } else { CFE_EVS_SendEvent(CF_EID_INF_CMD_SUSPRES, CFE_EVS_EventType_INFORMATION, "CF: %s cmd: setting suspend flag to %d", msgstr[action], action); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } } @@ -479,13 +478,13 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_CANCEL, CFE_EVS_EventType_INFORMATION, "CF: cancel transaction successfully initiated"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { /* No transaction was matched for the given combination of chan + eid + ts */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_CANCEL_CHAN, CFE_EVS_EventType_ERROR, "CF: cancel cmd: no transaction found"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -511,14 +510,14 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) if (CF_TsnChanAction((CF_TransactionCmd_t *)msg, "abandon", CF_CmdAbandon_Txn, NULL) > 0) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ABANDON, CFE_EVS_EventType_INFORMATION, "CF: abandon successful"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { /* No transaction was matched for the given combination of chan + eid + ts */ CFE_EVS_SendEvent(CF_EID_ERR_CMD_ABANDON_CHAN, CFE_EVS_EventType_ERROR, "CF: abandon cmd: no transaction found"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -549,12 +548,12 @@ void CF_CmdEnableDequeue(CFE_SB_Buffer_t *msg) &barg) == CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ENABLE_DEQUEUE, CFE_EVS_EventType_INFORMATION, "CF: dequeue enabled"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_ENABLE_DEQUEUE, CFE_EVS_EventType_ERROR, "CF: enable dequeue cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -572,12 +571,12 @@ void CF_CmdDisableDequeue(CFE_SB_Buffer_t *msg) &barg) == CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_DISABLE_DEQUEUE, CFE_EVS_EventType_INFORMATION, "CF: dequeue disabled"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_DISABLE_DEQUEUE, CFE_EVS_EventType_ERROR, "CF: disable dequeue cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -592,20 +591,20 @@ CFE_Status_t CF_DoEnableDisablePolldir(uint8 chan_num, const CF_ChanAction_BoolM int i; CFE_Status_t ret = CFE_SUCCESS; /* no need to bounds check chan_num, done in caller */ - if (context->msg->byte[1] == CF_ALL_POLLDIRS) + if (context->msg->data.byte[1] == CF_ALL_POLLDIRS) { /* all polldirs in channel */ for (i = 0; i < CF_MAX_POLLING_DIR_PER_CHAN; ++i) CF_AppData.config_table->chan[chan_num].polldir[i].enabled = context->barg; } - else if (context->msg->byte[1] < CF_MAX_POLLING_DIR_PER_CHAN) + else if (context->msg->data.byte[1] < CF_MAX_POLLING_DIR_PER_CHAN) { - CF_AppData.config_table->chan[chan_num].polldir[context->msg->byte[1]].enabled = context->barg; + CF_AppData.config_table->chan[chan_num].polldir[context->msg->data.byte[1]].enabled = context->barg; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_POLLDIR_INVALID, CFE_EVS_EventType_ERROR, - "CF: enable/disable polldir: invalid polldir %d on channel %d", context->msg->byte[1], + "CF: enable/disable polldir: invalid polldir %d on channel %d", context->msg->data.byte[1], chan_num); ret = CF_ERROR; } @@ -628,13 +627,13 @@ void CF_CmdEnablePolldir(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ENABLE_POLLDIR, CFE_EVS_EventType_INFORMATION, "CF: enabled polling directory"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_ENABLE_POLLDIR, CFE_EVS_EventType_ERROR, "CF: enable polling directory cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -653,13 +652,13 @@ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_INF_CMD_DISABLE_POLLDIR, CFE_EVS_EventType_INFORMATION, "CF: disabled polling directory"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_DISABLE_POLLDIR, CFE_EVS_EventType_ERROR, "CF: disable polling directory cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -704,7 +703,7 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) int pend = 0; int hist = 0; - switch (cmd->byte[1]) + switch (cmd->data.byte[1]) { case 0: /* pend */ pend = 1; @@ -721,8 +720,8 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) default: CFE_EVS_SendEvent(CF_EID_ERR_CMD_PURGE_ARG, CFE_EVS_EventType_ERROR, "CF: purge queue invalid arg %d", - cmd->byte[1]); - ret = CF_ERROR; + cmd->data.byte[1]); + ret = -1; break; } @@ -751,12 +750,12 @@ void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg) CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_PURGE_QUEUE, CFE_EVS_EventType_INFORMATION, "CF: queue purged"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_PURGE_QUEUE, CFE_EVS_EventType_ERROR, "CF: purge queue cmd failed"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -778,7 +777,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) if (wq->chan >= CF_NUM_CHANNELS) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_CHAN, CFE_EVS_EventType_ERROR, "CF: write queue invalid channel arg"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } /* only invalid combination is up direction, pending queue */ @@ -786,7 +785,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_ARGS, CFE_EVS_EventType_ERROR, "CF: write queue invalid command parameters"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } else @@ -798,7 +797,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_OPEN, CFE_EVS_EventType_ERROR, "CF: write queue failed to open file %s", wq->filename); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } } @@ -815,7 +814,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_RX, CFE_EVS_EventType_ERROR, "CF: write queue failed to write CF_QueueIdx_RX data"); CF_WrappedClose(fd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } } @@ -828,7 +827,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEHIST_RX, CFE_EVS_EventType_ERROR, "CF: write queue failed to write history RX data"); CF_WrappedClose(fd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } } @@ -850,7 +849,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_TX, CFE_EVS_EventType_ERROR, "CF: write queue failed to write q index %d", qs[i]); CF_WrappedClose(fd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; break; } @@ -866,7 +865,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_PEND, CFE_EVS_EventType_ERROR, "CF: write queue failed to write pending queue"); CF_WrappedClose(fd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } } @@ -880,7 +879,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEHIST_TX, CFE_EVS_EventType_ERROR, "CF: write queue failed to write CF_QueueIdx_TX data"); CF_WrappedClose(fd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; success = false; } } @@ -889,7 +888,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) if (success) { CFE_EVS_SendEvent(CF_EID_INF_CMD_WQ, CFE_EVS_EventType_INFORMATION, "CF: write queue successful"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } } @@ -1075,11 +1074,11 @@ void CF_CmdGetSetParam(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, if (status == CFE_SUCCESS) { - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -1120,20 +1119,20 @@ void CF_CmdEnableEngine(CFE_SB_Buffer_t *msg) if (CF_CFDP_InitEngine() == CFE_SUCCESS) { CFE_EVS_SendEvent(CF_EID_INF_CMD_ENABLE_ENGINE, CFE_EVS_EventType_INFORMATION, "CF: enabled CFDP engine"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_ENABLE_ENGINE, CFE_EVS_EventType_ERROR, "CF: failed to re-initialize and enable CFDP engine"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_ENG_ALREADY_ENA, CFE_EVS_EventType_ERROR, "CF: received enable engine command while engine already enabled"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -1149,13 +1148,13 @@ void CF_CmdDisableEngine(CFE_SB_Buffer_t *msg) { CF_CFDP_DisableEngine(); CFE_EVS_SendEvent(CF_EID_INF_CMD_DISABLE_ENGINE, CFE_EVS_EventType_INFORMATION, "CF: disabled CFDP engine"); - ++CF_AppData.HkPacket.CommandCounter; + ++CF_AppData.hk.counters.cmd; } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_ENG_ALREADY_DIS, CFE_EVS_EventType_ERROR, "CF: received disable engine command while engine already disabled"); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } @@ -1244,13 +1243,13 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg) CFE_EVS_SendEvent(CF_EID_ERR_CMD_GCMD_LEN, CFE_EVS_EventType_ERROR, "CF: invalid ground command length for command 0x%02x, expected %d got %zd", cmd, expected_lengths[cmd], len); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } else { CFE_EVS_SendEvent(CF_EID_ERR_CMD_GCMD_CC, CFE_EVS_EventType_ERROR, "CF: invalid ground command packet cmd_code=0x%02x", cmd); - ++CF_AppData.HkPacket.CommandErrorCounter; + ++CF_AppData.hk.counters.err; } } diff --git a/fsw/src/cf_utils.h b/fsw/src/cf_utils.h index 82bad580..03a3070d 100644 --- a/fsw/src/cf_utils.h +++ b/fsw/src/cf_utils.h @@ -123,39 +123,39 @@ static inline void CF_DequeueTransaction(CF_Transaction_t *t) { CF_Assert(t && (t->chan_num < CF_NUM_CHANNELS)); CF_CList_Remove(&CF_AppData.engine.channels[t->chan_num].qs[t->flags.com.q_index], &t->cl_node); - CF_Assert(CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ - --CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; + CF_Assert(CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ + --CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; } static inline void CF_MoveTransaction(CF_Transaction_t *t, CF_QueueIdx_t q) { CF_Assert(t && (t->chan_num < CF_NUM_CHANNELS)); CF_CList_Remove(&CF_AppData.engine.channels[t->chan_num].qs[t->flags.com.q_index], &t->cl_node); - CF_Assert(CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ - --CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; + CF_Assert(CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ + --CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; CF_CList_InsertBack(&CF_AppData.engine.channels[t->chan_num].qs[q], &t->cl_node); t->flags.com.q_index = q; - ++CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; + ++CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; } static inline void CF_CList_Remove_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *node) { CF_CList_Remove(&c->qs[queueidx], node); - CF_Assert(CF_AppData.HkPacket.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]); /* sanity check */ - --CF_AppData.HkPacket.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + CF_Assert(CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]); /* sanity check */ + --CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; } static inline void CF_CList_InsertAfter_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *start, CF_CListNode_t *after) { CF_CList_InsertAfter(&c->qs[queueidx], start, after); - ++CF_AppData.HkPacket.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + ++CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; } static inline void CF_CList_InsertBack_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *node) { CF_CList_InsertBack(&c->qs[queueidx], node); - ++CF_AppData.HkPacket.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + ++CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; } /************************************************************************/ diff --git a/unit-test/cf_app_tests.c b/unit-test/cf_app_tests.c index 41509757..fd435549 100644 --- a/unit-test/cf_app_tests.c +++ b/unit-test/cf_app_tests.c @@ -575,7 +575,7 @@ void Test_CF_ProcessMsg_UnrecognizedCommandEnterDefaultPath(void) CF_ProcessMsg(arg_msg); /* Assert */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_INIT_CMD_LENGTH); } @@ -689,7 +689,7 @@ void Test_CF_AppMain_RunLoopCallTo_CFE_SB_ReceiveBuffer_Returns_CFE_SUCCESS_AndV /* Assert for CF_Init call and CF_ProcessMsg */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); /* Assert for CF_ProcessMsg */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } /******************************************************************************* diff --git a/unit-test/cf_cfdp_dispatch_tests.c b/unit-test/cf_cfdp_dispatch_tests.c index 2284f28c..3e8416e9 100644 --- a/unit-test/cf_cfdp_dispatch_tests.c +++ b/unit-test/cf_cfdp_dispatch_tests.c @@ -154,7 +154,7 @@ void Test_CF_CFDP_R_DispatchRecv(void) UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_INVALID_MAX; UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_DC_INV); /* file data with error */ @@ -162,7 +162,7 @@ void Test_CF_CFDP_R_DispatchRecv(void) ph->pdu_header.pdu_type = 1; UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.dropped, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped, 1); /* test actual dispatch */ UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -206,7 +206,7 @@ void Test_CF_CFDP_S_DispatchRecv(void) UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_INVALID_MAX; UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(t, ph, &dispatch)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_DC_INV); /* file data PDU, not expected in this type of txn */ diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index 36ec003b..594b373f 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -300,7 +300,7 @@ void Test_CF_CFDP_R_Tick(void) UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.ack_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit, 1); /* in R2 state, ack_timer_armed set, timer expires, not in finack substate */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -376,7 +376,7 @@ void Test_CF_CFDP_R_Init(void) t->state = CF_TxnState_R1; UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CREAT); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* failure of file open, class 2 */ @@ -385,7 +385,7 @@ void Test_CF_CFDP_R_Init(void) t->state = CF_TxnState_R2; UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CREAT); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } @@ -464,7 +464,7 @@ void Test_CF_CFDP_R_CheckCrc(void) t->crc.result = 0xdeadbeef; UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(t, 0x1badc0de), 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.crc_mismatch, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch, 1); /* CRC mismatch, class 2 */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); @@ -472,7 +472,7 @@ void Test_CF_CFDP_R_CheckCrc(void) t->crc.result = 0xdeadbeef; UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(t, 0x2badc0de), 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.crc_mismatch, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch, 2); /* CRC match */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); @@ -512,7 +512,7 @@ void Test_CF_CFDP_R2_Complete(void) UtAssert_BOOL_TRUE(t->flags.rx.send_fin); UtAssert_BOOL_TRUE(t->flags.rx.complete); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_NAK_LIMIT); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.nak_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit, 1); /* test with md_recv - with no more setup this only sets filedata state */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, &config); @@ -552,7 +552,7 @@ void Test_CF_CFDP_R_ProcessFd(void) UT_SetDefaultReturnValue(UT_KEY(CF_WrappedWrite), fd->data_len); UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), 0); UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 100); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.file_data_bytes, 100); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes, 100); UtAssert_STUB_COUNT(CF_WrappedLseek, 0); UtAssert_STUB_COUNT(CF_WrappedWrite, 1); @@ -564,7 +564,7 @@ void Test_CF_CFDP_R_ProcessFd(void) UT_SetDefaultReturnValue(UT_KEY(CF_WrappedLseek), fd->offset); UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), 0); UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.file_data_bytes, 200); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes, 200); UtAssert_STUB_COUNT(CF_WrappedLseek, 1); UtAssert_STUB_COUNT(CF_WrappedWrite, 2); UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); @@ -594,8 +594,8 @@ void Test_CF_CFDP_R_ProcessFd(void) UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); /* these stats should have been updated during the course of this test */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_write, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_seek, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_write, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_seek, 1); } void Test_CF_CFDP_R_SubstateRecvEof(void) @@ -635,8 +635,8 @@ void Test_CF_CFDP_R_SubstateRecvEof(void) UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_EOF); /* these counters should have been updated during the test */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_size_mismatch, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_size_mismatch, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.recv.error, 1); } void Test_CF_CFDP_R1_SubstateRecvEof(void) @@ -965,7 +965,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk(void) UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_READ); UtAssert_BOOL_FALSE(t->flags.com.crc_calc); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_read, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read, 1); /* failure of lseek */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); @@ -978,7 +978,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk(void) UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SEEK_CRC); UtAssert_BOOL_FALSE(t->flags.com.crc_calc); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); } void Test_CF_CFDP_R2_SubstateSendFin(void) @@ -1031,7 +1031,7 @@ void Test_CF_CFDP_R2_Recv_fin_ack(void) UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvAck), 1, -1); UtAssert_VOIDCALL(CF_CFDP_R2_Recv_fin_ack(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_FINACK); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); } void Test_CF_CFDP_R2_RecvMd(void) @@ -1091,7 +1091,7 @@ void Test_CF_CFDP_R2_RecvMd(void) UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvMd), 1, CF_PDU_METADATA_ERROR); UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_MD); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); } void Test_CF_CFDP_R_SendInactivityEvent(void) @@ -1104,7 +1104,7 @@ void Test_CF_CFDP_R_SendInactivityEvent(void) /* nominal */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); UtAssert_VOIDCALL(CF_CFDP_R_SendInactivityEvent(t)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_INACT_TIMER); } diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index 1c447a3e..c2e2c5a4 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -246,7 +246,7 @@ void Test_CF_CFDP_S_Tick(void) UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_INACT_TIMER); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* in CF_TxnState_S2, ack_timer_armed */ @@ -284,7 +284,7 @@ void Test_CF_CFDP_S_Tick(void) t->state_data.s.s2.acknak_count = 9; UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_ACK_LIMIT); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.ack_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); /* same, with CF_CFDP_S_SendEof no message */ @@ -406,7 +406,7 @@ void Test_CF_CFDP_S2_SubstateSendEof(void) /* nominal, this dequeues a transaction so q_size must be nonzero */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[t->flags.com.q_index] = 10; + CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index] = 10; UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendEof(t)); UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_WAIT_FOR_EOF_ACK); UtAssert_BOOL_TRUE(t->flags.com.ack_timer_armed); @@ -430,7 +430,7 @@ void Test_CF_CFDP_S_SendFileData(void) /* failure of CF_CFDP_ConstructPduHeader */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), 0); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); /* nominal, smaller than chunk, no CRC */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -439,7 +439,7 @@ void Test_CF_CFDP_S_SendFileData(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, false), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); /* nominal, larger than PDU, no CRC */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -449,7 +449,7 @@ void Test_CF_CFDP_S_SendFileData(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size * 2, false), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); UtAssert_STUB_COUNT(CF_CRC_Digest, 0); /* nominal, larger than chunk, with CRC */ @@ -460,7 +460,7 @@ void Test_CF_CFDP_S_SendFileData(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, config->outgoing_file_chunk_size); UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), config->outgoing_file_chunk_size); cumulative_read += config->outgoing_file_chunk_size; - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); UtAssert_STUB_COUNT(CF_CRC_Digest, 1); /* no message available */ @@ -470,7 +470,7 @@ void Test_CF_CFDP_S_SendFileData(void) config->outgoing_file_chunk_size = read_size; t->fsize = 300; UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), 0); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); /* other send error */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -480,7 +480,7 @@ void Test_CF_CFDP_S_SendFileData(void) t->fsize = 300; UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEND_FD); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); /* read w/failure */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -488,8 +488,8 @@ void Test_CF_CFDP_S_SendFileData(void) config->outgoing_file_chunk_size = read_size; t->fsize = 300; UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_read, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_READ); /* require lseek */ @@ -501,7 +501,7 @@ void Test_CF_CFDP_S_SendFileData(void) t->fsize = 300; UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); /* lseek w/failure */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); @@ -509,8 +509,8 @@ void Test_CF_CFDP_S_SendFileData(void) config->outgoing_file_chunk_size = read_size; t->fsize = 300; UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_FD); } @@ -659,7 +659,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_ALREADY_OPEN); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 1); /* file already open */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); @@ -676,7 +676,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, -1); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_OPEN); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_open, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* first CF_WrappedLseek fails */ @@ -684,7 +684,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, -1); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_END); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* second CF_WrappedLseek fails */ @@ -692,7 +692,7 @@ void Test_CF_CFDP_S_SubstateSendMetadata(void) UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 2, -1); UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_BEG); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.fault.file_seek, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 2); UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_SendMd fails w/ ERROR */ @@ -773,7 +773,7 @@ void Test_CF_CFDP_S2_Nak(void) UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_NAK); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); /* nominal, re-send md request (0,0) */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -782,7 +782,7 @@ void Test_CF_CFDP_S2_Nak(void) nak->segment_list.segments[0] = (CF_Logical_SegmentRequest_t) {0, 0}; UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); UtAssert_BOOL_TRUE(t->flags.tx.md_need_send); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 1); /* nominal, nonzero offsets */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -792,7 +792,7 @@ void Test_CF_CFDP_S2_Nak(void) nak->segment_list.segments[1] = (CF_Logical_SegmentRequest_t) {200, 300}; t->fsize = 300; UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 3); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 3); /* bad segments */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); @@ -803,7 +803,7 @@ void Test_CF_CFDP_S2_Nak(void) nak->segment_list.segments[2] = (CF_Logical_SegmentRequest_t) {400, 0}; t->fsize = 300; UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 6); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 6); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_INVALID_SR); /* bad decode */ @@ -812,7 +812,7 @@ void Test_CF_CFDP_S2_Nak(void) nak = &ph->int_header.nak; nak->segment_list.num_segments = 1; UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 2); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_NAK); } @@ -848,7 +848,7 @@ void Test_CF_CFDP_S2_WaitForEofAck(void) UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvAck), 1, -1); UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(t, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_EOF); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); /* with error status */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); diff --git a/unit-test/cf_cfdp_sbintf_tests.c b/unit-test/cf_cfdp_sbintf_tests.c index c990b042..bf926adb 100644 --- a/unit-test/cf_cfdp_sbintf_tests.c +++ b/unit-test/cf_cfdp_sbintf_tests.c @@ -284,7 +284,7 @@ void Test_CF_CFDP_ReceiveMessage(void) ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; c->cur = t; UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); UtAssert_NULL(c->cur); /* cleared */ @@ -295,9 +295,9 @@ void Test_CF_CFDP_ReceiveMessage(void) ph->pdu_header.source_eid = config->local_eid; ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious, 1); /* no increment */ - UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); /* no increment */ - UtAssert_NULL(c->cur); /* cleared */ + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); /* no increment */ + UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); /* no increment */ + UtAssert_NULL(c->cur); /* cleared */ /* FIN handling special case, but failure of CF_CFDP_SendAck */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); @@ -307,9 +307,8 @@ void Test_CF_CFDP_ReceiveMessage(void) ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; c->cur = t; UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[t->chan_num].counters.recv.spurious, - 2); /* this does get increment */ - UtAssert_ADDRESS_EQ(c->cur, t); /* not changed */ + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 2); /* this does get increment */ + UtAssert_ADDRESS_EQ(c->cur, t); /* not changed */ /* recv but not the correct destination_eid */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); @@ -320,9 +319,9 @@ void Test_CF_CFDP_ReceiveMessage(void) /* recv correct destination_eid but CF_MAX_SIMULTANEOUS_RX hit */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); - CF_AppData.HkPacket.channel_hk[t->chan_num].q_size[CF_QueueIdx_RX] = CF_MAX_SIMULTANEOUS_RX; - config->local_eid = 123; - ph->pdu_header.destination_eid = config->local_eid; + CF_AppData.hk.channel_hk[t->chan_num].q_size[CF_QueueIdx_RX] = CF_MAX_SIMULTANEOUS_RX; + config->local_eid = 123; + ph->pdu_header.destination_eid = config->local_eid; UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_RX_DROPPED); } @@ -337,7 +336,7 @@ void Test_CF_CFDP_Send(void) /* nominal */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, NULL, NULL); UtAssert_VOIDCALL(CF_CFDP_Send(UT_CFDP_CHANNEL, ph)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].counters.sent.pdu, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.sent.pdu, 1); UtAssert_STUB_COUNT(CFE_MSG_SetSize, 1); UtAssert_STUB_COUNT(CFE_SB_TransmitBuffer, 1); } @@ -385,10 +384,10 @@ void Test_CF_CFDP_MsgOutGet(void) /* channel is frozen */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].frozen = 1; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 1; UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].frozen = 0; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 0; /* no msg available from SB */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index d082404d..d17d8c16 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -479,7 +479,7 @@ void Test_CF_CFDP_RecvIdle(void) /* setup for FindUnusedChunks */ memset(&ut_unused_chunks, 0, sizeof(ut_unused_chunks)); CF_AppData.engine.channels[UT_CFDP_CHANNEL].cs[CF_Direction_RX] = &ut_unused_chunks.cl_node; - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[0] = 4; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[0] = 4; UT_SetHandlerFunction(UT_KEY(CF_CList_Pop), UT_AltHandler_GenericPointerReturn, &ut_unused_chunks.cl_node); /* nominal call, file data, class 1 */ @@ -1015,9 +1015,9 @@ void Test_CF_CFDP_CycleTx(void) /* need to set dequeue_enabled so it enters the actual logic */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, &t, &config); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[0] = 10; - CF_AppData.engine.enabled = 1; - config->chan[UT_CFDP_CHANNEL].dequeue_enabled = 1; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[0] = 10; + CF_AppData.engine.enabled = 1; + config->chan[UT_CFDP_CHANNEL].dequeue_enabled = 1; /* nominal call, w/c->cur non-null */ c->cur = t; @@ -1139,14 +1139,14 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) /* nominal call, polldir disabled (noop) */ UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); /* nominal call, polldir enabled but interval_sec == 0 */ /* Will tick because CF_Timer_Expired stub returns 0 by default (not expired) */ pdcfg->enabled = 1; UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); UtAssert_BOOL_FALSE(poll->timer_set); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); /* with interval_sec nonzero the timer should get set, but not tick */ @@ -1154,7 +1154,7 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); UtAssert_BOOL_TRUE(poll->timer_set); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); /* call again should tick */ UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); @@ -1166,7 +1166,7 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); UtAssert_BOOL_FALSE(poll->timer_set); UtAssert_BOOL_TRUE(poll->pb.busy); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); /* make an error occur in CF_CFDP_PlaybackDir_Initiate() */ poll->pb.busy = false; /* above would have set it true */ @@ -1196,7 +1196,7 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) /* test that call to CF_CFDP_UpdatePollPbCounted will decrement back to 0 again */ pdcfg->enabled = 0; UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); } void Test_CF_CFDP_ProcessPlaybackDirectory(void) @@ -1339,11 +1339,11 @@ void Test_CF_CFDP_CycleEngine(void) UtAssert_VOIDCALL(CF_CFDP_CycleEngine()); /* enabled but frozen */ - CF_AppData.engine.enabled = 1; - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].frozen = 1; + CF_AppData.engine.enabled = 1; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 1; UtAssert_VOIDCALL(CF_CFDP_CycleEngine()); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].frozen = 0; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 0; UtAssert_VOIDCALL(CF_CFDP_CycleEngine()); } @@ -1362,7 +1362,7 @@ void Test_CF_CFDP_ResetTransaction(void) /* nominal call */ UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[t->flags.com.q_index] = 10; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[t->flags.com.q_index] = 10; UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); UtAssert_STUB_COUNT(CF_FreeTransaction, 1); diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index f3d2e81f..0fc3bd15 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -175,9 +175,9 @@ void Test_CF_CmdNoop_SendNoopEventAndAcceptCommand(void) /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdNoop(arg_msg); @@ -186,7 +186,7 @@ void Test_CF_CmdNoop_SendNoopEventAndAcceptCommand(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_NOOP); /* Assert to show counter incremented */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } /******************************************************************************* @@ -201,13 +201,13 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsEqTo_5_SendEventAndRejectCommand(vo CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = 5; /* 5 is size of 'names' */ + msg->data.byte[0] = 5; /* 5 is size of 'names' */ - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdReset(arg_msg); @@ -216,7 +216,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsEqTo_5_SendEventAndRejectCommand(vo UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_RESET_INVALID); /* Assert incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCommand(void) @@ -225,13 +225,13 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCom CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = Any_uint8_GreaterThan(5); /* 5 is size of 'names' */ + msg->data.byte[0] = Any_uint8_GreaterThan(5); /* 5 is size of 'names' */ - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdReset(arg_msg); @@ -240,7 +240,7 @@ void Test_CF_CmdReset_tests_WhenCommandByteIsGreaterThan_5_SendEventAndRejectCom UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_RESET_INVALID); /* Assert incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSendEvent(void) @@ -252,10 +252,9 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSe memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = CF_Reset_command; - - CF_AppData.HkPacket.CommandCounter = Any_uint16_Except(0); - CF_AppData.HkPacket.CommandErrorCounter = Any_uint16_Except(0); + msg->data.byte[0] = CF_Reset_command; + CF_AppData.hk.counters.cmd = Any_uint16_Except(0); + CF_AppData.hk.counters.err = Any_uint16_Except(0); /* Act */ CF_CmdReset(arg_msg); @@ -263,8 +262,8 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_command_AndResetHkCmdAndErrCountSe /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_RESET); - UtAssert_ZERO(CF_AppData.HkPacket.CommandCounter); - UtAssert_ZERO(CF_AppData.HkPacket.CommandErrorCounter); + UtAssert_ZERO(CF_AppData.hk.counters.cmd); + UtAssert_ZERO(CF_AppData.hk.counters.err); } void Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEventAndAcceptCommand(void) @@ -274,29 +273,29 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEven CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; int i = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = CF_Reset_fault; + msg->data.byte[0] = CF_Reset_fault; for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_open = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_read = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_seek = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_write = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_rename = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.directory_read = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.crc_mismatch = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_size_mismatch = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.nak_limit = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.ack_limit = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.inactivity_timer = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.spare = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_open = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_read = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_seek = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_write = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_rename = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.directory_read = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.crc_mismatch = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_size_mismatch = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.nak_limit = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.ack_limit = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.inactivity_timer = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.spare = Any_uint16_Except(0); } - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdReset(arg_msg); @@ -307,24 +306,24 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_fault_ResetAllHkFaultCountSendEven for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_open); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_read); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_seek); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_write); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_rename); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.directory_read); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.crc_mismatch); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.file_size_mismatch); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.nak_limit); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.ack_limit); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.inactivity_timer); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.fault.spare); - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.fault, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.fault), + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_open); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_read); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_seek); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_write); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_rename); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.directory_read); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.crc_mismatch); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.file_size_mismatch); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.nak_limit); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.ack_limit); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.inactivity_timer); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.fault.spare); + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.fault, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.fault), "fault channel %d was completely cleared to 0", i); } /* Assert to show counter incremented */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEventAndAcceptCommand(void) @@ -334,23 +333,23 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEvent CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; int i = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = CF_Reset_up; + msg->data.byte[0] = CF_Reset_up; for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.recv.file_data_bytes = Any_uint64_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.pdu = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.error = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.file_data_bytes = Any_uint64_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.pdu = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.error = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0); } - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdReset(arg_msg); @@ -361,18 +360,18 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountSendEvent for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.file_data_bytes); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.pdu); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.error); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.spurious); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.pdu); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.recv.nak_segment_requests); - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.recv, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.recv), + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.file_data_bytes); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.pdu); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.error); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.spurious); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.pdu); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.recv.nak_segment_requests); + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.recv, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.recv), "recv channel %d was completely cleared to 0", i); } /* Assert to show counter incremented */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEventAcceptCommand(void) @@ -382,20 +381,20 @@ void Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEve CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; uint8 i = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = CF_Reset_down; + msg->data.byte[0] = CF_Reset_down; for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0); } - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdReset(arg_msg); @@ -406,15 +405,15 @@ void Test_CF_CmdReset_tests_SWhenCommandByteIs_down_AndResetAllHkSentCountendEve for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.sent.file_data_bytes); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.sent.nak_segment_requests); - UtAssert_ZERO(CF_AppData.HkPacket.channel_hk[i].counters.sent.pdu); - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.sent, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.sent), + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.sent.file_data_bytes); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.sent.nak_segment_requests); + UtAssert_ZERO(CF_AppData.hk.channel_hk[i].counters.sent.pdu); + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.sent, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.sent), "sent channel %d was completely cleared to 0", i); } /* Assert to show counter incremented */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent(void) @@ -427,42 +426,42 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent( memset(&utbuf, 0, sizeof(utbuf)); - msg->byte[0] = CF_Reset_all; + msg->data.byte[0] = CF_Reset_all; - CF_AppData.HkPacket.CommandCounter = Any_uint16_Except(0); - CF_AppData.HkPacket.CommandErrorCounter = Any_uint16_Except(0); + CF_AppData.hk.counters.cmd = Any_uint16_Except(0); + CF_AppData.hk.counters.err = Any_uint16_Except(0); for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_open = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_read = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_seek = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_write = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_rename = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.directory_read = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.crc_mismatch = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.file_size_mismatch = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.nak_limit = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.ack_limit = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.inactivity_timer = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.fault.spare = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_open = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_read = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_seek = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_write = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_rename = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.directory_read = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.crc_mismatch = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.file_size_mismatch = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.nak_limit = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.ack_limit = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.inactivity_timer = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.fault.spare = Any_uint16_Except(0); } for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.recv.file_data_bytes = Any_uint64_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.pdu = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.error = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.file_data_bytes = Any_uint64_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.pdu = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.error = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0); + CF_AppData.hk.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0); } for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_AppData.HkPacket.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0); - CF_AppData.HkPacket.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0); + CF_AppData.hk.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0); } /* Act */ @@ -472,24 +471,24 @@ void Test_CF_CmdReset_tests_WhenCommandByteIs_all_AndResetAllMemValuesSendEvent( UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_RESET); - UtAssert_ZERO(CF_AppData.HkPacket.CommandCounter); - UtAssert_ZERO(CF_AppData.HkPacket.CommandErrorCounter); + UtAssert_ZERO(CF_AppData.hk.counters.cmd); + UtAssert_ZERO(CF_AppData.hk.counters.err); for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.fault, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.fault), + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.fault, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.fault), "fault channel %d was completely cleared to 0", i); } for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.recv, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.recv), + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.recv, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.recv), "recv channel %d was completely cleared to 0", i); } for (i = 0; i < CF_NUM_CHANNELS; ++i) { - UtAssert_MemCmpValue(&CF_AppData.HkPacket.channel_hk[i].counters.sent, 0, - sizeof(&CF_AppData.HkPacket.channel_hk[i].counters.sent), + UtAssert_MemCmpValue(&CF_AppData.hk.channel_hk[i].counters.sent, 0, + sizeof(&CF_AppData.hk.channel_hk[i].counters.sent), "sent channel %d was completely cleared to 0", i); } } @@ -508,14 +507,13 @@ void Test_CF_CmdTxFile(void) CF_UT_cmd_tx_file_buf_t utbuf; CF_TxFileCmd_t * msg = &utbuf.tf; - CF_AppData.HkPacket.CommandCounter = 0; - CF_AppData.HkPacket.CommandErrorCounter = 0; + memset(&CF_AppData.hk.counters, 0, sizeof(CF_AppData.hk.counters)); /* nominal, all zero should pass checks, just calls CF_CFDP_TxFile */ memset(msg, 0, sizeof(*msg)); msg->cfdp_class = CF_CFDP_CLASS_1; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_TX_FILE); @@ -523,7 +521,7 @@ void Test_CF_CmdTxFile(void) memset(msg, 0, sizeof(*msg)); msg->cfdp_class = CF_CFDP_CLASS_2; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 2); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_TX_FILE); @@ -533,14 +531,14 @@ void Test_CF_CmdTxFile(void) msg->cfdp_class = 10; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_ResetEventCapture(); memset(msg, 0, sizeof(*msg)); msg->cfdp_class = -10; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 2); /* out of range arguments: bad channel */ UT_CF_ResetEventCapture(); @@ -548,7 +546,7 @@ void Test_CF_CmdTxFile(void) msg->chan_num = CF_NUM_CHANNELS; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 3); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 3); /* out of range arguments: bad keep */ UT_CF_ResetEventCapture(); @@ -556,7 +554,7 @@ void Test_CF_CmdTxFile(void) msg->keep = 15; UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 4); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 4); /* CF_CFDP_TxFile fails*/ UT_CF_ResetEventCapture(); @@ -564,7 +562,7 @@ void Test_CF_CmdTxFile(void) memset(msg, 0, sizeof(*msg)); UtAssert_VOIDCALL(CF_CmdTxFile(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_TX_FILE); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 5); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 5); } /******************************************************************************* @@ -581,33 +579,32 @@ void Test_CF_CmdPlaybackDir(void) CF_UT_cmd_playback_dir_buf_t utbuf; CF_PlaybackDirCmd_t * msg = &utbuf.pd; - CF_AppData.HkPacket.CommandCounter = 0; - CF_AppData.HkPacket.CommandErrorCounter = 0; + memset(&CF_AppData.hk.counters, 0, sizeof(CF_AppData.hk.counters)); /* nominal, all zero should pass checks, just calls CF_CFDP_PlaybackDir */ memset(msg, 0, sizeof(*msg)); msg->cfdp_class = CF_CFDP_CLASS_1; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); memset(msg, 0, sizeof(*msg)); msg->cfdp_class = CF_CFDP_CLASS_2; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 2); /* out of range arguments: bad class */ memset(msg, 0, sizeof(*msg)); msg->cfdp_class = 10; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_ResetEventCapture(); memset(msg, 0, sizeof(*msg)); msg->cfdp_class = -10; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 2); /* out of range arguments: bad channel */ UT_CF_ResetEventCapture(); @@ -615,7 +612,7 @@ void Test_CF_CmdPlaybackDir(void) msg->chan_num = CF_NUM_CHANNELS; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 3); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 3); /* out of range arguments: bad keep */ UT_CF_ResetEventCapture(); @@ -623,7 +620,7 @@ void Test_CF_CmdPlaybackDir(void) msg->keep = 15; UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_BAD_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 4); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 4); /* CF_CFDP_PlaybackDir fails*/ UT_CF_ResetEventCapture(); @@ -631,7 +628,7 @@ void Test_CF_CmdPlaybackDir(void) memset(msg, 0, sizeof(*msg)); UtAssert_VOIDCALL(CF_CmdPlaybackDir(&utbuf.buf)); UT_CF_AssertEventID(CF_EID_ERR_CMD_PLAYBACK_DIR); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 5); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 5); } /******************************************************************************* @@ -654,7 +651,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAny_fn_returns_1_Return_1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = CF_ALL_CHANNELS; + arg_cmd->data.byte[0] = CF_ALL_CHANNELS; UT_SetDeferredRetcode(UT_KEY(Chan_action_fn_t), random_fn_call, 1); @@ -683,7 +680,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenAll_fn_return_1_Return_1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = CF_ALL_CHANNELS; + arg_cmd->data.byte[0] = CF_ALL_CHANNELS; UT_SetDefaultReturnValue(UT_KEY(Chan_action_fn_t), 1); @@ -712,7 +709,7 @@ void Test_CF_DoChanAction_CF_ALL_CHANNELS_WhenNo_fn_returns_0_Return_0(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = CF_ALL_CHANNELS; + arg_cmd->data.byte[0] = CF_ALL_CHANNELS; UT_SetDefaultReturnValue(UT_KEY(Chan_action_fn_t), 0); @@ -741,7 +738,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_1_Return_1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = Any_cf_channel(); + arg_cmd->data.byte[0] = Any_cf_channel(); UT_SetDefaultReturnValue(UT_KEY(Chan_action_fn_t), 1); @@ -770,7 +767,7 @@ void Test_CF_DoChanAction_WhenChannel_fn_ActionReturns_0_Return_1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = Any_cf_channel(); + arg_cmd->data.byte[0] = Any_cf_channel(); UT_SetDefaultReturnValue(UT_KEY(Chan_action_fn_t), 0); @@ -799,7 +796,7 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[0] = CF_NUM_CHANNELS; + arg_cmd->data.byte[0] = CF_NUM_CHANNELS; /* Act */ local_result = CF_DoChanAction(arg_cmd, arg_errstr, arg_fn, arg_context); @@ -812,9 +809,8 @@ void Test_CF_DoChanAction_WhenChanNumberEq_CF_NUM_CHANNELS_Return_neg1_And_SendE UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CHAN_PARAM); - UtAssert_True(local_result == CF_ERROR, - "CF_DoChanAction returned %d and should be -1 (CF_ERROR) (cmd->byte[0] >= CF_NUM_CHANNELS)", - local_result); + UtAssert_True(local_result == -1, + "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); } void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) @@ -832,16 +828,16 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) memset(&utbuf, 0, sizeof(utbuf)); /* force CF_ALL_CHANNELS to not be a selection possibility */ - arg_cmd->byte[0] = CF_ALL_CHANNELS; - while (arg_cmd->byte[0] == CF_ALL_CHANNELS) + arg_cmd->data.byte[0] = CF_ALL_CHANNELS; + while (arg_cmd->data.byte[0] == CF_ALL_CHANNELS) { if (catastrophe_count == 10) /* 10 is arbitrary */ { UtAssert_Message(UTASSERT_CASETYPE_ABORT, __FILE__, __LINE__, - "CANNOT make arg_cmd->byte[0] != CF_ALL_CHANNELS in 10 tries"); + "CANNOT make arg_cmd->data.byte[0] != CF_ALL_CHANNELS in 10 tries"); } - arg_cmd->byte[0] = Any_uint8_GreaterThan_or_EqualTo(CF_NUM_CHANNELS); + arg_cmd->data.byte[0] = Any_uint8_GreaterThan_or_EqualTo(CF_NUM_CHANNELS); ++catastrophe_count; } @@ -856,9 +852,8 @@ void Test_CF_DoChanAction_WhenBadChannelNumber_Return_neg1_And_SendEvent(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CHAN_PARAM); - UtAssert_True(local_result == CF_ERROR, - "CF_DoChanAction returned %d and should be -1 (CF_ERROR) (cmd->byte[0] >= CF_NUM_CHANNELS)", - local_result); + UtAssert_True(local_result == -1, + "CF_DoChanAction returned %d and should be -1 (cmd->data.byte[0] >= CF_NUM_CHANNELS)", local_result); } /******************************************************************************* @@ -881,15 +876,15 @@ void Test_CF_DoFreezeThaw_Set_frozen_ToGiven_context_barg_AndReturn_0(void) /* set frozen to opposite to ensure change was done - not required for test, * but it is helpful for verification that the function did the change */ - CF_AppData.HkPacket.channel_hk[arg_chan_num].frozen = !context.barg; + CF_AppData.hk.channel_hk[arg_chan_num].frozen = !context.barg; /* Act */ local_result = CF_DoFreezeThaw(arg_chan_num, arg_context); /* Assert */ - UtAssert_True(CF_AppData.HkPacket.channel_hk[arg_chan_num].frozen == context.barg, + UtAssert_True(CF_AppData.hk.channel_hk[arg_chan_num].frozen == context.barg, "CF_DoFreezeThaw set frozen to %d and should be %d (context->barg))", - CF_AppData.HkPacket.channel_hk[arg_chan_num].frozen, context.barg); + CF_AppData.hk.channel_hk[arg_chan_num].frozen, context.barg); UtAssert_True(local_result == CFE_SUCCESS, "CF_DoFreezeThaw returned %d and should be 0 (CFE_SUCCESS) (only returns 0)", local_result); } @@ -906,7 +901,7 @@ void Test_CF_CmdFreeze_Set_frozen_To_1_AndAcceptCommand(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); /* Arrange unstubbable: CF_DoFreezeThaw via CF_DoChanAction */ uint8 chan_num = Any_cf_channel(); @@ -914,21 +909,21 @@ void Test_CF_CmdFreeze_Set_frozen_To_1_AndAcceptCommand(void) memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = chan_num; + msg->data.byte[0] = chan_num; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdFreeze(arg_msg); /* Assert */ /* Assert for CF_DoFreezeThaw */ - UtAssert_True(CF_AppData.HkPacket.channel_hk[chan_num].frozen == 1, + UtAssert_True(CF_AppData.hk.channel_hk[chan_num].frozen == 1, "CF_DoFreezeThaw set frozen to %d and should be 1 (freeze = 1))", - CF_AppData.HkPacket.channel_hk[chan_num].frozen); - UtAssert_True(CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + CF_AppData.hk.channel_hk[chan_num].frozen); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, + initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_FREEZE); } @@ -944,16 +939,16 @@ void Test_CF_CmdFreeze_Set_frozen_To_1_AndRejectCommand(void) memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = CF_NUM_CHANNELS + 1; + msg->data.byte[0] = CF_NUM_CHANNELS + 1; - CF_AppData.HkPacket.CommandCounter = 0; + CF_AppData.hk.counters.cmd = 0; /* Act */ CF_CmdFreeze(arg_msg); /* Assert */ /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_FREEZE); } @@ -969,7 +964,7 @@ void Test_CF_CmdThaw_Set_frozen_To_0_AndAcceptCommand(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); /* Arrange unstubbable: CF_DoFreezeThaw via CF_DoChanAction */ uint8 chan_num = Any_cf_channel(); @@ -977,21 +972,21 @@ void Test_CF_CmdThaw_Set_frozen_To_0_AndAcceptCommand(void) memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = chan_num; + msg->data.byte[0] = chan_num; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdThaw(arg_msg); /* Assert */ /* Assert for CF_DoFreezeThaw */ - UtAssert_True(CF_AppData.HkPacket.channel_hk[chan_num].frozen == 0, + UtAssert_True(CF_AppData.hk.channel_hk[chan_num].frozen == 0, "CF_DoFreezeThaw set frozen to %d and should be 0 (thaw = 0))", - CF_AppData.HkPacket.channel_hk[chan_num].frozen); - UtAssert_True(CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + CF_AppData.hk.channel_hk[chan_num].frozen); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, + initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_THAW); } @@ -1007,16 +1002,16 @@ void Test_CF_CmdThaw_Set_frozen_To_0_AndRejectCommand(void) memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = CF_NUM_CHANNELS + 1; + msg->data.byte[0] = CF_NUM_CHANNELS + 1; - CF_AppData.HkPacket.CommandCounter = 0; + CF_AppData.hk.counters.cmd = 0; /* Act */ CF_CmdThaw(arg_msg); /* Assert */ /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_THAW); } @@ -1341,8 +1336,7 @@ void Test_CF_DoSuspRes(void) CF_TransactionCmd_t * cmd = &utbuf.xact; CF_ChanAction_SuspResArg_t utargs; - CF_AppData.HkPacket.CommandCounter = 0; - CF_AppData.HkPacket.CommandErrorCounter = 0; + memset(&CF_AppData.hk.counters, 0, sizeof(CF_AppData.hk.counters)); memset(&utargs, 0, sizeof(utargs)); memset(cmd, 0, sizeof(*cmd)); @@ -1350,7 +1344,7 @@ void Test_CF_DoSuspRes(void) /* With no setup, CF_TsnChanAction() invokes CF_TraverseAllTransactions stub, which returns 0 */ /* this should increment the reject counter because it did not match any transactions */ UtAssert_VOIDCALL(CF_DoSuspRes(cmd, 0)); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); /* set up to match 1 transaction, should be accepted, but should not generate an event */ UT_CF_ResetEventCapture(); @@ -1358,7 +1352,7 @@ void Test_CF_DoSuspRes(void) UtAssert_VOIDCALL(CF_DoSuspRes(cmd, 1)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_SUSPRES); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); /* Output the CF_ChanAction_SuspResArg_t back to the caller, to set the "same" flag to 1 */ /* this gets the case where it attempts to set to the same value, and is rejected due to that */ @@ -1369,7 +1363,7 @@ void Test_CF_DoSuspRes(void) &utargs); UtAssert_VOIDCALL(CF_DoSuspRes(cmd, 0)); UT_CF_AssertEventID(CF_EID_ERR_CMD_SUSPRES_SAME); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 2); /* Output the CF_ChanAction_SuspResArg_t back to the caller, to set the "same" flag to 1 */ /* however this time CF_TraverseAllTransactions reports it matched multiple transactions, so it should NOT reject it @@ -1379,7 +1373,7 @@ void Test_CF_DoSuspRes(void) UtAssert_VOIDCALL(CF_DoSuspRes(cmd, 1)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_SUSPRES); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 2); } /******************************************************************************* @@ -1408,7 +1402,7 @@ void Test_CF_CmdSuspend_Call_CF_DoSuspRes_WithGiven_msg_And_action_1(void) UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[1], CF_EID_ERR_CMD_SUSPRES_CHAN); /* Assert incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } /******************************************************************************* @@ -1437,7 +1431,7 @@ void Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0(void) UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[1], CF_EID_ERR_CMD_SUSPRES_CHAN); /* Assert incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } /******************************************************************************* @@ -1485,7 +1479,7 @@ void Test_CF_CmdCancel_Success(void) /* Assert */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_CANCEL); } @@ -1505,7 +1499,7 @@ void Test_CF_CmdCancel_Failure(void) /* Assert */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_CANCEL_CHAN); } @@ -1557,7 +1551,7 @@ void Test_CF_CmdAbandon_Success(void) /* Assert */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_ABANDON); } @@ -1577,7 +1571,7 @@ void Test_CF_CmdAbandon_Failure(void) /* Assert */ UtAssert_STUB_COUNT(CF_TraverseAllTransactions, 1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ABANDON_CHAN); } @@ -1621,7 +1615,7 @@ void Test_CF_CmdEnableDequeue_Success(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); /* Arrange unstubbable: CF_DoEnableDisableDequeue via CF_DoChanAction */ CF_ConfigTable_t config_table; @@ -1633,9 +1627,9 @@ void Test_CF_CmdEnableDequeue_Success(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = chan_num; + msg->data.byte[0] = chan_num; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdEnableDequeue(arg_msg); @@ -1646,11 +1640,10 @@ void Test_CF_CmdEnableDequeue_Success(void) "CF_CmdEnableDequeue set dequeue_enabled to %d and should be 1 (barg = 1))", CF_AppData.config_table->chan[chan_num].dequeue_enabled); /* Assert for incremented counter */ - UtAssert_True( - CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d\nACCEPTANCE OF COMMAND (+1) SHOULD BE " - "THE BEHAVIOR BUT IT IS NOT", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d\nACCEPTANCE OF COMMAND (+1) SHOULD BE " + "THE BEHAVIOR BUT IT IS NOT", + CF_AppData.hk.counters.cmd, initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_DEQUEUE); } @@ -1671,16 +1664,16 @@ void Test_CF_CmdEnableDequeue_Failure(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = CF_NUM_CHANNELS + 1; + msg->data.byte[0] = CF_NUM_CHANNELS + 1; - CF_AppData.HkPacket.CommandErrorCounter = 0; + CF_AppData.hk.counters.err = 0; /* Act */ CF_CmdEnableDequeue(arg_msg); /* Assert */ /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_DEQUEUE); } @@ -1696,7 +1689,7 @@ void Test_CF_CmdDisableDequeue_Success(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); /* Arrange unstubbable: CF_DoEnableDisableDequeue via CF_DoChanAction */ CF_ConfigTable_t config_table; @@ -1708,9 +1701,9 @@ void Test_CF_CmdDisableDequeue_Success(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = chan_num; + msg->data.byte[0] = chan_num; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdDisableDequeue(arg_msg); @@ -1721,9 +1714,9 @@ void Test_CF_CmdDisableDequeue_Success(void) "CF_CmdEnableDequeue set dequeue_enabled to %d and should be 0 (barg = 0))", CF_AppData.config_table->chan[chan_num].dequeue_enabled); /* Assert for incremented counter */ - UtAssert_True(CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, + initial_hk_cmd_counter); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_DISABLE_DEQUEUE); } @@ -1744,16 +1737,16 @@ void Test_CF_CmdDisableDequeue_Failure(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = CF_NUM_CHANNELS + 1; + msg->data.byte[0] = CF_NUM_CHANNELS + 1; - CF_AppData.HkPacket.CommandErrorCounter = 0; + CF_AppData.hk.counters.err = 0; /* Act */ CF_CmdDisableDequeue(arg_msg); /* Assert */ /* Assert for CF_DoFreezeThaw */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_DISABLE_DEQUEUE); } @@ -1781,7 +1774,7 @@ void Test_CF_DoEnableDisablePolldir_When_CF_ALL_CHANNELS_SetAllPolldirsInChannel CF_AppData.config_table = &config_table; - msg->byte[1] = CF_ALL_CHANNELS; + msg->data.byte[1] = CF_ALL_CHANNELS; context.msg = msg; context.barg = Any_bool_arg_t_barg(); @@ -1820,7 +1813,7 @@ void Test_CF_DoEnableDisablePolldir_WhenSetToSpecificPolldirSetPolldirFrom_conte CF_AppData.config_table = &config_table; - msg->byte[1] = polldir; + msg->data.byte[1] = polldir; context.msg = msg; context.barg = Any_bool_arg_t_barg(); @@ -1852,7 +1845,7 @@ void Test_CF_DoEnableDisablePolldir_FailPolldirEq_CF_MAX_POLLING_DIR_PER_CHAN_An CF_AppData.config_table = &config_table; - msg->byte[1] = CF_MAX_POLLING_DIR_PER_CHAN; + msg->data.byte[1] = CF_MAX_POLLING_DIR_PER_CHAN; context.msg = msg; context.barg = Any_bool_arg_t_barg(); @@ -1882,7 +1875,7 @@ void Test_CF_DoEnableDisablePolldir_FailAnyBadPolldirSendEvent(void) CF_AppData.config_table = &config_table; - msg->byte[1] = CF_MAX_POLLING_DIR_PER_CHAN; + msg->data.byte[1] = CF_MAX_POLLING_DIR_PER_CHAN; context.msg = msg; context.barg = Any_bool_arg_t_barg(); @@ -1912,7 +1905,7 @@ void Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); memset(&config_table, 0, sizeof(config_table)); @@ -1920,12 +1913,12 @@ void Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; /* Arrange unstubbable: CF_DoEnableDisablePolldir */ - msg->byte[1] = polldir; + msg->data.byte[1] = polldir; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdEnablePolldir(arg_msg); @@ -1936,9 +1929,9 @@ void Test_CF_CmdEnablePolldir_SuccessWhenActionSuccess(void) "Channel %u Polldir %u set to %u and should be 1 (context->barg)", channel, polldir, CF_AppData.config_table->chan[channel].polldir[polldir].enabled); /* Assert for incremented counter */ - UtAssert_True(CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, + initial_hk_cmd_counter); UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_POLLDIR); } @@ -1950,17 +1943,16 @@ void Test_CF_CmdEnablePolldir_FailWhenActionFail(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; /* Arrange unstubbable: CF_DoEnableDisablePolldir */ - msg->byte[1] = error_polldir; - - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + msg->data.byte[1] = error_polldir; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdEnablePolldir(arg_msg); @@ -1968,9 +1960,9 @@ void Test_CF_CmdEnablePolldir_FailWhenActionFail(void) /* Assert */ /* Assert for CF_DoEnableDisablePolldir */ /* Assert for incremented counter */ - UtAssert_True(CF_AppData.HkPacket.CommandErrorCounter == (uint16)(initial_hk_err_counter + 1), - "CF_AppData.HkPacket.CommandErrorCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandErrorCounter, initial_hk_err_counter); + UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), + "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, + initial_hk_err_counter); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_POLLDIR); } @@ -1989,7 +1981,7 @@ void Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); memset(&config_table, 0, sizeof(config_table)); @@ -1997,12 +1989,12 @@ void Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess(void) CF_AppData.config_table = &config_table; /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; /* Arrange unstubbable: CF_DoEnableDisablePolldir */ - msg->byte[1] = polldir; + msg->data.byte[1] = polldir; - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdDisablePolldir(arg_msg); @@ -2013,9 +2005,9 @@ void Test_CF_CmdDisablePolldir_SuccessWhenActionSuccess(void) "Channel %u Polldir %u set to %u and should be 0 (context->barg)", channel, polldir, CF_AppData.config_table->chan[channel].polldir[polldir].enabled); /* Assert for incremented counter */ - UtAssert_True(CF_AppData.HkPacket.CommandCounter == (uint16)(initial_hk_cmd_counter + 1), - "CF_AppData.HkPacket.CommandCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandCounter, initial_hk_cmd_counter); + UtAssert_True(CF_AppData.hk.counters.cmd == (uint16)(initial_hk_cmd_counter + 1), + "CF_AppData.hk.counters.cmd is %d and should be 1 more than %d", CF_AppData.hk.counters.cmd, + initial_hk_cmd_counter); UT_CF_AssertEventID(CF_EID_INF_CMD_DISABLE_POLLDIR); } @@ -2027,17 +2019,17 @@ void Test_CF_CmdDisablePolldir_FailWhenActionFail(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; /* Arrange unstubbable: CF_DoEnableDisablePolldir */ - msg->byte[1] = error_polldir; + msg->data.byte[1] = error_polldir; - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdDisablePolldir(arg_msg); @@ -2045,9 +2037,9 @@ void Test_CF_CmdDisablePolldir_FailWhenActionFail(void) /* Assert */ /* Assert for CF_DoEnableDisablePolldir */ /* Assert for incremented counter*/ - UtAssert_True(CF_AppData.HkPacket.CommandErrorCounter == (uint16)(initial_hk_err_counter + 1), - "CF_AppData.HkPacket.CommandErrorCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandErrorCounter, initial_hk_err_counter); + UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), + "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, + initial_hk_err_counter); UT_CF_AssertEventID(CF_EID_ERR_CMD_DISABLE_POLLDIR); } @@ -2131,7 +2123,7 @@ void Test_CF_DoPurgeQueue_PendOnly(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[1] = 0; /* pend */ + arg_cmd->data.byte[1] = 0; /* pend */ UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_POINTER, &context_CF_CList_Traverse); @@ -2167,7 +2159,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[1] = 1; /* history */ + arg_cmd->data.byte[1] = 1; /* history */ /* set correct context type for CF_CList_Traverse stub */ UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_POINTER, @@ -2207,7 +2199,7 @@ void Test_CF_DoPurgeQueue_Both(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[1] = 2; /* both */ + arg_cmd->data.byte[1] = 2; /* both */ /* set correct context type for CF_CList_Traverse stub */ /* this must use data buffer hack to pass multiple contexts */ @@ -2247,7 +2239,7 @@ void Test_CF_DoPurgeQueue_GivenBad_data_byte_1_SendEventAndReturn_neg1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[1] = 3; /* 3 is first default value */ + arg_cmd->data.byte[1] = 3; /* 3 is first default value */ /* Act */ local_result = CF_DoPurgeQueue(arg_chan_num, arg_cmd); @@ -2271,7 +2263,7 @@ void Test_CF_DoPurgeQueue_AnyGivenBad_data_byte_1_SendEventAndReturn_neg1(void) memset(&utbuf, 0, sizeof(utbuf)); - arg_cmd->byte[1] = Any_uint8_GreaterThan_or_EqualTo(3); + arg_cmd->data.byte[1] = Any_uint8_GreaterThan_or_EqualTo(3); /* Act */ local_result = CF_DoPurgeQueue(arg_chan_num, arg_cmd); @@ -2299,17 +2291,17 @@ void Test_CF_CmdPurgeQueue_FailWhenActionFail(void) CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * msg = &utbuf.ua; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; /* Arrange unstubbable: CF_DoPurgeQueue */ - msg->byte[1] = error_purge; + msg->data.byte[1] = error_purge; - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdPurgeQueue(arg_msg); @@ -2317,9 +2309,9 @@ void Test_CF_CmdPurgeQueue_FailWhenActionFail(void) /* Assert */ /* Assert for CF_DoEnableDisablePolldir */ /* Assert for incremented counter */ - UtAssert_True(CF_AppData.HkPacket.CommandErrorCounter == (uint16)(initial_hk_err_counter + 1), - "CF_AppData.HkPacket.CommandErrorCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandErrorCounter, initial_hk_err_counter); + UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), + "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, + initial_hk_err_counter); UT_CF_AssertEventID(CF_EID_ERR_CMD_PURGE_QUEUE); } @@ -2334,9 +2326,9 @@ void Test_CF_CmdPurgeQueue_SuccessWhenActionSuccess(void) memset(&utbuf, 0, sizeof(utbuf)); /* Arrange unstubbable: CF_DoChanAction */ - msg->byte[0] = channel; + msg->data.byte[0] = channel; - CF_AppData.HkPacket.CommandCounter = 0; + CF_AppData.hk.counters.cmd = 0; /* Act */ CF_CmdPurgeQueue(arg_msg); @@ -2344,7 +2336,7 @@ void Test_CF_CmdPurgeQueue_SuccessWhenActionSuccess(void) /* Assert */ /* Assert for CF_DoEnableDisablePolldir */ /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_PURGE_QUEUE); } @@ -2361,14 +2353,14 @@ void Test_CF_CmdWriteQueue_When_chan_Eq_CF_NUM_CAHNNELS_SendEventAndRejectComman CF_UT_cmd_write_q_buf_t utbuf; CF_WriteQueueCmd_t * wq = &utbuf.wq; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); /* invalid channel */ wq->chan = CF_NUM_CHANNELS; - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2377,7 +2369,7 @@ void Test_CF_CmdWriteQueue_When_chan_Eq_CF_NUM_CAHNNELS_SendEventAndRejectComman UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_CHAN); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRejectCommand(void) @@ -2386,14 +2378,14 @@ void Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRej CF_UT_cmd_write_q_buf_t utbuf; CF_WriteQueueCmd_t * wq = &utbuf.wq; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); /* invalid channel */ wq->chan = Any_uint8_GreaterThan(CF_NUM_CHANNELS); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2403,7 +2395,7 @@ void Test_CF_CmdWriteQueue_When_chan_GreaterThan_CF_NUM_CAHNNELS_SendEventAndRej UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_CHAN); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) @@ -2412,7 +2404,7 @@ void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) CF_UT_cmd_write_q_buf_t utbuf; CF_WriteQueueCmd_t * wq = &utbuf.wq; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2423,7 +2415,7 @@ void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) wq->type = CF_Type_up; wq->queue = CF_Queue_pend; - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2433,7 +2425,7 @@ void Test_CF_CmdWriteQueue_WhenUpAndPendingQueueSendEventAndRejectCommand(void) UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_ARGS); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_IsNot_q_pend_SendEventAndRejectCommand( @@ -2444,7 +2436,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_ CF_WriteQueueCmd_t * wq = &utbuf.wq; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2463,7 +2455,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_ UT_SetDataBuffer(UT_KEY(CF_WrappedOpenCreate), &context_CF_WrappedOpenCreate, sizeof(context_CF_WrappedOpenCreate), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2475,7 +2467,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_Is_type_up_And_queue_ UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_OPEN); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_queue_Is_q_pend_SendEventAndRejectCommand( @@ -2486,7 +2478,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_que CF_WriteQueueCmd_t * wq = &utbuf.wq; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; CFE_SB_Buffer_t * arg_msg = &utbuf.buf; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2505,7 +2497,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_que UT_SetDataBuffer(UT_KEY(CF_WrappedOpenCreate), &context_CF_WrappedOpenCreate, sizeof(context_CF_WrappedOpenCreate), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2517,7 +2509,7 @@ void Test_CF_CmdWriteQueue_When_CF_WrappedCreat_Fails_type_IsNot_type_up_And_que UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_OPEN); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedClose_SendEventCloseAndRejectCommandWhen_CF_WriteTxnQueueDataToFile_Fails( @@ -2530,7 +2522,7 @@ void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedC CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; CF_WriteTxnQueueDataToFile_context_t context_CF_WriteTxnQueueDataToFile; int32 forced_return_CF_WriteTxnQueueDataToFile = Any_int32_Except(0); - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2554,7 +2546,7 @@ void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedC sizeof(context_CF_WriteTxnQueueDataToFile), false); UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2565,7 +2557,7 @@ void Test_CF_CmdWriteQueue_When_wq_IsAllAnd_queue_IsAll_fd_Is_0_Call_CF_WrappedC UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEQ_RX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventClosesAndRejectCommand( @@ -2579,7 +2571,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_q CF_WriteTxnQueueDataToFile_context_t context_CF_WriteTxnQueueDataToFile; int32 forced_return_CF_WriteTxnQueueDataToFile = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2605,7 +2597,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_q UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2616,7 +2608,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteTxnQueueDataToFile_FailsAnd_wq_IsUpAnd_q UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEQ_RX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( @@ -2630,7 +2622,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpA CF_WriteHistoryQueueDataToFile_context_t context_CF_WriteHistoryQueueDataToFile; int32 forced_return_CF_WriteHistoryQueueDataToFile = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2656,7 +2648,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpA UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2667,7 +2659,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsUpA UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEHIST_RX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( @@ -2681,7 +2673,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq CF_WriteTxnQueueDataToFile_context_t context_CF_WriteTxnQueueDataToFile; int32 forced_return_CF_WriteTxnQueueDataToFile = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2707,7 +2699,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2718,7 +2710,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnFirstCallAnd_wq UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEQ_TX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_wq_IsDownAnd_queue_IsActive_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( @@ -2733,7 +2725,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_w int32 forced_return_CF_WriteTxnQueueDataToFile_1st_call = 0; int32 forced_return_CF_WriteTxnQueueDataToFile_2nd_call = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2760,7 +2752,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_w UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2771,7 +2763,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryDataToFile_FailsOnSecondCallAnd_w UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEQ_TX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsPend_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( @@ -2785,7 +2777,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow CF_WriteTxnQueueDataToFile_context_t context_CF_WriteTxnQueueDataToFile; int32 forced_return_CF_WriteTxnQueueDataToFile = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2811,7 +2803,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2822,7 +2814,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEQ_PEND); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDownAnd_queue_IsHistory_fd_IsPositive_Call_CF_WrappedClose_SendEventCloseAndRejectCommand( @@ -2836,7 +2828,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow CF_WriteHistoryQueueDataToFile_context_t context_CF_WriteHistoryQueueDataToFile; int32 forced_return_CF_WriteHistoryQueueDataToFile = Any_int32_Except(0); int32 context_CF_WrappedClose_fd; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2862,7 +2854,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UT_SetDataBuffer(UT_KEY(CF_WrappedClose), &context_CF_WrappedClose_fd, sizeof(context_CF_WrappedClose_fd), false); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2873,7 +2865,7 @@ void Test_CF_CmdWriteQueue_When_CF_WriteHistoryQueueDataToFile_FailsAnd_wq_IsDow UT_CF_AssertEventID(CF_EID_ERR_CMD_WQ_WRITEHIST_TX); UtAssert_STUB_COUNT(CF_WrappedClose, 1); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) @@ -2885,7 +2877,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; int32 forced_return_CF_WriteHistoryQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2910,7 +2902,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) /* valid result from CF_WriteHistoryQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteHistoryQueueDataToFile), forced_return_CF_WriteHistoryQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2922,7 +2914,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_All(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) @@ -2933,7 +2925,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteHistoryQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -2955,7 +2947,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) /* valid result from CF_WriteHistoryQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteHistoryQueueDataToFile), forced_return_CF_WriteHistoryQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -2967,7 +2959,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_History(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) @@ -2978,7 +2970,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3000,7 +2992,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3012,7 +3004,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Active(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) @@ -3023,7 +3015,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3045,7 +3037,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3057,7 +3049,7 @@ void Test_CF_CmdWriteQueue_Success_type_AllAnd_q_Pend(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) @@ -3069,7 +3061,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; int32 forced_return_CF_WriteHistoryQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3094,7 +3086,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) /* valid result from CF_WriteHistoryQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteHistoryQueueDataToFile), forced_return_CF_WriteHistoryQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3106,7 +3098,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_All(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) @@ -3117,7 +3109,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteHistoryQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3139,7 +3131,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) /* valid result from CF_WriteHistoryQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteHistoryQueueDataToFile), forced_return_CF_WriteHistoryQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3151,7 +3143,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_History(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) @@ -3162,7 +3154,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3184,7 +3176,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3196,7 +3188,7 @@ void Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Active(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } /* Test_CF_CmdWriteQueue_Success_type_UpAnd_q_Pend IS an error and is handled by a previous test */ @@ -3209,7 +3201,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_All(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3231,7 +3223,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_All(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3243,7 +3235,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_All(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) @@ -3254,7 +3246,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3276,7 +3268,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3288,7 +3280,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_History(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) @@ -3299,7 +3291,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3321,7 +3313,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3333,7 +3325,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Active(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) @@ -3344,7 +3336,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) CFE_SB_Buffer_t * arg_msg = &utbuf.buf; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; int32 forced_return_CF_WriteTxnQueueDataToFile = 0; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); memset(&utbuf, 0, sizeof(utbuf)); @@ -3366,7 +3358,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) /* valid result from CF_WriteTxnQueueDataToFile */ UT_SetDefaultReturnValue(UT_KEY(CF_WriteTxnQueueDataToFile), forced_return_CF_WriteTxnQueueDataToFile); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdWriteQueue(arg_msg); @@ -3378,7 +3370,7 @@ void Test_CF_CmdWriteQueue_Success_type_DownAnd_q_Pend(void) UT_CF_AssertEventID(CF_EID_INF_CMD_WQ); UtAssert_STUB_COUNT(CF_WrappedClose, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } /******************************************************************************* @@ -3524,10 +3516,9 @@ void Test_CF_CmdGetSetParam(void) uint16 expected_count; memset(&ut_config_table, 0, sizeof(ut_config_table)); - CF_AppData.HkPacket.CommandCounter = 0; - CF_AppData.HkPacket.CommandErrorCounter = 0; - CF_AppData.config_table = &ut_config_table; - expected_count = 0; + memset(&CF_AppData.hk.counters, 0, sizeof(CF_AppData.hk.counters)); + CF_AppData.config_table = &ut_config_table; + expected_count = 0; /* Nominal: "set" for each parameter */ for (param_id = 0; param_id < CF_GetSet_ValueID_MAX; ++param_id) @@ -3535,7 +3526,7 @@ void Test_CF_CmdGetSetParam(void) UT_CF_ResetEventCapture(); UtAssert_VOIDCALL(CF_CmdGetSetParam(1, param_id, 1 + param_id, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_INF_CMD_GETSET1); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, ++expected_count); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, ++expected_count); } /* each of the config parameters should have actually been set to a different value */ @@ -3556,27 +3547,27 @@ void Test_CF_CmdGetSetParam(void) UT_CF_ResetEventCapture(); UtAssert_VOIDCALL(CF_CmdGetSetParam(0, param_id, 1, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_INF_CMD_GETSET2); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, ++expected_count); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, ++expected_count); } /* Bad param ID */ UT_CF_ResetEventCapture(); UtAssert_VOIDCALL(CF_CmdGetSetParam(0, CF_GetSet_ValueID_MAX, 0, UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_PARAM); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); /* Bad channel ID */ UT_CF_ResetEventCapture(); UtAssert_VOIDCALL(CF_CmdGetSetParam(0, 0, 0, CF_NUM_CHANNELS + 1)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_CHAN); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 2); /* Validation fail */ UT_CF_ResetEventCapture(); UtAssert_VOIDCALL(CF_CmdGetSetParam(1, CF_GetSet_ValueID_outgoing_file_chunk_size, 100 + sizeof(CF_CFDP_PduFileDataContent_t), UT_CFDP_CHANNEL)); UT_CF_AssertEventID(CF_EID_ERR_CMD_GETSET_VALIDATE); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 3); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 3); } /******************************************************************************* @@ -3608,7 +3599,7 @@ void Test_CF_CmdSetParam_Call_CF_CmdGetSetParam_With_cmd_key_And_cmd_value(void) UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_CMD_GETSET1); /* Assert for incremented counter() */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); } /******************************************************************************* @@ -3639,7 +3630,7 @@ void Test_CF_CmdGetParam_Call_CF_CmdGetSetParam_With_cmd_data_byte_0_AndConstant UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UtAssert_UINT32_EQ(UT_CF_CapturedEventIDs[0], CF_EID_INF_CMD_GETSET2); /* Assert for incremented counter() */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); } /******************************************************************************* @@ -3653,13 +3644,13 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableInitSuccessAndIncrementCmdCounte /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; uint32 forced_return_CF_CFDP_InitEngine = CFE_SUCCESS; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); CF_AppData.engine.enabled = 0; /* 0 is not enabled */ UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_InitEngine), forced_return_CF_CFDP_InitEngine); - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdEnableEngine(arg_msg); @@ -3671,7 +3662,7 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableInitSuccessAndIncrementCmdCounte UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_ENABLE_ENGINE); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementErrCounter(void) @@ -3679,13 +3670,13 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementEr /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; uint32 forced_return_CF_CFDP_InitEngine = Any_uint32_Except(CFE_SUCCESS); - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); CF_AppData.engine.enabled = 0; /* 0 is not enabled */ UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_InitEngine), forced_return_CF_CFDP_InitEngine); - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdEnableEngine(arg_msg); @@ -3697,18 +3688,18 @@ void Test_CF_CmdEnableEngine_WithEngineNotEnableFailsInitSendEventAndIncrementEr UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENABLE_ENGINE); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } void Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounter(void) { /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); CF_AppData.engine.enabled = 1; /* 1 is enabled */ - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdEnableEngine(arg_msg); @@ -3720,7 +3711,7 @@ void Test_CF_CmdEnableEngine_WithEngineEnableFailsSendEventAndIncrementErrCounte UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENG_ALREADY_ENA); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); } /******************************************************************************* @@ -3733,11 +3724,11 @@ void Test_CF_CmdDisableEngine_SuccessWhenEngineEnabledAndIncrementCmdCounter(voi { /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; - uint8 initial_hk_cmd_counter = Any_uint8(); + uint16 initial_hk_cmd_counter = Any_uint16(); CF_AppData.engine.enabled = 1; /* 1 is enabled */ - CF_AppData.HkPacket.CommandCounter = initial_hk_cmd_counter; + CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; /* Act */ CF_CmdDisableEngine(arg_msg); @@ -3748,18 +3739,18 @@ void Test_CF_CmdDisableEngine_SuccessWhenEngineEnabledAndIncrementCmdCounter(voi UT_CF_AssertEventID(CF_EID_INF_CMD_DISABLE_ENGINE); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, (initial_hk_cmd_counter + 1) & 0xFF); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); } void Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail(void) { /* Arrange */ CFE_SB_Buffer_t *arg_msg = NULL; - uint8 initial_hk_err_counter = Any_uint8(); + uint16 initial_hk_err_counter = Any_uint16(); CF_AppData.engine.enabled = 0; /* 0 is not enabled */ - CF_AppData.HkPacket.CommandErrorCounter = initial_hk_err_counter; + CF_AppData.hk.counters.err = initial_hk_err_counter; /* Act */ CF_CmdDisableEngine(arg_msg); @@ -3769,10 +3760,10 @@ void Test_CF_CmdDisableEngine_WhenEngineDisabledAndIncrementErrCounterThenFail(v UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_ENG_ALREADY_DIS); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, (initial_hk_err_counter + 1) & 0xFF); - UtAssert_True(CF_AppData.HkPacket.CommandErrorCounter == (uint16)(initial_hk_err_counter + 1), - "CF_AppData.HkPacket.CommandErrorCounter is %d and should be 1 more than %d", - CF_AppData.HkPacket.CommandErrorCounter, initial_hk_err_counter); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, (initial_hk_err_counter + 1) & 0xFFFF); + UtAssert_True(CF_AppData.hk.counters.err == (uint16)(initial_hk_err_counter + 1), + "CF_AppData.hk.counters.err is %d and should be 1 more than %d", CF_AppData.hk.counters.err, + initial_hk_err_counter); } /******************************************************************************* @@ -3803,7 +3794,7 @@ void Test_CF_ProcessGroundCommand_When_cmd_EqTo_CF_NUM_COMMANDS_FailAndSendEvent UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_CC); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } void Test_CF_ProcessGroundCommand_When_cmd_GreaterThan_CF_NUM_COMMANDS_FailAndSendEvent(void) @@ -3828,7 +3819,7 @@ void Test_CF_ProcessGroundCommand_When_cmd_GreaterThan_CF_NUM_COMMANDS_FailAndSe UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_CC); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } void Test_CF_ProcessGroundCommand_Receives_cmd_AndLengthDoesNotMatchExpectedForThatCommandSendEventAndFailure(void) @@ -3855,7 +3846,7 @@ void Test_CF_ProcessGroundCommand_Receives_cmd_AndLengthDoesNotMatchExpectedForT UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_ERR_CMD_GCMD_LEN); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 1); } void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x00_AndCall_CF_CmdNoop_With_msg(void) @@ -3883,7 +3874,7 @@ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x00_AndCall_CF_CmdNoop_With_m UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); UT_CF_AssertEventID(CF_EID_INF_CMD_NOOP); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 1); } /* Hit a NULL entry to exercise that conditional and no action */ @@ -3909,8 +3900,8 @@ void Test_CF_ProcessGroundCommand_ReceivesCmdCode_0x0C_AndDoNothingBecause_fns_1 UtAssert_STUB_COUNT(CFE_MSG_GetSize, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* Assert for incremented counter */ - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandCounter, 0); - UtAssert_UINT32_EQ(CF_AppData.HkPacket.CommandErrorCounter, 0); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, 0); + UtAssert_UINT32_EQ(CF_AppData.hk.counters.err, 0); } /******************************************************************************* @@ -4404,4 +4395,4 @@ void UtTest_Setup(void) add_CF_CmdDisableEngine_tests(); add_CF_ProcessGroundCommand_tests(); -} \ No newline at end of file +} diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index 130ef59e..55dbd372 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -127,7 +127,7 @@ void Test_CF_ResetHistory(void) memset(&h, 0, sizeof(h)); - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 4; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 4; /* nominal call */ UtAssert_VOIDCALL(CF_ResetHistory(&CF_AppData.engine.channels[UT_CFDP_CHANNEL], &h)); @@ -145,10 +145,10 @@ void Test_CF_FindUnusedTransaction(void) memset(&hist, 0, sizeof(hist)); memset(&txn, 0, sizeof(txn)); memset(&CF_AppData, 0, sizeof(CF_AppData)); - c = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_FREE] = 2; - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST_FREE] = 1; - CF_AppData.HkPacket.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 1; + c = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_FREE] = 2; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST_FREE] = 1; + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 1; UtAssert_NULL(CF_FindUnusedTransaction(c)); @@ -272,12 +272,12 @@ void Test_cf_dequeue_transaction_Call_CF_CList_Remove_AndDecrement_q_size(void) expected_head = &CF_AppData.engine.channels[arg_t.chan_num].qs[arg_t.flags.com.q_index]; expected_cl_node = &arg_t.cl_node; - CF_AppData.HkPacket.channel_hk[arg_t.chan_num].q_size[arg_t.flags.com.q_index] = initial_q_size; + CF_AppData.hk.channel_hk[arg_t.chan_num].q_size[arg_t.flags.com.q_index] = initial_q_size; /* Act */ CF_DequeueTransaction(&arg_t); - updated_q_size = CF_AppData.HkPacket.channel_hk[arg_t.chan_num].q_size[arg_t.flags.com.q_index]; + updated_q_size = CF_AppData.hk.channel_hk[arg_t.chan_num].q_size[arg_t.flags.com.q_index]; /* Assert */ UtAssert_ADDRESS_EQ(context_clist_remove.head, expected_head); @@ -317,7 +317,7 @@ void Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q( expected_insert_back_node = &arg_t->cl_node; /* Queue size needes to be >= 1 */ - CF_AppData.HkPacket.channel_hk[arg_t->chan_num].q_size[arg_t->flags.com.q_index] = 1; + CF_AppData.hk.channel_hk[arg_t->chan_num].q_size[arg_t->flags.com.q_index] = 1; /* Act */ CF_MoveTransaction(arg_t, arg_q); @@ -355,12 +355,12 @@ void Test_CF_CList_Remove_Ex_Call_CF_CList_Remove_AndDecrement_q_size(void) expected_remove_head = &arg_c->qs[arg_index]; expected_remove_node = arg_node; - CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; + CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; /* Act */ CF_CList_Remove_Ex(arg_c, arg_index, arg_node); - updated_q_size = CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; + updated_q_size = CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; /* Assert */ UtAssert_STUB_COUNT(CF_CList_Remove, 1); @@ -390,12 +390,12 @@ void Test_CF_CList_InsertAfter_Ex_Call_CF_CList_InsertAfter_AndIncrement_q_size( UT_SetDataBuffer(UT_KEY(CF_CList_InsertAfter), &context_CF_CList_InsertAfter, sizeof(context_CF_CList_InsertAfter), false); - CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; + CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; /* Act */ CF_CList_InsertAfter_Ex(arg_c, arg_index, arg_start, arg_after); - updated_q_size = CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; + updated_q_size = CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; /* Assert */ UtAssert_STUB_COUNT(CF_CList_InsertAfter, 1); @@ -426,12 +426,12 @@ void Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size(vo expected_insert_back_head = &arg_c->qs[arg_index]; expected_insert_back_node = arg_node; - CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; + CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index] = initial_q_size; /* Act */ CF_CList_InsertBack_Ex(arg_c, arg_index, arg_node); - updated_q_size = CF_AppData.HkPacket.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; + updated_q_size = CF_AppData.hk.channel_hk[arg_c - CF_AppData.engine.channels].q_size[arg_index]; /* Assert */ UtAssert_STUB_COUNT(CF_CList_InsertBack, 1);