Skip to content

Commit

Permalink
Update Radio layer to handle radio queue limit during transmissions
Browse files Browse the repository at this point in the history
  • Loading branch information
adabreuti committed Aug 28, 2023
1 parent a9dd46d commit e61f379
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ static RF_CmdHandle rfCoreSendTransmitCmd(otInstance *aInstance, RF_Handle aRfHa
RF_Op *op;

RF_ScheduleCmdParams_init(&rfScheduleCmdParams);
sCsmaCmd = RF_cmdIeeeCsma;
sCsmaCmd = RF_cmdIeeeCsma;
sTransmitCmd = RF_cmdIeeeTx;
sRxAckCmd = RF_cmdIeeeRxAck;
sRxAckCmd = RF_cmdIeeeRxAck;

// remove 2 octets for CRC, generated by hardware
sTransmitCmd.payloadLen = aFrame->mLength - 2;
Expand Down Expand Up @@ -1608,7 +1608,6 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
otRadioFrame temp_frame = *aFrame; // this is likely sTransmitFrame
sTransmitPending = true;
sTransmitFrame = temp_frame;

error = OT_ERROR_NONE;
}
else if (sState == platformRadio_phyState_Receive)
Expand Down Expand Up @@ -2193,6 +2192,7 @@ static void platformRadioProcessTransmitDone(otInstance * aInstance,
otRadioFrame *aAckFrame,
otError aTransmitError)
{
if (sTransmitCmd.pPayload != NULL) {
/* clear the pseudo-transmit-active flag */
sTransmitCmd.pPayload = NULL;

Expand All @@ -2205,6 +2205,7 @@ static void platformRadioProcessTransmitDone(otInstance * aInstance,
#endif /* OPENTHREAD_CONFIG_DIAG_ENABLE */
{
otPlatRadioTxDone(aInstance, aTransmitFrame, aAckFrame, aTransmitError);
}
}
}

Expand Down Expand Up @@ -2629,13 +2630,20 @@ void platformRadioProcess(otInstance *aInstance, uintptr_t arg)
if (arg & RF_EVENT_BUF_FULL)
{
clearRxQueue();
sTransmitError = OT_ERROR_ABORT;
handleTxState(aInstance, RF_EVENT_TX_DONE);
}

/* Re-start the RX command since we are still in the state. */
if (arg & RF_EVENT_RX_CMD_STOP)
{
rfCoreSendReceiveCmd(sRfHandle);
sState = platformRadio_phyState_Receive;
if ((sTransmitCmd.pPayload != NULL) && (sTransmitCmd.pPayload[0] & IEEE802154_ACK_REQUEST))
{
sTransmitError = OT_ERROR_NO_ACK;
}
handleTxState(aInstance, RF_EVENT_TX_DONE);
}
}
break;
Expand Down Expand Up @@ -2724,4 +2732,3 @@ void platformRadioProcess(otInstance *aInstance, uintptr_t arg)
break;
}
}

0 comments on commit e61f379

Please sign in to comment.