Support ACK Timeout event on radio layer. (#1866)

* Support ACK Timeout event on radio layer.
This commit is contained in:
Xiao Ma
2017-06-02 09:00:33 -07:00
committed by Jonathan Hui
parent 8872e292eb
commit 0cbb0898e1
3 changed files with 27 additions and 30 deletions
@@ -35,14 +35,6 @@
#ifndef OPENTHREAD_CORE_EFR32_CONFIG_H_
#define OPENTHREAD_CORE_EFR32_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT
*
* Define to 1 if you want to enable software ACK timeout logic.
*
*/
#define OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT 1
/**
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT
*
+23 -18
View File
@@ -298,10 +298,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
if (!sIsReceiverEnabled)
{
if (RAIL_RxStart(aChannel))
{
assert(false);
}
otEXPECT_ACTION(RAIL_RxStart(aChannel) == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
sIsReceiverEnabled = true;
}
@@ -315,8 +312,10 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
{
otError error = OT_ERROR_NONE;
RAIL_CsmaConfig_t csmaConfig = RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA;
RAIL_TxData_t tx_data;
RAIL_TxData_t txData;
RAIL_TxOptions_t txOption;
uint8_t frame[IEEE802154_MAX_LENGTH + 1];
bool isAckRequested = (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST) ? true : false;
(void)aInstance;
CORE_DECLARE_IRQ_STATE;
@@ -332,20 +331,25 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
frame[0] = aFrame->mLength;
memcpy(frame + 1, aFrame->mPsdu, aFrame->mLength);
tx_data.dataPtr = frame;
tx_data.dataLength = aFrame->mLength - 1;
txData.dataPtr = frame;
txData.dataLength = aFrame->mLength - 1;
RAIL_TxPowerSet(aFrame->mPower);
setChannel(aFrame->mChannel);
RAIL_RfIdleExt(RAIL_IDLE, true);
if (RAIL_TxDataLoad(&tx_data))
{
assert(false);
}
otEXPECT_ACTION(RAIL_TxDataLoad(&txData) == RAIL_STATUS_NO_ERROR, error = OT_ERROR_FAILED);
if (RAIL_TxStart(aFrame->mChannel, RAIL_CcaCsma, &csmaConfig))
if (isAckRequested)
{
assert(false);
otEXPECT_ACTION(RAIL_TxStart(aFrame->mChannel, RAIL_CcaCsma, &csmaConfig) == RAIL_STATUS_NO_ERROR,
error = OT_ERROR_FAILED);
}
else
{
txOption.waitForAck = false;
otEXPECT_ACTION(RAIL_TxStartWithOptions(aFrame->mChannel, &txOption, RAIL_CcaCsma, &csmaConfig) == RAIL_STATUS_NO_ERROR,
error = OT_ERROR_FAILED);
}
exit:
@@ -368,7 +372,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
(void)aInstance;
return OT_RADIO_CAPS_NONE;
return OT_RADIO_CAPS_ACK_TIMEOUT;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
@@ -758,6 +762,11 @@ void efr32RadioProcess(otInstance *aInstance)
CORE_EXIT_CRITICAL();
}
void RAILCb_RxAckTimeout(void)
{
sTransmitError = OT_ERROR_NO_ACK;
}
void RAILCb_RfReady(void)
{
}
@@ -766,10 +775,6 @@ void RAILCb_CalNeeded(void)
{
}
void RAILCb_RxAckTimeout(void)
{
}
void RAILCb_RxRadioStatus(uint8_t aStatus)
{
(void)aStatus;
+4 -4
View File
@@ -66,7 +66,7 @@ extern "C" {
enum
{
OT_RADIO_FRAME_MAX_SIZE = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006)
OT_RADIO_FRAME_MAX_SIZE = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006)
OT_RADIO_CHANNEL_MIN = 11, ///< 2.4 GHz IEEE 802.15.4-2006
OT_RADIO_CHANNEL_MAX = 26, ///< 2.4 GHz IEEE 802.15.4-2006
OT_RADIO_SUPPORTED_CHANNELS = 0xffff << OT_RADIO_CHANNEL_MIN, ///< 2.4 GHz IEEE 802.15.4-2006
@@ -116,9 +116,9 @@ typedef struct otRadioFrame
typedef enum otRadioState
{
OT_RADIO_STATE_DISABLED = 0,
OT_RADIO_STATE_SLEEP = 1,
OT_RADIO_STATE_RECEIVE = 2,
OT_RADIO_STATE_TRANSMIT = 3
OT_RADIO_STATE_SLEEP = 1,
OT_RADIO_STATE_RECEIVE = 2,
OT_RADIO_STATE_TRANSMIT = 3,
} otRadioState;
/**