diff --git a/docs/cf_FunctionalRequirements.csv b/docs/cf_FunctionalRequirements.csv index aa713b11..c10a5d98 100644 --- a/docs/cf_FunctionalRequirements.csv +++ b/docs/cf_FunctionalRequirements.csv @@ -91,7 +91,6 @@ CF5002.3,CF5002.3,"When CF receives a ""Set CFDP Channel Protocol Configuration" CF5002.4,CF5002.4,"When CF receives a ""Set CFDP Channel Protocol Configuration"" command, if the command-specified parameter *value* is invalid, CF shall reject the command.",Command validity check for robust operation CF5003,CF5003,"When CF receives a ""Get CFDP Channel-Protocol Configuration Parameter"" command, CF shall issue an event message containing the current value of the command-specified configuration-table parameter.",Operational interface CF5003.1,CF5003.1,"When CF receives a ""Get CFDP Channel-Protocol Configuration Parameter"" command, if the command-specified parameter is invalid, CF shall reject the command. ",Operational robustness -CF5004,CF5004,"When CF receives a ""Get Full CFDP Channel-Protocol Configuration"" command, CF shall publish all CFDP Channel Protocol Configuration parameters to a cFS-SB message. ",Compatibility with cFE App behavior. Message can be downlinked as Housekeeping Data or sent to another app for consumption CF5005,CF5005,"When CF receives a ""Cancel Transaction"" command, CF shall cancel the transaction indicated by the command-specified Entity ID and transaction-sequence number.",Support an operational interface to control transactions. Transaction-Id provides a mechanism to scale to large systems and avoid performance issues with string searches CF5005.1,CF5005.1,"When CF receives a ""Cancel Transaction"" command, if the command-specified transaction is not in progress, CF shall reject the command.",Support an operational interface to provide operator feedback. CF5006,CF5006,"When CF receives an ""Abandon Transaction"" command, CF shall abandon the command-specified transaction.",Support an operational interface to provide operator feedback. diff --git a/fsw/src/cf_app.c b/fsw/src/cf_app.c index d14671be..3f8acf04 100644 --- a/fsw/src/cf_app.c +++ b/fsw/src/cf_app.c @@ -326,7 +326,6 @@ int32 CF_Init(void) CF_AppData.run_status = CFE_ES_RunStatus_APP_RUN; CFE_MSG_Init(&CF_AppData.hk.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_HK_TLM_MID), sizeof(CF_AppData.hk)); - CFE_MSG_Init(&CF_AppData.cfg.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_CONFIG_TLM_MID), sizeof(CF_AppData.cfg)); status = CFE_EVS_Register(cf_event_filters, sizeof(cf_event_filters) / sizeof(*cf_event_filters), CFE_EVS_EventFilter_BINARY); diff --git a/fsw/src/cf_app.h b/fsw/src/cf_app.h index 8cf7511f..ce0111f4 100644 --- a/fsw/src/cf_app.h +++ b/fsw/src/cf_app.h @@ -52,8 +52,7 @@ */ typedef struct { - CF_HkPacket_t hk; - CF_ConfigPacket_t cfg; + CF_HkPacket_t hk; uint32 run_status; diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 3145aeba..205d9538 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -128,7 +128,7 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical *-----------------------------------------------------------------*/ void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) { - CF_Timer_InitRelSec(&t->ack_timer, CF_AppData.config_table->ack_timer_s); + CF_Timer_InitRelSec(&t->ack_timer, CF_AppData.config_table->chan[t->chan_num].ack_timer_s); t->flags.com.ack_timer_armed = 1; } @@ -169,7 +169,7 @@ static inline int CF_CFDP_IsSender(CF_Transaction_t *ti) *-----------------------------------------------------------------*/ static inline void CF_CFDP_ArmInactTimer(CF_Transaction_t *t) { - CF_Timer_InitRelSec(&t->inactivity_timer, CF_AppData.config_table->inactivity_timer_s); + CF_Timer_InitRelSec(&t->inactivity_timer, CF_AppData.config_table->chan[t->chan_num].inactivity_timer_s); } /*---------------------------------------------------------------- diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 644473e1..d690396a 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -162,7 +162,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) ++t->state_data.r.r2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->nak_limit) + if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].nak_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_NAK_LIMIT, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): nak limited reach", (t->state == CF_TxnState_R2), @@ -1057,7 +1057,7 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) ++t->state_data.r.r2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->ack_limit) + if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].ack_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF R2(%lu:%lu): ack limit reached, no fin-ack", diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index 9aa76d3d..6f141957 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -752,7 +752,7 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) ++t->state_data.s.s2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.s.s2.acknak_count >= CF_AppData.config_table->ack_limit) + if (t->state_data.s.s2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].ack_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF S2(%lu:%lu), ack limit reached, no eof-ack", diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index 3c90f22f..8937e12e 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -833,32 +833,6 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) CF_CmdRej(); } -/*---------------------------------------------------------------- - * - * Function: CF_CmdSendCfgParams - * - * Application-scope internal function - * See description in cf_cmd.h for argument/return detail - * - *-----------------------------------------------------------------*/ -void CF_CmdSendCfgParams(CFE_SB_Buffer_t *msg) -{ - CF_AppData.cfg.ticks_per_second = CF_AppData.config_table->ticks_per_second; - CF_AppData.cfg.rx_crc_calc_bytes_per_wakeup = CF_AppData.config_table->rx_crc_calc_bytes_per_wakeup; - CF_AppData.cfg.ack_timer_s = CF_AppData.config_table->ack_timer_s; - CF_AppData.cfg.nak_timer_s = CF_AppData.config_table->nak_timer_s; - CF_AppData.cfg.inactivity_timer_s = CF_AppData.config_table->inactivity_timer_s; - CF_AppData.cfg.outgoing_file_chunk_size = CF_AppData.config_table->outgoing_file_chunk_size; - CF_AppData.cfg.ack_limit = CF_AppData.config_table->ack_limit; - CF_AppData.cfg.nak_limit = CF_AppData.config_table->nak_limit; - CF_AppData.cfg.local_eid = CF_AppData.config_table->local_eid; - - CFE_MSG_SetMsgTime(&CF_AppData.cfg.tlm_header.Msg, CFE_TIME_GetTime()); - /* return value ignored */ CFE_SB_TransmitMsg(&CF_AppData.cfg.tlm_header.Msg, true); - - CF_CmdAcc(); -} - /*---------------------------------------------------------------- * * Function: CF_CmdValidateChunkSize @@ -934,16 +908,16 @@ void CF_CmdGetSetParam(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, item.size = sizeof(config->rx_crc_calc_bytes_per_wakeup); break; case CF_GetSet_ValueID_ack_timer_s: - item.ptr = &config->ack_timer_s; - item.size = sizeof(config->ack_timer_s); + item.ptr = &config->chan[chan_num].ack_timer_s; + item.size = sizeof(config->chan[chan_num].ack_timer_s); break; case CF_GetSet_ValueID_nak_timer_s: - item.ptr = &config->nak_timer_s; - item.size = sizeof(config->nak_timer_s); + item.ptr = &config->chan[chan_num].nak_timer_s; + item.size = sizeof(config->chan[chan_num].nak_timer_s); break; case CF_GetSet_ValueID_inactivity_timer_s: - item.ptr = &config->inactivity_timer_s; - item.size = sizeof(config->inactivity_timer_s); + item.ptr = &config->chan[chan_num].inactivity_timer_s; + item.size = sizeof(config->chan[chan_num].inactivity_timer_s); break; case CF_GetSet_ValueID_outgoing_file_chunk_size: item.ptr = &config->outgoing_file_chunk_size; @@ -951,12 +925,12 @@ void CF_CmdGetSetParam(uint8 is_set, CF_GetSet_ValueID_t param_id, uint32 value, item.fn = CF_CmdValidateChunkSize; break; case CF_GetSet_ValueID_ack_limit: - item.ptr = &config->ack_limit; - item.size = sizeof(config->ack_limit); + item.ptr = &config->chan[chan_num].ack_limit; + item.size = sizeof(config->chan[chan_num].ack_limit); break; case CF_GetSet_ValueID_nak_limit: - item.ptr = &config->nak_limit; - item.size = sizeof(config->nak_limit); + item.ptr = &config->chan[chan_num].nak_limit; + item.size = sizeof(config->chan[chan_num].nak_limit); break; case CF_GetSet_ValueID_local_eid: item.ptr = &config->local_eid; @@ -1161,7 +1135,7 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg) CF_CmdGetParam, /* CF_GET_MIB_PARAM_CC */ NULL, NULL, - CF_CmdSendCfgParams, /* CF_SendRet_CFG_PARAMS_CC */ + NULL, CF_CmdWriteQueue, /* CF_WRITE_QUEUE_CC */ CF_CmdEnableDequeue, /* CF_ENABLE_DEQUEUE_CC */ CF_CmdDisableDequeue, /* CF_DISABLE_DEQUEUE_CC */ diff --git a/fsw/src/cf_cmd.h b/fsw/src/cf_cmd.h index e2fd5cf1..69f2abb9 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -494,16 +494,6 @@ void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg); */ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg); -/************************************************************************/ -/** @brief Ground command to send configuration parameters. - * - * @par Assumptions, External Events, and Notes: - * msg must not be NULL. - * - * @param msg Pointer to command message - */ -void CF_CmdSendCfgParams(CFE_SB_Buffer_t *msg); - /************************************************************************/ /** @brief Checks if the value is less than or equal to the max pdu size. * diff --git a/fsw/src/cf_msg.h b/fsw/src/cf_msg.h index 7569c5a4..464abe56 100644 --- a/fsw/src/cf_msg.h +++ b/fsw/src/cf_msg.h @@ -105,27 +105,6 @@ typedef struct CF_HkPacket CF_HkChannel_Data_t channel_hk[CF_NUM_CHANNELS]; } CF_HkPacket_t; -/* used with CF_SendRet_CFG_PARAMS_CC */ -typedef struct CF_ConfigPacket -{ - CFE_MSG_TelemetryHeader_t tlm_header; - - uint32 ticks_per_second; /* expected ticks per second to cfdp app */ - uint32 rx_crc_calc_bytes_per_wakeup; /* max number of bytes per wakeup to calculate r2 crc for recvd file (must by - 1024-byte aligned */ - - uint32 ack_timer_s; /* in seconds */ - uint32 nak_timer_s; /* in seconds */ - uint32 inactivity_timer_s; /* in seconds */ - - uint16 outgoing_file_chunk_size; - uint8 ack_limit; /* number of times to retry ACK (for ex, send fin and wait for fin-ack) */ - uint8 nak_limit; /* number of times to retry NAK before giving up (resets on a single response */ - - CF_EntityId_t local_eid; - -} CF_ConfigPacket_t; - /**\}*/ /** @@ -139,20 +118,19 @@ typedef struct CF_ConfigPacket */ typedef enum { - CF_NOOP_CC = 0, - CF_RESET_CC = 1, - CF_TX_FILE_CC = 2, - CF_PLAYBACK_DIR_CC = 3, - CF_FREEZE_CC = 4, - CF_THAW_CC = 5, - CF_SUSPEND_CC = 6, - CF_RESUME_CC = 7, - CF_CANCEL_CC = 8, - CF_ABANDON_CC = 9, - CF_SET_MIB_PARAM_CC = 10, - CF_GET_MIB_PARAM_CC = 11, - CF_SendRet_CFG_PARAMS_CC = 14, - CF_WRITE_QUEUE_CC = 15, + CF_NOOP_CC = 0, + CF_RESET_CC = 1, + CF_TX_FILE_CC = 2, + CF_PLAYBACK_DIR_CC = 3, + CF_FREEZE_CC = 4, + CF_THAW_CC = 5, + CF_SUSPEND_CC = 6, + CF_RESUME_CC = 7, + CF_CANCEL_CC = 8, + CF_ABANDON_CC = 9, + CF_SET_MIB_PARAM_CC = 10, + CF_GET_MIB_PARAM_CC = 11, + CF_WRITE_QUEUE_CC = 15, /* NOTE: ENABLE/DISABLE commands should be a single command code, but legacy has them separate (ugh) */ CF_ENABLE_DEQUEUE_CC = 16, diff --git a/fsw/src/cf_tbldefs.h b/fsw/src/cf_tbldefs.h index 451286c5..122c6807 100644 --- a/fsw/src/cf_tbldefs.h +++ b/fsw/src/cf_tbldefs.h @@ -57,6 +57,13 @@ typedef struct CF_ChannelConfig uint32 max_outgoing_messages_per_wakeup; /**< \brief max number of messages to send per wakeup (0 - unlimited) */ uint32 rx_max_messages_per_wakeup; /**< \brief max number of rx messages to process per wakeup */ + uint32 ack_timer_s; /**< \brief Acknowledge timer in seconds */ + uint32 nak_timer_s; /**< \brief Non-acknowledge timer in seconds */ + uint32 inactivity_timer_s; /**< \brief Inactivity timer in seconds */ + + uint8 ack_limit; /**< number of times to retry ACK (for ex, send fin and wait for fin-ack) */ + uint8 nak_limit; /**< number of times to retry NAK before giving up (resets on a single response */ + CFE_SB_MsgId_Atom_t mid_input; /**< \brief msgid integer value for incoming messages */ CFE_SB_MsgId_Atom_t mid_output; /**< \brief msgid integer value for outgoing messages */ @@ -82,13 +89,6 @@ typedef struct CF_ConfigTable CF_ChannelConfig_t chan[CF_NUM_CHANNELS]; /**< \brief Channel configuration */ - uint32 ack_timer_s; /**< \brief Acknowledge timer in seconds */ - uint32 nak_timer_s; /**< \brief Non-acknowledge timer in seconds */ - uint32 inactivity_timer_s; /**< \brief Inactivity timer in seconds */ - - uint8 ack_limit; /**< number of times to retry ACK (for ex, send fin and wait for fin-ack) */ - uint8 nak_limit; /**< number of times to retry NAK before giving up (resets on a single response */ - uint16 outgoing_file_chunk_size; /**< maximum size of outgoing file data PDUs */ char tmp_dir[CF_FILENAME_MAX_PATH]; /**< directory to put temp files */ } CF_ConfigTable_t; diff --git a/fsw/tables/cf_def_config.c b/fsw/tables/cf_def_config.c index b031e550..91910bf0 100644 --- a/fsw/tables/cf_def_config.c +++ b/fsw/tables/cf_def_config.c @@ -30,8 +30,13 @@ CF_ConfigTable_t CF_config_table = { 16384, /* max number of bytes per wakeup to calculate r2 recv file crc */ 25, /* temp local id */ {{ - 5, /* max number of outgoing messages per wakeup */ - 5, /* max number of rx messages per wakeup */ + 5, /* max number of outgoing messages per wakeup */ + 5, /* max number of rx messages per wakeup */ + 3, /* ack timer */ + 3, /* nak timer */ + 30, /* inactivity timer */ + 4, /* ack limit */ + 4, /* nak limit */ 0x18c8, 0x08c2, 16, @@ -39,19 +44,19 @@ CF_ConfigTable_t CF_config_table = { "", /* throttle sem for channel 1, empty string means no throttle */ 1, }, - {5, /* max number of outgoing messages per wakeup */ - 5, /* max number of rx messages per wakeup */ + {5, /* max number of outgoing messages per wakeup */ + 5, /* max number of rx messages per wakeup */ + 3, /* ack timer */ + 3, /* nak timer */ + 30, /* inactivity timer */ + 4, /* ack limit */ + 4, /* nak limit */ 0x18c9, 0x08c3, 16, {{0}, {0}, {0}, {0}, {0}}, "", /* throttle sem for channel 2, empty string means no throttle */ 1}}, - 3, /* ack timer */ - 3, /* nak timer */ - 30, /* inactivity timer */ - 4, /* ack limit */ - 4, /* nak limit */ 480, /* outgoing_file_chunk_size */ "/cf/tmp", }; diff --git a/unit-test/cf_app_tests.c b/unit-test/cf_app_tests.c index 3e4ac3e3..180a0eb2 100644 --- a/unit-test/cf_app_tests.c +++ b/unit-test/cf_app_tests.c @@ -457,7 +457,7 @@ void Test_CF_Init_CallTo_CFE_EVS_Register_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wri result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); UtAssert_INT32_EQ(result, forced_return_CFE_MSG_Init); @@ -475,7 +475,7 @@ void Test_CF_Init_CallTo_CFE_SB_CreatePipe_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wr result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1); @@ -494,7 +494,7 @@ void Test_CF_Init_FirstCallTo_CFE_SB_Subscribe_ReturnsNot_CFE_SUCCESS_Call_CFE_E result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 1); @@ -517,7 +517,7 @@ void Test_CF_Init_CallTo_CF_TableInit_ReturnsNot_CFE_SUCCESS_ReturnErrorStatus(v result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); @@ -538,7 +538,7 @@ void Test_CF_Init_CallTo_CF_CFDP_InitEngine_ReturnsNot_CFE_SUCCESS_ReturnErrorSt result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); @@ -559,7 +559,7 @@ void Test_CF_Init_CallTo_CFE_EVS_SendEvent_ReturnsNot_CFE_SUCCESS_Call_CFE_ES_Wr result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_STUB_COUNT(CFE_EVS_Register, 1); UtAssert_STUB_COUNT(CFE_SB_CreatePipe, 1); UtAssert_STUB_COUNT(CFE_SB_Subscribe, 3); @@ -578,7 +578,7 @@ void Test_CF_Init_Success(void) result = CF_Init(); /* Assert */ - UtAssert_STUB_COUNT(CFE_MSG_Init, 2); + UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_INT32_EQ(result, CFE_SUCCESS); } /* end Test_CF_Init_Success */ diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index 2a509f56..2baf70c8 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -277,12 +277,12 @@ void Test_CF_CFDP_R_Tick(void) /* in R2 state, ack_timer_armed set, timer expires, finack substate */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); - config->ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_R2; + t->flags.com.ack_timer_armed = true; + t->flags.rx.inactivity_fired = true; + t->flags.rx.complete = true; + t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); @@ -290,13 +290,13 @@ void Test_CF_CFDP_R_Tick(void) /* same as above, but acknak limit reached */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); - config->ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; - t->state_data.r.r2.acknak_count = 9; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_R2; + t->flags.com.ack_timer_armed = true; + t->flags.rx.inactivity_fired = true; + t->flags.rx.complete = true; + t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + t->state_data.r.r2.acknak_count = 9; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); @@ -304,12 +304,12 @@ void Test_CF_CFDP_R_Tick(void) /* 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); - config->ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_EOF; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_R2; + t->flags.com.ack_timer_armed = true; + t->flags.rx.inactivity_fired = true; + t->flags.rx.complete = true; + t->state_data.r.sub_state = CF_RxSubState_EOF; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 3); @@ -501,7 +501,7 @@ void Test_CF_CFDP_R2_Complete(void) /* nominal, send nak */ UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, &config); - config->nak_limit = 2; + config->chan[t->chan_num].nak_limit = 2; UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 1)); UtAssert_BOOL_TRUE(t->flags.rx.send_nak); UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); @@ -516,8 +516,8 @@ void Test_CF_CFDP_R2_Complete(void) /* 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); - config->nak_limit = 2; - t->flags.rx.md_recv = true; + config->chan[t->chan_num].nak_limit = 2; + t->flags.rx.md_recv = true; UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 0)); UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index 6342b3f0..1954e8c0 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -266,21 +266,21 @@ void Test_CF_CFDP_S_Tick(void) /* in CF_TxnState_S2, ack_timer_armed + expiry + finack substate */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_S2; + t->flags.com.ack_timer_armed = true; + t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_SendEof, 1); /* same, with acklimit reached */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; - t->state_data.s.s2.acknak_count = 9; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_S2; + t->flags.com.ack_timer_armed = true; + t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + 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.hk.channel_hk[t->chan_num].counters.fault.ack_limit, 1); @@ -289,20 +289,20 @@ void Test_CF_CFDP_S_Tick(void) /* same, with CF_CFDP_S_SendEof no message */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_S2; + t->flags.com.ack_timer_armed = true; + t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SendRet_NO_MSG); UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); /* same, with CF_CFDP_S_SendEof Error */ UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + config->chan[t->chan_num].ack_limit = 10; + t->state = CF_TxnState_S2; + t->flags.com.ack_timer_armed = true; + t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SendRet_ERROR); UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 3); diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index 7dd1005b..37a43916 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -3559,74 +3559,6 @@ void Test_CF_CmdWriteQueue_SuccessCall_CF_CmdAcc_type_DownAnd_q_Pend(void) /* end CF_CmdWriteQueue tests */ -/******************************************************************************* -** -** CF_CmdSendCfgParams tests -** -*******************************************************************************/ - -void Test_CF_CmdSendCfgParams_Set_cfg_TimeStampAndSendMsg_AcceptCommand(void) -{ - /* Arrange */ - CFE_SB_Buffer_t utbuf; - CFE_SB_Buffer_t * arg_msg = &utbuf; - CF_ConfigTable_t dummy_config_table; - CFE_TIME_SysTime_t fake_time; - CFE_SB_TransmitMsg_context_t context_CFE_SB_TransmitMsg; - CFE_MSG_SetMsgTime_context_t context_CFE_MSG_SetMsgTime; - - memset(&utbuf, 0, sizeof(utbuf)); - - dummy_config_table.ticks_per_second = Any_uint32(); - dummy_config_table.rx_crc_calc_bytes_per_wakeup = Any_uint32(); - dummy_config_table.ack_timer_s = Any_uint32(); - dummy_config_table.nak_timer_s = Any_uint32(); - dummy_config_table.inactivity_timer_s = Any_uint32(); - dummy_config_table.outgoing_file_chunk_size = Any_uint16(); - dummy_config_table.ack_limit = Any_uint8(); - dummy_config_table.nak_limit = Any_uint8(); - dummy_config_table.local_eid = Any_uint8(); - - CF_AppData.config_table = &dummy_config_table; - - Any_CFE_TIME_SysTime_Set(&fake_time); - UT_SetDataBuffer(UT_KEY(CFE_TIME_GetTime), &fake_time, sizeof(fake_time), false); - - UT_SetHookFunction(UT_KEY(CFE_MSG_SetMsgTime), UT_Hook_CFE_MSG_SetMsgTime, &context_CFE_MSG_SetMsgTime); - UT_SetHookFunction(UT_KEY(CFE_SB_TransmitMsg), UT_Hook_CFE_SB_TransmitMsg, &context_CFE_SB_TransmitMsg); - - /* Arrange unstubbable: CF_CmdAcc */ - uint16 initial_hk_cmd_counter = Any_uint16(); - - CF_AppData.hk.counters.cmd = initial_hk_cmd_counter; - - /* Act */ - CF_CmdSendCfgParams(arg_msg); - - /* Assert */ - UtAssert_UINT32_EQ(CF_AppData.cfg.ticks_per_second, CF_AppData.config_table->ticks_per_second); - UtAssert_UINT32_EQ(CF_AppData.cfg.rx_crc_calc_bytes_per_wakeup, - CF_AppData.config_table->rx_crc_calc_bytes_per_wakeup); - UtAssert_UINT32_EQ(CF_AppData.cfg.ack_timer_s, CF_AppData.config_table->ack_timer_s); - UtAssert_UINT32_EQ(CF_AppData.cfg.nak_timer_s, CF_AppData.config_table->nak_timer_s); - UtAssert_UINT32_EQ(CF_AppData.cfg.inactivity_timer_s, CF_AppData.config_table->inactivity_timer_s); - UtAssert_UINT32_EQ(CF_AppData.cfg.outgoing_file_chunk_size, CF_AppData.config_table->outgoing_file_chunk_size); - UtAssert_UINT32_EQ(CF_AppData.cfg.ack_limit, CF_AppData.config_table->ack_limit); - UtAssert_UINT32_EQ(CF_AppData.cfg.nak_limit, CF_AppData.config_table->nak_limit); - UtAssert_UINT32_EQ(CF_AppData.cfg.local_eid, CF_AppData.config_table->local_eid); - UtAssert_STUB_COUNT(CFE_MSG_SetMsgTime, 1); - UtAssert_ADDRESS_EQ(context_CFE_MSG_SetMsgTime.MsgPtr, &CF_AppData.cfg.tlm_header.Msg); - UtAssert_UINT32_EQ(context_CFE_MSG_SetMsgTime.Time.Seconds, fake_time.Seconds); - UtAssert_UINT32_EQ(context_CFE_MSG_SetMsgTime.Time.Subseconds, fake_time.Subseconds); - UtAssert_STUB_COUNT(CFE_SB_TransmitMsg, 1); - UtAssert_ADDRESS_EQ(context_CFE_SB_TransmitMsg.MsgPtr, &CF_AppData.cfg.tlm_header.Msg); - UtAssert_BOOL_TRUE(context_CFE_SB_TransmitMsg.IncrementSequenceCount); - - /* Assert for CF_CmdAcc */ - UtAssert_UINT32_EQ(CF_AppData.hk.counters.cmd, (initial_hk_cmd_counter + 1) & 0xFFFF); - -} /* end Test_CF_CmdSendCfgParams_Set_cfg_TimeStampAndSendMsg_AcceptCommand */ - /******************************************************************************* ** ** CF_CmdValidateChunkSize tests @@ -3791,12 +3723,12 @@ void Test_CF_CmdGetSetParam(void) /* each of the config parameters should have actually been set to a different value */ UtAssert_UINT32_EQ(ut_config_table.ticks_per_second, 1); UtAssert_UINT32_EQ(ut_config_table.rx_crc_calc_bytes_per_wakeup, 2); - UtAssert_UINT32_EQ(ut_config_table.ack_timer_s, 3); - UtAssert_UINT32_EQ(ut_config_table.nak_timer_s, 4); - UtAssert_UINT32_EQ(ut_config_table.inactivity_timer_s, 5); + UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].ack_timer_s, 3); + UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].nak_timer_s, 4); + UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].inactivity_timer_s, 5); UtAssert_UINT32_EQ(ut_config_table.outgoing_file_chunk_size, 6); - UtAssert_UINT32_EQ(ut_config_table.ack_limit, 7); - UtAssert_UINT32_EQ(ut_config_table.nak_limit, 8); + UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].ack_limit, 7); + UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].nak_limit, 8); UtAssert_UINT32_EQ(ut_config_table.local_eid, 9); UtAssert_UINT32_EQ(ut_config_table.chan[UT_CFDP_CHANNEL].max_outgoing_messages_per_wakeup, 10); @@ -4676,12 +4608,6 @@ void add_CF_CmdWriteQueue_tests(void) cf_cmd_tests_Teardown, "Test_CF_CmdWriteQueue_SuccessCall_CF_CmdAcc_type_DownAnd_q_Pend"); } /* end add_CF_CmdWriteQueue_tests */ -void add_CF_CmdSendCfgParams_tests(void) -{ - UtTest_Add(Test_CF_CmdSendCfgParams_Set_cfg_TimeStampAndSendMsg_AcceptCommand, cf_cmd_tests_Setup, - cf_cmd_tests_Teardown, "Test_CF_CmdSendCfgParams_Set_cfg_TimeStampAndSendMsg_AcceptCommand"); -} /* end add_CF_CmdSendCfgParams_tests */ - void add_CF_CmdValidateChunkSize_tests(void) { UtTest_Add(Test_CF_CmdValidateChunkSize_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1, cf_cmd_tests_Setup, @@ -4841,8 +4767,6 @@ void UtTest_Setup(void) add_CF_CmdWriteQueue_tests(); - add_CF_CmdSendCfgParams_tests(); - add_CF_CmdValidateChunkSize_tests(); add_CF_CmdValidateMaxOutgoing_tests();