Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions fsw/inc/cf_eventids.h
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,17 @@
*/
#define CF_EID_INF_CFDP_BUF_EXCEED 166

/**
* \brief CF Disable Engine Pipe Delete Failed
*
* \par Type: ERROR
*
* \par Cause:
*
* Call to delete SB pipes when disabling CFDP engine fails
*/
#define CF_CFDP_DELETE_PIPE_ERR_EID 167

/**\}*/

#endif /* !CF_EVENTIDS_H */
11 changes: 10 additions & 1 deletion fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,7 @@ void CF_CFDP_DisableEngine(void)
int j;
static const CF_QueueIdx_t CLOSE_QUEUES[] = { CF_QueueIdx_RX, CF_QueueIdx_TX };
CF_Channel_t *chan;
CFE_Status_t delete_status;

CF_AppData.engine.enabled = false;

Expand Down Expand Up @@ -2326,7 +2327,15 @@ void CF_CFDP_DisableEngine(void)
/* finally all queue counters must be reset */
memset(&CF_AppData.hk.Payload.channel_hk[i].q_size, 0, sizeof(CF_AppData.hk.Payload.channel_hk[i].q_size));

CFE_SB_DeletePipe(chan->pipe);
delete_status = CFE_SB_DeletePipe(chan->pipe);

if (delete_status < CFE_SUCCESS)
{
CFE_EVS_SendEvent(CF_CFDP_DELETE_PIPE_ERR_EID,
CFE_EVS_EventType_ERROR,
"CF: failed to delete pipe for channel %d",
i);
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions unit-test/cf_cfdp_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,7 @@ void Test_CF_CFDP_SendEotPkt(void)

void Test_CF_CFDP_DisableEngine(void)
{
uint8 call_count_CFE_EVS_SendEvent;
/* Test case for:
* void CF_CFDP_DisableEngine(void)
*/
Expand All @@ -1509,6 +1510,13 @@ void Test_CF_CFDP_DisableEngine(void)
UtAssert_STUB_COUNT(CFE_SB_DeletePipe, CF_NUM_CHANNELS);
UtAssert_BOOL_FALSE(CF_AppData.engine.enabled);

/* Call where CFE_SB_DeletePipe fails */
UT_SetDefaultReturnValue(UT_KEY(CFE_SB_DeletePipe), -1);
UtAssert_VOIDCALL(CF_CFDP_DisableEngine());
call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
UtAssert_INT32_EQ(call_count_CFE_EVS_SendEvent, CF_NUM_CHANNELS);
UT_ClearDefaultReturnValue(UT_KEY(CFE_SB_DeletePipe));

/* nominal call with playbacks and polls active */
CF_AppData.engine.channels[UT_CFDP_CHANNEL].playback[0].busy = true;
OS_DirectoryOpen(&CF_AppData.engine.channels[UT_CFDP_CHANNEL].playback[0].dir_id, "ut");
Expand Down
Loading