diff --git a/src/src/radio.c b/src/src/radio.c index 02efeaf..dc2efce 100644 --- a/src/src/radio.c +++ b/src/src/radio.c @@ -102,9 +102,8 @@ static otRadioFrame sTransmitFrame; static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE + 1]; #if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT -static otExtAddress sExtAddress; -static otRadioIeInfo sTransmitIeInfo; -static otInstance *sInstance = NULL; +static otExtAddress sExtAddress; +static otInstance *sInstance = NULL; #endif static otRadioFrame sAckFrame; @@ -172,9 +171,6 @@ static void dataInit(void) sDefaultTxPower = OT_RADIO_POWER_INVALID; sTransmitFrame.mPsdu = sTransmitPsdu + 1; -#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT - sTransmitFrame.mInfo.mTxInfo.mIeInfo = &sTransmitIeInfo; -#endif sReceiveError = OT_ERROR_NONE; @@ -534,10 +530,11 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) otMacFrameSetFrameCounter(aFrame, sMacFrameCounter++); } - if (aFrame->mInfo.mTxInfo.mTxDelay != 0) + if (aFrame->mInfo.mTxInfo.mTimeInfo.mDelayInfo.mTxDelay != 0) { - if (!nrf_802154_transmit_raw_at(&aFrame->mPsdu[-1], true, aFrame->mInfo.mTxInfo.mTxDelayBaseTime, - aFrame->mInfo.mTxInfo.mTxDelay, aFrame->mChannel)) + if (!nrf_802154_transmit_raw_at(&aFrame->mPsdu[-1], true, + aFrame->mInfo.mTxInfo.mTimeInfo.mDelayInfo.mTxDelayBaseTime, + aFrame->mInfo.mTxInfo.mTimeInfo.mDelayInfo.mTxDelay, aFrame->mChannel)) { error = OT_ERROR_INVALID_STATE; } @@ -1220,7 +1217,7 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) #if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT void nrf_802154_tx_started(const uint8_t *aFrame) { - bool processSecurity = false; + uint64_t now = otPlatTimeGet(); assert(aFrame == sTransmitPsdu); OT_UNUSED_VARIABLE(aFrame); @@ -1234,22 +1231,7 @@ void nrf_802154_tx_started(const uint8_t *aFrame) // Update IE and secure transmit frame #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE - if (sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset != 0) - { - uint8_t *timeIe = sTransmitFrame.mPsdu + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeIeOffset; - uint64_t time = otPlatTimeGet() + sTransmitFrame.mInfo.mTxInfo.mIeInfo->mNetworkTimeOffset; - - *timeIe = sTransmitFrame.mInfo.mTxInfo.mIeInfo->mTimeSyncSeq; - - *(++timeIe) = (uint8_t)(time & 0xff); - for (uint8_t i = 1; i < sizeof(uint64_t); i++) - { - time = time >> 8; - *(++timeIe) = (uint8_t)(time & 0xff); - } - - processSecurity = true; - } + otMacFrameUpdateTimeIe(&sTransmitFrame, now); #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE #if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 @@ -1257,11 +1239,9 @@ void nrf_802154_tx_started(const uint8_t *aFrame) !sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed); sTransmitFrame.mInfo.mTxInfo.mAesKey = &sCurrKey; - - processSecurity = true; #endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 - otEXPECT(processSecurity); + otEXPECT(!sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed); otMacFrameProcessTransmitAesCcm(&sTransmitFrame, &sExtAddress); exit: