Skip to content
Open
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
6 changes: 6 additions & 0 deletions fsw/src/cf_cfdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,12 @@ bool CF_CFDP_StartFirstPending(CF_Channel_t *chan)
{
CF_Transaction_t *txn;

if (!chan->config.dequeue_enabled)
{
/* dequeue is disabled on this channel, leave pending transactions on the PEND queue */
return false;
}

if (chan->qs[CF_QueueIdx_PEND] == NULL)
{
/* nothing pending */
Expand Down
5 changes: 5 additions & 0 deletions fsw/src/cf_cfdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,13 @@ void CF_CFDP_SetupTxTransaction(CF_Transaction_t *txn);
* and prepares for it to be activated.
*
* @par Assumptions, External Events, and Notes:
* Nothing is pulled while dequeue is disabled on the channel. Transactions
* that are already active are not affected.
*
* @param chan Channel pointer
*
* @retval true if a pending transaction was started
* @retval false if dequeue is disabled or the PEND queue is empty
*/
bool CF_CFDP_StartFirstPending(CF_Channel_t *chan);

Expand Down
15 changes: 11 additions & 4 deletions unit-test/cf_cfdp_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1848,14 +1848,21 @@ void Test_CF_CFDP_StartFirstPending(void)
UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, &txn, NULL);

/* nothing pending */
chan->config.dequeue_enabled = true;
UtAssert_BOOL_FALSE(CF_CFDP_StartFirstPending(chan));

txn->flags.com.q_index = CF_QueueIdx_PEND;
chan->qs[CF_QueueIdx_PEND] = &txn->cl_node;

/* this dequeues */
txn->flags.com.q_index = CF_QueueIdx_PEND;
chan->qs[CF_QueueIdx_PEND] = &txn->cl_node;
chan->stat.q_size[txn->flags.com.q_index] = 1;

/* dequeue disabled, the transaction must stay on the PEND queue */
chan->config.dequeue_enabled = false;
UtAssert_BOOL_FALSE(CF_CFDP_StartFirstPending(chan));
UtAssert_ADDRESS_EQ(chan->qs[CF_QueueIdx_PEND], &txn->cl_node);
UtAssert_UINT32_EQ(txn->flags.com.q_index, CF_QueueIdx_PEND);

/* this dequeues */
chan->config.dequeue_enabled = true;
UtAssert_BOOL_TRUE(CF_CFDP_StartFirstPending(chan));
}

Expand Down
Loading