diff --git a/examples/drivers/windows/otLwf/command.c b/examples/drivers/windows/otLwf/command.c index ac5f505ec..1168ebe48 100644 --- a/examples/drivers/windows/otLwf/command.c +++ b/examples/drivers/windows/otLwf/command.c @@ -934,7 +934,7 @@ _IRQL_requires_max_(PASSIVE_LEVEL) VOID otLwfCmdSendMacFrameAsync( _In_ PMS_FILTER pFilter, - _In_ RadioPacket* Packet + _In_ otRadioFrame* Packet ) { // Reset the completion event diff --git a/examples/drivers/windows/otLwf/command.h b/examples/drivers/windows/otLwf/command.h index 71572f5ea..2a73d8d11 100644 --- a/examples/drivers/windows/otLwf/command.h +++ b/examples/drivers/windows/otLwf/command.h @@ -140,7 +140,7 @@ _IRQL_requires_max_(PASSIVE_LEVEL) VOID otLwfCmdSendMacFrameAsync( _In_ PMS_FILTER pFilter, - _In_ RadioPacket* Packet + _In_ otRadioFrame* Packet ); // diff --git a/examples/drivers/windows/otLwf/eventprocessing.c b/examples/drivers/windows/otLwf/eventprocessing.c index a6b3db404..2e9eebeb7 100644 --- a/examples/drivers/windows/otLwf/eventprocessing.c +++ b/examples/drivers/windows/otLwf/eventprocessing.c @@ -1091,7 +1091,7 @@ otLwfEventWorkerThread( } // If we have a frame ready to transmit, do it now if we are allowed to transmit - if (pFilter->otPhyState == kStateTransmit && !pFilter->SendPending) + if (pFilter->otRadioState == OT_RADIO_STATE_TRANSMIT && !pFilter->SendPending) { otLwfRadioTransmitFrame(pFilter); } diff --git a/examples/drivers/windows/otLwf/filter.h b/examples/drivers/windows/otLwf/filter.h index fa2958371..14ab782e5 100644 --- a/examples/drivers/windows/otLwf/filter.h +++ b/examples/drivers/windows/otLwf/filter.h @@ -249,12 +249,12 @@ typedef struct _MS_FILTER // OpenThread radio variables // otRadioCaps otRadioCapabilities; - PhyState otPhyState; + otRadioState otRadioState; uint8_t otCurrentListenChannel; - uint8_t otReceiveMessage[kMaxPHYPacketSize]; - uint8_t otTransmitMessage[kMaxPHYPacketSize]; - RadioPacket otReceiveFrame; - RadioPacket otTransmitFrame; + uint8_t otReceiveMessage[OT_RADIO_FRAME_MAX_SIZE]; + uint8_t otTransmitMessage[OT_RADIO_FRAME_MAX_SIZE]; + otRadioFrame otReceiveFrame; + otRadioFrame otTransmitFrame; otError otLastTransmitError; BOOLEAN otLastTransmitFramePending; CHAR otLastEnergyScanMaxRssi; diff --git a/examples/drivers/windows/otLwf/radio.c b/examples/drivers/windows/otLwf/radio.c index 66daa4fa8..78c26591a 100644 --- a/examples/drivers/windows/otLwf/radio.c +++ b/examples/drivers/windows/otLwf/radio.c @@ -68,7 +68,7 @@ otPlatReset( otLwfReleaseInstance(pFilter); // Reset radio layer - pFilter->otPhyState = kStateDisabled; + pFilter->otRadioState = OT_RADIO_STATE_DISABLED; pFilter->otCurrentListenChannel = 0xFF; pFilter->otPromiscuous = false; pFilter->otPendingMacOffloadEnabled = FALSE; @@ -152,13 +152,13 @@ otLwfRadioInit( // Initialize the OpenThread radio capability flags pFilter->otRadioCapabilities = 0; if ((pFilter->DeviceCapabilities & OTLWF_DEVICE_CAP_RADIO_ACK_TIMEOUT) != 0) - pFilter->otRadioCapabilities |= kRadioCapsAckTimeout; + pFilter->otRadioCapabilities |= OT_RADIO_CAPS_ACK_TIMEOUT; if ((pFilter->DeviceCapabilities & OTLWF_DEVICE_CAP_RADIO_MAC_RETRY_AND_COLLISION_AVOIDANCE) != 0) - pFilter->otRadioCapabilities |= kRadioCapsTransmitRetries; + pFilter->otRadioCapabilities |= OT_RADIO_CAPS_TRANSMIT_RETRIES; if ((pFilter->DeviceCapabilities & OTLWF_DEVICE_CAP_RADIO_ENERGY_SCAN) != 0) - pFilter->otRadioCapabilities |= kRadioCapsEnergyScan; + pFilter->otRadioCapabilities |= OT_RADIO_CAPS_ENERGY_SCAN; - pFilter->otPhyState = kStateDisabled; + pFilter->otRadioState = OT_RADIO_STATE_DISABLED; pFilter->otCurrentListenChannel = 0xFF; pFilter->otPromiscuous = false; @@ -170,7 +170,7 @@ otLwfRadioInit( // Cache the factory address otLwfRadioGetFactoryAddress(pFilter); - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateDisabled.", pFilter); + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_DISABLED.", pFilter); LogFuncExit(DRIVER_DEFAULT); } @@ -192,7 +192,7 @@ void otPlatRadioSetPanId(_In_ otInstance *otCtx, uint16_t panid) pFilter->otPanID = panid; - if (pFilter->otPhyState != kStateDisabled && + if (pFilter->otRadioState != OT_RADIO_STATE_DISABLED && pFilter->otPanID != 0xFFFF) { // Indicate to the miniport @@ -250,7 +250,7 @@ void otPlatRadioSetShortAddress(_In_ otInstance *otCtx, uint16_t address) pFilter->otShortAddress = address; - if (pFilter->otPhyState != kStateDisabled) + if (pFilter->otRadioState != OT_RADIO_STATE_DISABLED) { // Indicate to the miniport status = @@ -293,7 +293,7 @@ bool otPlatRadioIsEnabled(_In_ otInstance *otCtx) { NT_ASSERT(otCtx); PMS_FILTER pFilter = otCtxToFilter(otCtx); - return pFilter->otPhyState != kStateDisabled; + return pFilter->otRadioState != OT_RADIO_STATE_DISABLED; } otError otPlatRadioEnable(_In_ otInstance *otCtx) @@ -302,10 +302,10 @@ otError otPlatRadioEnable(_In_ otInstance *otCtx) PMS_FILTER pFilter = otCtxToFilter(otCtx); NTSTATUS status; - NT_ASSERT(pFilter->otPhyState <= kStateSleep); - if (pFilter->otPhyState > kStateSleep) return OT_ERROR_BUSY; + NT_ASSERT(pFilter->otRadioState <= OT_RADIO_STATE_SLEEP); + if (pFilter->otRadioState > OT_RADIO_STATE_SLEEP) return OT_ERROR_BUSY; - pFilter->otPhyState = kStateSleep; + pFilter->otRadioState = OT_RADIO_STATE_SLEEP; // Indicate to the miniport status = @@ -320,7 +320,7 @@ otError otPlatRadioEnable(_In_ otInstance *otCtx) LogError(DRIVER_DEFAULT, "Set SPINEL_PROP_PHY_ENABLED (true) failed, %!STATUS!", status); } - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateSleep.", pFilter); + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_SLEEP.", pFilter); if (pFilter->otPanID != 0xFFFF) { @@ -361,12 +361,12 @@ otError otPlatRadioDisable(_In_ otInstance *otCtx) NTSTATUS status; // First make sure we are in the Sleep state if we weren't already - if (pFilter->otPhyState > kStateSleep) + if (pFilter->otRadioState > OT_RADIO_STATE_SLEEP) { (void)otPlatRadioSleep(otCtx); } - pFilter->otPhyState = kStateDisabled; + pFilter->otRadioState = OT_RADIO_STATE_DISABLED; // Indicate to the miniport status = @@ -381,7 +381,7 @@ otError otPlatRadioDisable(_In_ otInstance *otCtx) LogError(DRIVER_DEFAULT, "Set SPINEL_PROP_PHY_ENABLED (false) failed, %!STATUS!", status); } - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateDisabled.", pFilter); + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_DISABLED.", pFilter); return NT_SUCCESS(status) ? OT_ERROR_NONE : OT_ERROR_FAILED; } @@ -392,16 +392,16 @@ otError otPlatRadioSleep(_In_ otInstance *otCtx) PMS_FILTER pFilter = otCtxToFilter(otCtx); // If we were in the transmit state, cancel the transmit - if (pFilter->otPhyState == kStateTransmit) + if (pFilter->otRadioState == OT_RADIO_STATE_TRANSMIT) { pFilter->otLastTransmitError = OT_ERROR_ABORT; otLwfRadioTransmitFrameDone(pFilter); } - if (pFilter->otPhyState != kStateSleep) + if (pFilter->otRadioState != OT_RADIO_STATE_SLEEP) { - pFilter->otPhyState = kStateSleep; - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateSleep.", pFilter); + pFilter->otRadioState = OT_RADIO_STATE_SLEEP; + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_SLEEP.", pFilter); // Indicate to the miniport NTSTATUS status = @@ -425,8 +425,8 @@ otError otPlatRadioReceive(_In_ otInstance *otCtx, uint8_t aChannel) NT_ASSERT(otCtx); PMS_FILTER pFilter = otCtxToFilter(otCtx); - NT_ASSERT(pFilter->otPhyState != kStateDisabled); - if (pFilter->otPhyState == kStateDisabled) return OT_ERROR_BUSY; + NT_ASSERT(pFilter->otRadioState != OT_RADIO_STATE_DISABLED); + if (pFilter->otRadioState == OT_RADIO_STATE_DISABLED) return OT_ERROR_BUSY; LogFuncEntryMsg(DRIVER_DATA_PATH, "Filter: %p", pFilter); @@ -456,10 +456,10 @@ otError otPlatRadioReceive(_In_ otInstance *otCtx, uint8_t aChannel) // Only transition to the receive state if we were sleeping; otherwise we // are already in receive or transmit state. - if (pFilter->otPhyState == kStateSleep) + if (pFilter->otRadioState == OT_RADIO_STATE_SLEEP) { - pFilter->otPhyState = kStateReceive; - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateReceive.", pFilter); + pFilter->otRadioState = OT_RADIO_STATE_RECEIVE; + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_RECEIVE.", pFilter); NTSTATUS status = otLwfCmdSetProp( @@ -482,7 +482,7 @@ otError otPlatRadioReceive(_In_ otInstance *otCtx, uint8_t aChannel) return OT_ERROR_NONE; } -RadioPacket *otPlatRadioGetTransmitBuffer(_In_ otInstance *otCtx) +otRadioFrame *otPlatRadioGetTransmitBuffer(_In_ otInstance *otCtx) { NT_ASSERT(otCtx); PMS_FILTER pFilter = otCtxToFilter(otCtx); @@ -522,7 +522,7 @@ otLwfRadioReceiveFrame( LogMacRecv(pFilter, pFilter->otReceiveFrame.mLength, pFilter->otReceiveFrame.mPsdu); - if (pFilter->otPhyState > kStateDisabled) + if (pFilter->otRadioState > OT_RADIO_STATE_DISABLED) { otPlatRadioReceiveDone(pFilter->otCtx, &pFilter->otReceiveFrame, errorCode); } @@ -534,23 +534,23 @@ otLwfRadioReceiveFrame( LogFuncExit(DRIVER_DATA_PATH); } -otError otPlatRadioTransmit(_In_ otInstance *otCtx, _In_ RadioPacket *aPacket) +otError otPlatRadioTransmit(_In_ otInstance *otCtx, _In_ otRadioFrame *aFrame) { NT_ASSERT(otCtx); PMS_FILTER pFilter = otCtxToFilter(otCtx); otError error = OT_ERROR_BUSY; - UNREFERENCED_PARAMETER(aPacket); + UNREFERENCED_PARAMETER(aFrame); LogFuncEntryMsg(DRIVER_DATA_PATH, "Filter: %p", pFilter); - NT_ASSERT(pFilter->otPhyState == kStateReceive); - if (pFilter->otPhyState == kStateReceive) + NT_ASSERT(pFilter->otRadioState == OT_RADIO_STATE_RECEIVE); + if (pFilter->otRadioState == OT_RADIO_STATE_RECEIVE) { error = OT_ERROR_NONE; - pFilter->otPhyState = kStateTransmit; + pFilter->otRadioState = OT_RADIO_STATE_TRANSMIT; - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateTransmit.", pFilter); + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_TRANSMIT.", pFilter); } LogFuncExitMsg(DRIVER_DATA_PATH, "%u", error); @@ -560,7 +560,7 @@ otError otPlatRadioTransmit(_In_ otInstance *otCtx, _In_ RadioPacket *aPacket) VOID otLwfRadioTransmitFrame(_In_ PMS_FILTER pFilter) { - NT_ASSERT(pFilter->otPhyState == kStateTransmit); + NT_ASSERT(pFilter->otRadioState == OT_RADIO_STATE_TRANSMIT); LogMacSend(pFilter, pFilter->otTransmitFrame.mLength, pFilter->otTransmitFrame.mPsdu); @@ -578,13 +578,13 @@ otLwfRadioTransmitFrameDone( { LogFuncEntryMsg(DRIVER_DATA_PATH, "Filter: %p", pFilter); - if (pFilter->otPhyState == kStateTransmit) + if (pFilter->otRadioState == OT_RADIO_STATE_TRANSMIT) { pFilter->SendPending = FALSE; // Now that we are completing a send, fall back to receive state and set the event - pFilter->otPhyState = kStateReceive; - LogInfo(DRIVER_DEFAULT, "Filter %p PhyState = kStateReceive.", pFilter); + pFilter->otRadioState = OT_RADIO_STATE_RECEIVE; + LogInfo(DRIVER_DEFAULT, "Filter %p RadioState = OT_RADIO_STATE_RECEIVE.", pFilter); KeSetEvent(&pFilter->EventWorkerThreadProcessNBLs, 0, FALSE); if (pFilter->otLastTransmitError != OT_ERROR_NONE && diff --git a/examples/platforms/cc2538/diag.c b/examples/platforms/cc2538/diag.c index 08a1a0b4c..d270d2cbf 100644 --- a/examples/platforms/cc2538/diag.c +++ b/examples/platforms/cc2538/diag.c @@ -72,7 +72,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) (void) aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; (void) aFrame; diff --git a/examples/platforms/cc2538/radio.c b/examples/platforms/cc2538/radio.c index a721dd827..e03515d7c 100644 --- a/examples/platforms/cc2538/radio.c +++ b/examples/platforms/cc2538/radio.c @@ -91,8 +91,8 @@ static const TxPowerTable sTxPowerTable[] = { -24, 0x00 }, }; -static RadioPacket sTransmitFrame; -static RadioPacket sReceiveFrame; +static otRadioFrame sTransmitFrame; +static otRadioFrame sReceiveFrame; static otError sTransmitError; static otError sReceiveError; @@ -101,7 +101,7 @@ static uint8_t sReceivePsdu[IEEE802154_MAX_LENGTH]; static uint8_t sChannel = 0; static int8_t sTxPower = 0; -static PhyState sState = kStateDisabled; +static otRadioState sState = OT_RADIO_STATE_DISABLED; static bool sIsReceiverEnabled = false; void enableReceiver(void) @@ -266,15 +266,15 @@ void cc2538RadioInit(void) bool otPlatRadioIsEnabled(otInstance *aInstance) { (void)aInstance; - return (sState != kStateDisabled) ? true : false; + return (sState != OT_RADIO_STATE_DISABLED) ? true : false; } otError otPlatRadioEnable(otInstance *aInstance) { if (!otPlatRadioIsEnabled(aInstance)) { - otLogDebgPlat(sInstance, "State=kStateSleep", NULL); - sState = kStateSleep; + otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + sState = OT_RADIO_STATE_SLEEP; } return OT_ERROR_NONE; @@ -284,8 +284,8 @@ otError otPlatRadioDisable(otInstance *aInstance) { if (otPlatRadioIsEnabled(aInstance)) { - otLogDebgPlat(sInstance, "State=kStateDisabled", NULL); - sState = kStateDisabled; + otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_DISABLED", NULL); + sState = OT_RADIO_STATE_DISABLED; } return OT_ERROR_NONE; @@ -296,11 +296,11 @@ otError otPlatRadioSleep(otInstance *aInstance) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState == kStateSleep || sState == kStateReceive) + if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE) { - otLogDebgPlat(sInstance, "State=kStateSleep", NULL); + otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); error = OT_ERROR_NONE; - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; disableReceiver(); } @@ -312,12 +312,12 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState != kStateDisabled) + if (sState != OT_RADIO_STATE_DISABLED) { - otLogDebgPlat(sInstance, "State=kStateReceive", NULL); + otLogDebgPlat(sInstance, "State=OT_RADIO_STATE_RECEIVE", NULL); error = OT_ERROR_NONE; - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; setChannel(aChannel); sReceiveFrame.mChannel = aChannel; enableReceiver(); @@ -326,17 +326,17 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) return error; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState == kStateReceive) + if (sState == OT_RADIO_STATE_RECEIVE) { int i; error = OT_ERROR_NONE; - sState = kStateTransmit; + sState = OT_RADIO_STATE_TRANSMIT; sTransmitError = OT_ERROR_NONE; while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE); @@ -346,16 +346,16 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHTX; // frame length - HWREG(RFCORE_SFR_RFDATA) = aPacket->mLength; + HWREG(RFCORE_SFR_RFDATA) = aFrame->mLength; // frame data - for (i = 0; i < aPacket->mLength; i++) + for (i = 0; i < aFrame->mLength; i++) { - HWREG(RFCORE_SFR_RFDATA) = aPacket->mPsdu[i]; + HWREG(RFCORE_SFR_RFDATA) = aFrame->mPsdu[i]; } - setChannel(aPacket->mChannel); - setTxPower(aPacket->mPower); + setChannel(aFrame->mChannel); + setTxPower(aFrame->mPower); while ((HWREG(RFCORE_XREG_FSMSTAT1) & 1) == 0); @@ -371,14 +371,14 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE); - otLogDebgPlat(sInstance, "Transmitted %d bytes", aPacket->mLength); + otLogDebgPlat(sInstance, "Transmitted %d bytes", aFrame->mLength); } exit: return error; } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; @@ -393,7 +393,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsNone; + return OT_RADIO_CAPS_NONE; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -424,7 +424,7 @@ void readFrame(void) uint8_t crcCorr; int i; - otEXPECT(sState == kStateReceive || sState == kStateTransmit); + otEXPECT(sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_TRANSMIT); otEXPECT((HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_FIFOP) != 0); // read length @@ -470,8 +470,8 @@ void cc2538RadioProcess(otInstance *aInstance) { readFrame(); - if ((sState == kStateReceive && sReceiveFrame.mLength > 0) || - (sState == kStateTransmit && sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)) + if ((sState == OT_RADIO_STATE_RECEIVE && sReceiveFrame.mLength > 0) || + (sState == OT_RADIO_STATE_TRANSMIT && sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)) { #if OPENTHREAD_ENABLE_DIAG @@ -493,7 +493,7 @@ void cc2538RadioProcess(otInstance *aInstance) } } - if (sState == kStateTransmit) + if (sState == OT_RADIO_STATE_TRANSMIT) { if (sTransmitError != OT_ERROR_NONE || (sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) { @@ -502,7 +502,7 @@ void cc2538RadioProcess(otInstance *aInstance) otLogDebgPlat(sInstance, "Transmit failed ErrorCode=%d", sTransmitError); } - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG @@ -520,7 +520,7 @@ void cc2538RadioProcess(otInstance *aInstance) (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK && (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])) { - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG diff --git a/examples/platforms/cc2650/diag.c b/examples/platforms/cc2650/diag.c index 0955ead70..c59285f61 100644 --- a/examples/platforms/cc2650/diag.c +++ b/examples/platforms/cc2650/diag.c @@ -70,7 +70,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) (void) aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; (void) aFrame; diff --git a/examples/platforms/cc2650/radio.c b/examples/platforms/cc2650/radio.c index a4a3a7b03..b69bcb6da 100644 --- a/examples/platforms/cc2650/radio.c +++ b/examples/platforms/cc2650/radio.c @@ -134,13 +134,13 @@ static uint8_t sRxBuf1[RX_BUF_SIZE] __attribute__((aligned(4))); static dataQueue_t sRxDataQueue = { 0 }; /* openthread data primatives */ -static RadioPacket sTransmitFrame; -static RadioPacket sReceiveFrame; +static otRadioFrame sTransmitFrame; +static otRadioFrame sReceiveFrame; static otError sTransmitError; static otError sReceiveError; -static uint8_t sTransmitPsdu[kMaxPHYPacketSize] __attribute__((aligned(4))) ; -static uint8_t sReceivePsdu[kMaxPHYPacketSize] __attribute__((aligned(4))) ; +static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE] __attribute__((aligned(4))) ; +static uint8_t sReceivePsdu[OT_RADIO_FRAME_MAX_SIZE] __attribute__((aligned(4))) ; /** * Interrupt handlers forward declared for register function @@ -196,7 +196,7 @@ static void rfCoreInitReceiveParams(void) .condition = { .rule = COND_NEVER, }, - .channel = kPhyMinChannel, + .channel = OT_RADIO_CHANNEL_MIN, .rxConfig = { .bAutoFlushCrc = 1, @@ -1324,7 +1324,7 @@ otError otPlatRadioSleep(otInstance *aInstance) /** * Function documented in platform/radio.h */ -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; @@ -1333,7 +1333,7 @@ RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) /** * Function documented in platform/radio.h */ -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { otError error = OT_ERROR_BUSY; @@ -1343,14 +1343,14 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) * This is the easiest way to setup the frequency synthesizer. * And we are supposed to fall into the receive state afterwards. */ - error = otPlatRadioReceive(aInstance, aPacket->mChannel); + error = otPlatRadioReceive(aInstance, aFrame->mChannel); if (error == OT_ERROR_NONE) { sState = cc2650_stateTransmit; /* removing 2 bytes of CRC placeholder because we generate that in hardware */ - otEXPECT_ACTION(rfCoreSendTransmitCmd(aPacket->mPsdu, aPacket->mLength - 2) == CMDSTA_Done, + otEXPECT_ACTION(rfCoreSendTransmitCmd(aFrame->mPsdu, aFrame->mLength - 2) == CMDSTA_Done, error = OT_ERROR_FAILED); error = OT_ERROR_NONE; } @@ -1376,7 +1376,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsAckTimeout | kRadioCapsEnergyScan | kRadioCapsTransmitRetries; + return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES; } /** @@ -1772,7 +1772,7 @@ static void readFrame(void) crcCorr = (rfc_ieeeRxCorrCrc_t *)&payload[len]; rssi = payload[len - 1]; - if (crcCorr->status.bCrcErr == 0 && (len - 2) < kMaxPHYPacketSize) + if (crcCorr->status.bCrcErr == 0 && (len - 2) < OT_RADIO_FRAME_MAX_SIZE) { sReceiveFrame.mLength = len; memcpy(sReceiveFrame.mPsdu, &(payload[1]), len - 2); diff --git a/examples/platforms/da15000/radio.c b/examples/platforms/da15000/radio.c index 9a6d349de..38ad799ce 100644 --- a/examples/platforms/da15000/radio.c +++ b/examples/platforms/da15000/radio.c @@ -66,13 +66,13 @@ enum static otInstance *sThreadInstance; -static PhyState sRadioState = kStateDisabled; -static uint8_t sChannel = DEFAULT_CHANNEL; -static uint8_t sTransmitPsdu[kMaxPHYPacketSize]; -static uint8_t sReceivePsdu[kMaxPHYPacketSize]; -static RadioPacket sTransmitFrame; -static RadioPacket sReceiveFrame; -static otError sTransmitStatus; +static otRadioState sRadioState = OT_RADIO_STATE_DISABLED; +static uint8_t sChannel = DEFAULT_CHANNEL; +static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE]; +static uint8_t sReceivePsdu[OT_RADIO_FRAME_MAX_SIZE]; +static otRadioFrame sTransmitFrame; +static otRadioFrame sReceiveFrame; +static otError sTransmitStatus; static bool sFramePending = false; static bool sSendFrameDone = false; @@ -145,7 +145,7 @@ otError otPlatRadioEnable(otInstance *aInstance) uint8_t maxRetries; otError error = OT_ERROR_NONE; - otEXPECT_ACTION(sRadioState == kStateDisabled, error = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(sRadioState == OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); sThreadInstance = aInstance; sTransmitFrame.mPsdu = sTransmitPsdu; @@ -164,7 +164,7 @@ otError otPlatRadioEnable(otInstance *aInstance) FTDF_enableTransparentMode(FTDF_TRUE, options); otPlatRadioSetPromiscuous(aInstance, false); - sRadioState = kStateSleep; + sRadioState = OT_RADIO_STATE_SLEEP; exit: return error; @@ -174,7 +174,7 @@ otError otPlatRadioDisable(otInstance *aInstance) { (void)aInstance; - sRadioState = kStateDisabled; + sRadioState = OT_RADIO_STATE_DISABLED; return OT_ERROR_NONE; } @@ -183,14 +183,14 @@ bool otPlatRadioIsEnabled(otInstance *aInstance) { (void)aInstance; - return (sRadioState != kStateDisabled); + return (sRadioState != OT_RADIO_STATE_DISABLED); } otError otPlatRadioSleep(otInstance *aInstance) { (void)aInstance; - if (sRadioState == kStateReceive && sSleepInitDelay == 0) + if (sRadioState == OT_RADIO_STATE_RECEIVE && sSleepInitDelay == 0) { sSleepInitDelay = otPlatAlarmGetNow(); return OT_ERROR_NONE; @@ -201,11 +201,11 @@ otError otPlatRadioSleep(otInstance *aInstance) } otError error = OT_ERROR_NONE; - otEXPECT_ACTION(((sRadioState == kStateReceive) || (sRadioState == kStateSleep)), + otEXPECT_ACTION(((sRadioState == OT_RADIO_STATE_RECEIVE) || (sRadioState == OT_RADIO_STATE_SLEEP)), error = OT_ERROR_INVALID_STATE); sGoSleep = true; - sRadioState = kStateSleep; + sRadioState = OT_RADIO_STATE_SLEEP; exit: return error; @@ -216,7 +216,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) (void)aInstance; otError error = OT_ERROR_NONE; - otEXPECT_ACTION(sRadioState != kStateDisabled, error = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(sRadioState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); ad_ftdf_wake_up(); sChannel = aChannel; @@ -224,7 +224,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) sEnableRX = 1; FTDF_setValue(FTDF_PIB_RX_ON_WHEN_IDLE, &sEnableRX); - sRadioState = kStateReceive; + sRadioState = OT_RADIO_STATE_RECEIVE; exit: return error; @@ -356,25 +356,25 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) } } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { (void)aInstance; uint8_t csmaSuppress; otError error = OT_ERROR_NONE; - otEXPECT_ACTION(sRadioState != kStateDisabled, error = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(sRadioState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); csmaSuppress = 0; - ad_ftdf_send_frame_simple(aPacket->mLength, aPacket->mPsdu, aPacket->mChannel, 0, csmaSuppress); //Prio 0 for all. - sRadioState = kStateTransmit; + ad_ftdf_send_frame_simple(aFrame->mLength, aFrame->mPsdu, aFrame->mChannel, 0, csmaSuppress); //Prio 0 for all. + sRadioState = OT_RADIO_STATE_TRANSMIT; exit: return error; @@ -391,7 +391,7 @@ otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsNone; + return OT_RADIO_CAPS_NONE; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -429,7 +429,7 @@ void da15000RadioProcess(otInstance *aInstance) { if (sSendFrameDone) { - sRadioState = kStateReceive; + sRadioState = OT_RADIO_STATE_RECEIVE; if (((sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) || sTransmitStatus != OT_ERROR_NONE) { @@ -444,7 +444,7 @@ void da15000RadioProcess(otInstance *aInstance) sSendFrameDone = false; } - if (sRadioState == kStateSleep && sGoSleep) + if (sRadioState == OT_RADIO_STATE_SLEEP && sGoSleep) { sGoSleep = false; @@ -486,7 +486,7 @@ void FTDF_rcvFrameTransparent(FTDF_DataLength frameLength, FTDF_Bitmap32 status, FTDF_LinkQuality lqi) { - sReceiveFrame.mPower = kPhyInvalidRssi; + sReceiveFrame.mPower = OT_RADIO_RSSI_INVALID; sReceiveFrame.mLqi = lqi; sReceiveFrame.mChannel = sChannel; @@ -502,9 +502,9 @@ void FTDF_rcvFrameTransparent(FTDF_DataLength frameLength, otPlatRadioReceiveDone(sThreadInstance, &sReceiveFrame, OT_ERROR_ABORT); } - if (sRadioState != kStateDisabled) + if (sRadioState != OT_RADIO_STATE_DISABLED) { - sRadioState = kStateReceive; + sRadioState = OT_RADIO_STATE_RECEIVE; } } diff --git a/examples/platforms/efr32/diag.c b/examples/platforms/efr32/diag.c index 245fd48f5..3c930d97f 100644 --- a/examples/platforms/efr32/diag.c +++ b/examples/platforms/efr32/diag.c @@ -77,7 +77,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) (void) aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; (void) aFrame; diff --git a/examples/platforms/efr32/radio.c b/examples/platforms/efr32/radio.c index de9fce63d..c428b0c62 100644 --- a/examples/platforms/efr32/radio.c +++ b/examples/platforms/efr32/radio.c @@ -72,16 +72,16 @@ static bool sTransmitBusy = false; static bool sPromiscuous = false; static bool sIsReceiverEnabled = false; static bool sIsSrcMatchEnabled = false; -static PhyState sState = kStateDisabled; +static otRadioState sState = OT_RADIO_STATE_DISABLED; static uint8_t sReceiveBuffer[IEEE802154_MAX_LENGTH + 1 + sizeof(RAIL_RxPacketInfo_t)]; static uint8_t sReceivePsdu[IEEE802154_MAX_LENGTH]; -static RadioPacket sReceiveFrame; -static otError sReceiveError; +static otRadioFrame sReceiveFrame; +static otError sReceiveError; -static RadioPacket sTransmitFrame; +static otRadioFrame sTransmitFrame; static uint8_t sTransmitPsdu[IEEE802154_MAX_LENGTH]; -static otError sTransmitError; +static otError sTransmitError; typedef struct srcMatchEntry { @@ -223,7 +223,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress) bool otPlatRadioIsEnabled(otInstance *aInstance) { (void)aInstance; - return (sState != kStateDisabled); + return (sState != OT_RADIO_STATE_DISABLED); } otError otPlatRadioEnable(otInstance *aInstance) @@ -233,8 +233,8 @@ otError otPlatRadioEnable(otInstance *aInstance) otEXPECT(!otPlatRadioIsEnabled(aInstance)); - otLogInfoPlat(sInstance, "State=kStateSleep", NULL); - sState = kStateSleep; + otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + sState = OT_RADIO_STATE_SLEEP; exit: CORE_EXIT_CRITICAL(); @@ -248,8 +248,8 @@ otError otPlatRadioDisable(otInstance *aInstance) otEXPECT(otPlatRadioIsEnabled(aInstance)); - otLogInfoPlat(sInstance, "State=kStateDisabled", NULL); - sState = kStateDisabled; + otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_DISABLED", NULL); + sState = OT_RADIO_STATE_DISABLED; exit: CORE_EXIT_CRITICAL(); @@ -264,11 +264,11 @@ otError otPlatRadioSleep(otInstance *aInstance) CORE_DECLARE_IRQ_STATE; CORE_ENTER_CRITICAL(); - otEXPECT_ACTION((sState != kStateTransmit) && (sState != kStateDisabled), + otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED), error = OT_ERROR_INVALID_STATE); - otLogInfoPlat(sInstance, "State=kStateSleep", NULL); - sState = kStateSleep; + otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_SLEEP", NULL); + sState = OT_RADIO_STATE_SLEEP; if (sIsReceiverEnabled) { @@ -289,10 +289,10 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) CORE_DECLARE_IRQ_STATE; CORE_ENTER_CRITICAL(); - otEXPECT_ACTION(sState != kStateDisabled, error = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE); - otLogInfoPlat(sInstance, "State=kStateReceive", NULL); - sState = kStateReceive; + otLogInfoPlat(sInstance, "State=OT_RADIO_STATE_RECEIVE", NULL); + sState = OT_RADIO_STATE_RECEIVE; setChannel(aChannel); sReceiveFrame.mChannel = aChannel; @@ -311,7 +311,7 @@ exit: return error; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +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; @@ -322,20 +322,20 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) CORE_DECLARE_IRQ_STATE; CORE_ENTER_CRITICAL(); - otEXPECT_ACTION((sState != kStateDisabled) && (sState != kStateTransmit), + otEXPECT_ACTION((sState != OT_RADIO_STATE_DISABLED) && (sState != OT_RADIO_STATE_TRANSMIT), error = OT_ERROR_INVALID_STATE); - sState = kStateTransmit; + sState = OT_RADIO_STATE_TRANSMIT; sTransmitError = OT_ERROR_NONE; sTransmitBusy = true; - frame[0] = aPacket->mLength; - memcpy(frame + 1, aPacket->mPsdu, aPacket->mLength); + frame[0] = aFrame->mLength; + memcpy(frame + 1, aFrame->mPsdu, aFrame->mLength); tx_data.dataPtr = frame; - tx_data.dataLength = aPacket->mLength - 1; - RAIL_TxPowerSet(aPacket->mPower); - setChannel(aPacket->mChannel); + tx_data.dataLength = aFrame->mLength - 1; + RAIL_TxPowerSet(aFrame->mPower); + setChannel(aFrame->mChannel); RAIL_RfIdleExt(RAIL_IDLE, true); if (RAIL_TxDataLoad(&tx_data)) @@ -343,7 +343,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) assert(false); } - if (RAIL_TxStart(aPacket->mChannel, RAIL_CcaCsma, &csmaConfig)) + if (RAIL_TxStart(aFrame->mChannel, RAIL_CcaCsma, &csmaConfig)) { assert(false); } @@ -353,7 +353,7 @@ exit: return error; } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; @@ -368,7 +368,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsNone; + return OT_RADIO_CAPS_NONE; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -698,8 +698,8 @@ void efr32RadioProcess(otInstance *aInstance) CORE_DECLARE_IRQ_STATE; CORE_ENTER_CRITICAL(); - if ((sState == kStateReceive && sReceiveFrame.mLength > 0) || - (sState == kStateTransmit && sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)) + if ((sState == OT_RADIO_STATE_RECEIVE && sReceiveFrame.mLength > 0) || + (sState == OT_RADIO_STATE_TRANSMIT && sReceiveFrame.mLength > IEEE802154_ACK_LENGTH)) { #if OPENTHREAD_ENABLE_DIAG @@ -720,7 +720,7 @@ void efr32RadioProcess(otInstance *aInstance) } } - if (sState == kStateTransmit && sTransmitBusy == false) + if (sState == OT_RADIO_STATE_TRANSMIT && sTransmitBusy == false) { if (sTransmitError != OT_ERROR_NONE || (sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) { @@ -729,7 +729,7 @@ void efr32RadioProcess(otInstance *aInstance) otLogDebgPlat(sInstance, "Transmit failed ErrorCode=%d", sTransmitError); } - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG @@ -747,7 +747,7 @@ void efr32RadioProcess(otInstance *aInstance) (sReceiveFrame.mPsdu[0] & IEEE802154_FRAME_TYPE_MASK) == IEEE802154_FRAME_TYPE_ACK && (sReceiveFrame.mPsdu[IEEE802154_DSN_OFFSET] == sTransmitFrame.mPsdu[IEEE802154_DSN_OFFSET])) { - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG diff --git a/examples/platforms/emsk/radio.c b/examples/platforms/emsk/radio.c index 92bc2311a..fbd90c60c 100644 --- a/examples/platforms/emsk/radio.c +++ b/examples/platforms/emsk/radio.c @@ -99,9 +99,9 @@ enum static void radioTransmitMessage(otInstance *aInstance); -static RadioPacket sTransmitFrame; -static RadioPacket sReceiveFrame; -static RadioPacket sAckFrame; +static otRadioFrame sTransmitFrame; +static otRadioFrame sReceiveFrame; +static otRadioFrame sAckFrame; static otError sTransmitError; static otError sReceiveError; @@ -110,7 +110,7 @@ static uint8_t sTransmitPsdu[IEEE802154_MAX_LENGTH]; static uint8_t sReceivePsdu[IEEE802154_MAX_LENGTH]; static uint8_t sAckPsdu[IEEE802154_MAX_LENGTH]; -static PhyState sState = kStateDisabled; +static otRadioState sState = OT_RADIO_STATE_DISABLED; static bool sIsReceiverEnabled = false; static volatile uint8_t Mrf24StatusTx = 0; @@ -323,14 +323,14 @@ void emskRadioInit(void) bool otPlatRadioIsEnabled(otInstance *aInstance) { (void)aInstance; - return (sState != kStateDisabled); + return (sState != OT_RADIO_STATE_DISABLED); } otError otPlatRadioEnable(otInstance *aInstance) { if (!otPlatRadioIsEnabled(aInstance)) { - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; } return OT_ERROR_NONE; @@ -340,7 +340,7 @@ otError otPlatRadioDisable(otInstance *aInstance) { if (otPlatRadioIsEnabled(aInstance)) { - sState = kStateDisabled; + sState = OT_RADIO_STATE_DISABLED; } return OT_ERROR_NONE; @@ -351,10 +351,10 @@ otError otPlatRadioSleep(otInstance *aInstance) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState == kStateSleep || sState == kStateReceive) + if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE) { error = OT_ERROR_NONE; - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; disableReceiver(); } @@ -366,10 +366,10 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState != kStateDisabled) + if (sState != OT_RADIO_STATE_DISABLED) { error = OT_ERROR_NONE; - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; setChannel(aChannel); sReceiveFrame.mChannel = aChannel; enableReceiver(); @@ -378,23 +378,23 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) return error; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - (void)aPacket; + (void)aFrame; - if (sState == kStateReceive) + if (sState == OT_RADIO_STATE_RECEIVE) { error = OT_ERROR_NONE; - sState = kStateTransmit; + sState = OT_RADIO_STATE_TRANSMIT; } return error; } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; @@ -409,7 +409,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsNone; + return OT_RADIO_CAPS_NONE; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -441,7 +441,7 @@ void readFrame(void) memset(readBuffer, 0, MRF24J40_RXFIFO_SIZE); - otEXPECT_ACTION(sState == kStateReceive || sState == kStateTransmit, ;); + otEXPECT_ACTION(sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_TRANSMIT, ;); otEXPECT_ACTION(Mrf24StatusRx, ;); if (Mrf24StatusRx == 1) @@ -538,24 +538,24 @@ void emskRadioProcess(otInstance *aInstance) } } - if ((sState == kStateReceive) && (sReceiveFrame.mLength > 0)) + if ((sState == OT_RADIO_STATE_RECEIVE) && (sReceiveFrame.mLength > 0)) { otPlatRadioReceiveDone(aInstance, &sReceiveFrame, sReceiveError); } - if (sState == kStateTransmit) + if (sState == OT_RADIO_STATE_TRANSMIT) { radioTransmitMessage(aInstance); if (sTransmitError != OT_ERROR_NONE || (sTransmitFrame.mPsdu[0] & IEEE802154_ACK_REQUEST) == 0) { - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; otPlatRadioTransmitDone(aInstance, &sTransmitFrame, false, sTransmitError); } else if (Mrf24StatusTx == 1) { Mrf24StatusTx = 0; - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; otPlatRadioTransmitDone(aInstance, &sTransmitFrame, (mrf24j40_read_short_ctrl_reg(MRF24J40_TXNCON) & MRF24J40_FPSTAT) != 0, sTransmitError); diff --git a/examples/platforms/kw41z/diag.c b/examples/platforms/kw41z/diag.c index 472030d3c..28648efd0 100644 --- a/examples/platforms/kw41z/diag.c +++ b/examples/platforms/kw41z/diag.c @@ -75,7 +75,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) (void) aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; (void) aFrame; diff --git a/examples/platforms/kw41z/radio.c b/examples/platforms/kw41z/radio.c index 269a533ff..2246c3563 100644 --- a/examples/platforms/kw41z/radio.c +++ b/examples/platforms/kw41z/radio.c @@ -72,24 +72,24 @@ typedef enum xcvr_cca_type_tag XCVR_CCA_MODE3_c /* 802.15.4 compliant signal detect and energy detect - CCA bit ACTIVE */ } xcvr_cca_type_t; -static PhyState sState = kStateDisabled; -static uint16_t sPanId; -static uint8_t sExtSrcAddrBitmap[(RADIO_CONFIG_SRC_MATCH_ENTRY_NUM + 7) / 8]; -static uint8_t sChannel; -static int8_t sMaxED; -static int8_t sAutoTxPwrLevel = 0; +static otRadioState sState = OT_RADIO_STATE_DISABLED; +static uint16_t sPanId; +static uint8_t sExtSrcAddrBitmap[(RADIO_CONFIG_SRC_MATCH_ENTRY_NUM + 7) / 8]; +static uint8_t sChannel; +static int8_t sMaxED; +static int8_t sAutoTxPwrLevel = 0; /* ISR Signaling Flags */ -static bool sTxDone = false; -static bool sRxDone = false; -static bool sEdScanDone = false; -static bool sAckFpState; -static otError sTxStatus; +static bool sTxDone = false; +static bool sRxDone = false; +static bool sEdScanDone = false; +static bool sAckFpState; +static otError sTxStatus; -static RadioPacket sTxPacket; -static RadioPacket sRxPacket; +static otRadioFrame sTxFrame; +static otRadioFrame sRxFrame; #if DOUBLE_BUFFERING -static uint8_t sRxData[kMaxPHYPacketSize]; +static uint8_t sRxData[OT_RADIO_FRAME_MAX_SIZE]; #endif /* Private functions */ @@ -106,7 +106,7 @@ static otError rf_add_addr_table_entry(uint16_t checksum, bool extendedAddr static otError rf_remove_addr_table_entry(uint16_t checksum); static otError rf_remove_addr_table_entry_index(uint8_t index); -PhyState otPlatRadioGetState(otInstance *aInstance) +otRadioState otPlatRadioGetState(otInstance *aInstance) { (void)aInstance; return sState; @@ -171,7 +171,7 @@ otError otPlatRadioEnable(otInstance *aInstance) NVIC_ClearPendingIRQ(Radio_1_IRQn); NVIC_EnableIRQ(Radio_1_IRQn); - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; exit: return OT_ERROR_NONE; @@ -183,7 +183,7 @@ otError otPlatRadioDisable(otInstance *aInstance) NVIC_DisableIRQ(Radio_1_IRQn); rf_abort(); - sState = kStateDisabled; + sState = OT_RADIO_STATE_DISABLED; exit: return OT_ERROR_NONE; @@ -192,7 +192,7 @@ exit: bool otPlatRadioIsEnabled(otInstance *aInstance) { (void) aInstance; - return sState != kStateDisabled; + return sState != OT_RADIO_STATE_DISABLED; } otError otPlatRadioSleep(otInstance *aInstance) @@ -200,10 +200,11 @@ otError otPlatRadioSleep(otInstance *aInstance) otError status = OT_ERROR_NONE; (void) aInstance; - otEXPECT_ACTION(((sState != kStateTransmit) && (sState != kStateDisabled)), status = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && + (sState != OT_RADIO_STATE_DISABLED)), status = OT_ERROR_INVALID_STATE); rf_abort(); - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; exit: return status; @@ -214,9 +215,10 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError status = OT_ERROR_NONE; (void) aInstance; - otEXPECT_ACTION(((sState != kStateTransmit) && (sState != kStateDisabled)), status = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && + (sState != OT_RADIO_STATE_DISABLED)), status = OT_ERROR_INVALID_STATE); - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; otEXPECT(rf_get_state() != XCVR_RX_c); @@ -225,7 +227,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) /* Set Power level for auto TX */ rf_set_tx_power(sAutoTxPwrLevel); rf_set_channel(aChannel); - sRxPacket.mChannel = aChannel; + sRxFrame.mChannel = aChannel; /* Clear all IRQ flags */ ZLL->IRQSTS = ZLL->IRQSTS; @@ -315,30 +317,31 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance) } } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; - return &sTxPacket; + return &sTxFrame; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { otError status = OT_ERROR_NONE; uint32_t timeout; (void) aInstance; - otEXPECT_ACTION(((sState != kStateTransmit) && (sState != kStateDisabled)), status = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && + (sState != OT_RADIO_STATE_DISABLED)), status = OT_ERROR_INVALID_STATE); if (rf_get_state() != XCVR_Idle_c) { rf_abort(); } - rf_set_channel(aPacket->mChannel); - rf_set_tx_power(aPacket->mPower); + rf_set_channel(aFrame->mChannel); + rf_set_tx_power(aFrame->mPower); - *(uint8_t *)ZLL->PKT_BUFFER_TX = aPacket->mLength; + *(uint8_t *)ZLL->PKT_BUFFER_TX = aFrame->mLength; /* Set CCA mode */ ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_CCATYPE_MASK; @@ -348,7 +351,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) ZLL->IRQSTS = ZLL->IRQSTS; /* Perform automatic reception of ACK frame, if required */ - if (aPacket->mPsdu[0] & IEEE802154_ACK_REQUEST) + if (aFrame->mPsdu[0] & IEEE802154_ACK_REQUEST) { ZLL->PHY_CTRL |= ZLL_PHY_CTRL_RXACKRQD_MASK; ZLL->PHY_CTRL |= XCVR_TR_c; @@ -357,7 +360,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) timeout += (((XCVR_TSM->END_OF_SEQ & XCVR_TSM_END_OF_SEQ_END_OF_TX_WU_MASK) >> XCVR_TSM_END_OF_SEQ_END_OF_TX_WU_SHIFT) >> 4); timeout += IEEE802154_CCA_LEN + IEEE802154_TURNAROUND_LEN + IEEE802154_PHY_SHR_LEN + - (1 + aPacket->mLength) * kPhySymbolsPerOctet + IEEE802154_ACK_WAIT; + (1 + aFrame->mLength) * OT_RADIO_SYMBOLS_PER_OCTET + IEEE802154_ACK_WAIT; rf_set_timeout(timeout); } else @@ -367,7 +370,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) } sAckFpState = false; - sState = kStateTransmit; + sState = OT_RADIO_STATE_TRANSMIT; /* Unmask SEQ interrupt */ ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_SEQMSK_MASK; @@ -384,7 +387,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsAckTimeout | kRadioCapsEnergyScan; + return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -424,7 +427,8 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1 uint32_t timeout; (void) aInstance; - otEXPECT_ACTION(((sState != kStateTransmit) && (sState != kStateDisabled)), status = OT_ERROR_INVALID_STATE); + otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && + (sState != OT_RADIO_STATE_DISABLED)), status = OT_ERROR_INVALID_STATE); if (rf_get_state() != XCVR_Idle_c) { @@ -444,7 +448,7 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1 ZLL->PHY_CTRL &= ~ZLL_PHY_CTRL_SEQMSK_MASK; /* Set Scan time-out */ timeout = rf_get_timestamp(); - timeout += (aScanDuration * 1000) / kPhyUsPerSymbol; + timeout += (aScanDuration * 1000) / OT_RADIO_SYMBOL_TIME; rf_set_timeout(timeout); exit: @@ -725,7 +729,7 @@ void Radio_1_IRQHandler(void) else if ((state == XCVR_TR_c) && !(irqStatus & ZLL_IRQSTS_RXIRQ_MASK)) { rf_abort(); - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; sTxStatus = OT_ERROR_NO_ACK; sTxDone = true; } @@ -742,18 +746,18 @@ void Radio_1_IRQHandler(void) { case XCVR_RX_c: temp = (ZLL->LQI_AND_RSSI & ZLL_LQI_AND_RSSI_LQI_VALUE_MASK) >> ZLL_LQI_AND_RSSI_LQI_VALUE_SHIFT; - sRxPacket.mLength = (ZLL->IRQSTS & ZLL_IRQSTS_RX_FRAME_LENGTH_MASK) >> ZLL_IRQSTS_RX_FRAME_LENGTH_SHIFT; - sRxPacket.mLqi = rf_lqi_adjust(temp); - sRxPacket.mPower = rf_lqi_to_rssi(sRxPacket.mLqi); + sRxFrame.mLength = (ZLL->IRQSTS & ZLL_IRQSTS_RX_FRAME_LENGTH_MASK) >> ZLL_IRQSTS_RX_FRAME_LENGTH_SHIFT; + sRxFrame.mLqi = rf_lqi_adjust(temp); + sRxFrame.mPower = rf_lqi_to_rssi(sRxFrame.mLqi); #if DOUBLE_BUFFERING - memcpy(sRxData, (void *)ZLL->PKT_BUFFER_RX, sRxPacket.mLength); + memcpy(sRxData, (void *)ZLL->PKT_BUFFER_RX, sRxFrame.mLength); #endif sRxDone = true; break; case XCVR_TX_c: case XCVR_TR_c: - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; if ((ZLL->PHY_CTRL & ZLL_PHY_CTRL_CCABFRTX_MASK) && (irqStatus & ZLL_IRQSTS_CCA_MASK)) { @@ -794,7 +798,7 @@ void Radio_1_IRQHandler(void) } } - if ((sState == kStateReceive) && (rf_get_state() == XCVR_Idle_c)) + if ((sState == OT_RADIO_STATE_RECEIVE) && (rf_get_state() == XCVR_Idle_c)) { /* Restart RX */ while (ZLL->SEQ_STATE & ZLL_SEQ_STATE_SEQ_STATE_MASK) {} @@ -857,13 +861,13 @@ void kw41zRadioInit(void) rf_set_channel(DEFAULT_CHANNEL); rf_set_tx_power(0); - sTxPacket.mLength = 0; - sTxPacket.mPsdu = (uint8_t *)ZLL->PKT_BUFFER_TX + 1; - sRxPacket.mLength = 0; + sTxFrame.mLength = 0; + sTxFrame.mPsdu = (uint8_t *)ZLL->PKT_BUFFER_TX + 1; + sRxFrame.mLength = 0; #if DOUBLE_BUFFERING - sRxPacket.mPsdu = sRxData; + sRxFrame.mPsdu = sRxData; #else - sRxPacket.mPsdu = (uint8_t *)ZLL->PKT_BUFFER_RX; + sRxFrame.mPsdu = (uint8_t *)ZLL->PKT_BUFFER_RX; #endif } @@ -871,7 +875,7 @@ void kw41zRadioProcess(otInstance *aInstance) { if (sTxDone) { - otPlatRadioTransmitDone(aInstance, &sTxPacket, sAckFpState, sTxStatus); + otPlatRadioTransmitDone(aInstance, &sTxFrame, sAckFpState, sTxStatus); sTxDone = false; } @@ -881,12 +885,12 @@ void kw41zRadioProcess(otInstance *aInstance) if (otPlatDiagModeGet()) { - otPlatDiagRadioReceiveDone(aInstance, &sRxPacket, OT_ERROR_NONE); + otPlatDiagRadioReceiveDone(aInstance, &sRxFrame, OT_ERROR_NONE); } else #endif { - otPlatRadioReceiveDone(aInstance, &sRxPacket, OT_ERROR_NONE); + otPlatRadioReceiveDone(aInstance, &sRxFrame, OT_ERROR_NONE); } sRxDone = false; diff --git a/examples/platforms/nrf52840/diag.c b/examples/platforms/nrf52840/diag.c index f4085e074..3cbf34184 100644 --- a/examples/platforms/nrf52840/diag.c +++ b/examples/platforms/nrf52840/diag.c @@ -242,7 +242,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) sTxPower = aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; @@ -281,7 +281,7 @@ void otPlatDiagAlarmCallback(otInstance *aInstance) { if ((sTxCount > 0) || (sTxCount == -1)) { - RadioPacket *sTxPacket = otPlatRadioGetTransmitBuffer(aInstance); + otRadioFrame *sTxPacket = otPlatRadioGetTransmitBuffer(aInstance); sTxPacket->mLength = sizeof(struct PlatformDiagMessage); sTxPacket->mChannel = sChannel; diff --git a/examples/platforms/nrf52840/radio.c b/examples/platforms/nrf52840/radio.c index 78ed76541..dd31e5870 100644 --- a/examples/platforms/nrf52840/radio.c +++ b/examples/platforms/nrf52840/radio.c @@ -72,15 +72,15 @@ enum static bool sDisabled; -static RadioPacket sReceivedFrames[RADIO_RX_BUFFERS]; -static RadioPacket sTransmitFrame; -static uint8_t sTransmitPsdu[kMaxPHYPacketSize + 1] +static otRadioFrame sReceivedFrames[RADIO_RX_BUFFERS]; +static otRadioFrame sTransmitFrame; +static uint8_t sTransmitPsdu[OT_RADIO_FRAME_MAX_SIZE + 1] __attribute__((section("nrf_radio_buffer.sTransmiPsdu"))); -static uint8_t *sAckPsdu; +static uint8_t *sAckPsdu; -static uint32_t sEnergyDetectionTime; -static uint8_t sEnergyDetectionChannel; -static int8_t sEnergyDetected; +static uint32_t sEnergyDetectionTime; +static uint8_t sEnergyDetectionChannel; +static int8_t sEnergyDetected; typedef enum { @@ -211,32 +211,32 @@ void nrf5RadioDeinit(void) nrf_drv_radio802154_deinit(); } -PhyState otPlatRadioGetState(otInstance *aInstance) +otRadioState otPlatRadioGetState(otInstance *aInstance) { (void) aInstance; if (sDisabled) { - return kStateDisabled; + return OT_RADIO_STATE_DISABLED; } switch (nrf_drv_radio802154_state_get()) { case NRF_DRV_RADIO802154_STATE_SLEEP: - return kStateSleep; + return OT_RADIO_STATE_SLEEP; case NRF_DRV_RADIO802154_STATE_RECEIVE: case NRF_DRV_RADIO802154_STATE_ENERGY_DETECTION: - return kStateReceive; + return OT_RADIO_STATE_RECEIVE; case NRF_DRV_RADIO802154_STATE_TRANSMIT: - return kStateTransmit; + return OT_RADIO_STATE_TRANSMIT; default: assert(false); // Make sure driver returned valid state. } - return kStateReceive; // It is the default state. Return it in case of unknown. + return OT_RADIO_STATE_RECEIVE; // It is the default state. Return it in case of unknown. } otError otPlatRadioEnable(otInstance *aInstance) @@ -311,13 +311,13 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) return OT_ERROR_NONE; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { (void) aInstance; - aPacket->mPsdu[-1] = aPacket->mLength; + aFrame->mPsdu[-1] = aFrame->mLength; - if (nrf_drv_radio802154_transmit(&aPacket->mPsdu[-1], aPacket->mChannel, aPacket->mPower)) + if (nrf_drv_radio802154_transmit(&aFrame->mPsdu[-1], aFrame->mChannel, aFrame->mPower)) { clearPendingEvents(); } @@ -330,7 +330,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) return OT_ERROR_NONE; } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void) aInstance; @@ -348,7 +348,7 @@ otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void) aInstance; - return kRadioCapsEnergyScan; + return OT_RADIO_CAPS_ENERGY_SCAN; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -584,7 +584,7 @@ void nrf5RadioProcess(otInstance *aInstance) void nrf_drv_radio802154_received(uint8_t *p_data, int8_t power, int8_t lqi) { - RadioPacket *receivedFrame = NULL; + otRadioFrame *receivedFrame = NULL; for (uint32_t i = 0; i < RADIO_RX_BUFFERS; i++) { diff --git a/examples/platforms/posix/diag.c b/examples/platforms/posix/diag.c index 494f7f4b4..495682a33 100644 --- a/examples/platforms/posix/diag.c +++ b/examples/platforms/posix/diag.c @@ -72,7 +72,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower) (void) aTxPower; } -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void) aInstance; (void) aFrame; diff --git a/examples/platforms/posix/radio.c b/examples/platforms/posix/radio.c index 61ef222cf..63bfcc0a5 100644 --- a/examples/platforms/posix/radio.c +++ b/examples/platforms/posix/radio.c @@ -84,21 +84,21 @@ OT_TOOL_PACKED_BEGIN struct RadioMessage { uint8_t mChannel; - uint8_t mPsdu[kMaxPHYPacketSize]; + uint8_t mPsdu[OT_RADIO_FRAME_MAX_SIZE]; } OT_TOOL_PACKED_END; -static void radioTransmit(struct RadioMessage *msg, const struct RadioPacket *pkt); +static void radioTransmit(struct RadioMessage *msg, const struct otRadioFrame *pkt); static void radioSendMessage(otInstance *aInstance); static void radioSendAck(void); static void radioProcessFrame(otInstance *aInstance); -static PhyState sState = kStateDisabled; +static otRadioState sState = OT_RADIO_STATE_DISABLED; static struct RadioMessage sReceiveMessage; static struct RadioMessage sTransmitMessage; static struct RadioMessage sAckMessage; -static RadioPacket sReceiveFrame; -static RadioPacket sTransmitFrame; -static RadioPacket sAckFrame; +static otRadioFrame sReceiveFrame; +static otRadioFrame sTransmitFrame; +static otRadioFrame sAckFrame; static uint8_t sExtendedAddress[OT_EXT_ADDRESS_SIZE]; static uint16_t sShortAddress; @@ -387,14 +387,14 @@ void platformRadioInit(void) bool otPlatRadioIsEnabled(otInstance *aInstance) { (void)aInstance; - return (sState != kStateDisabled) ? true : false; + return (sState != OT_RADIO_STATE_DISABLED) ? true : false; } otError otPlatRadioEnable(otInstance *aInstance) { if (!otPlatRadioIsEnabled(aInstance)) { - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; } return OT_ERROR_NONE; @@ -404,7 +404,7 @@ otError otPlatRadioDisable(otInstance *aInstance) { if (otPlatRadioIsEnabled(aInstance)) { - sState = kStateDisabled; + sState = OT_RADIO_STATE_DISABLED; } return OT_ERROR_NONE; @@ -415,10 +415,10 @@ otError otPlatRadioSleep(otInstance *aInstance) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState == kStateSleep || sState == kStateReceive) + if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE) { error = OT_ERROR_NONE; - sState = kStateSleep; + sState = OT_RADIO_STATE_SLEEP; } return error; @@ -429,10 +429,10 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - if (sState != kStateDisabled) + if (sState != OT_RADIO_STATE_DISABLED) { error = OT_ERROR_NONE; - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; sAckWait = false; sReceiveFrame.mChannel = aChannel; } @@ -440,22 +440,22 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) return error; } -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aRadio) { otError error = OT_ERROR_INVALID_STATE; (void)aInstance; - (void)aPacket; + (void)aRadio; - if (sState == kStateReceive) + if (sState == OT_RADIO_STATE_RECEIVE) { error = OT_ERROR_NONE; - sState = kStateTransmit; + sState = OT_RADIO_STATE_TRANSMIT; } return error; } -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { (void)aInstance; return &sTransmitFrame; @@ -470,7 +470,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { (void)aInstance; - return kRadioCapsNone; + return OT_RADIO_CAPS_NONE; } bool otPlatRadioGetPromiscuous(otInstance *aInstance) @@ -496,7 +496,7 @@ void radioReceive(otInstance *aInstance) isFrameTypeAck(sReceiveFrame.mPsdu) && getDsn(sReceiveFrame.mPsdu) == getDsn(sTransmitFrame.mPsdu)) { - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; sAckWait = false; #if OPENTHREAD_ENABLE_DIAG @@ -511,7 +511,7 @@ void radioReceive(otInstance *aInstance) otPlatRadioTxDone(aInstance, &sTransmitFrame, &sReceiveFrame, OT_ERROR_NONE); } } - else if ((sState == kStateReceive || sState == kStateTransmit) && + else if ((sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_TRANSMIT) && (sReceiveFrame.mChannel == sReceiveMessage.mChannel)) { radioProcessFrame(aInstance); @@ -528,7 +528,7 @@ void radioSendMessage(otInstance *aInstance) if (!sAckWait) { - sState = kStateReceive; + sState = OT_RADIO_STATE_RECEIVE; #if OPENTHREAD_ENABLE_DIAG @@ -546,7 +546,7 @@ void radioSendMessage(otInstance *aInstance) void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMaxFd) { - if (aReadFdSet != NULL && (sState != kStateTransmit || sAckWait)) + if (aReadFdSet != NULL && (sState != OT_RADIO_STATE_TRANSMIT || sAckWait)) { FD_SET(sSockFd, aReadFdSet); @@ -556,7 +556,7 @@ void platformRadioUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, int *aMax } } - if (aWriteFdSet != NULL && sState == kStateTransmit && !sAckWait) + if (aWriteFdSet != NULL && sState == OT_RADIO_STATE_TRANSMIT && !sAckWait) { FD_SET(sSockFd, aWriteFdSet); @@ -577,13 +577,13 @@ void platformRadioProcess(otInstance *aInstance) radioReceive(aInstance); } - if (sState == kStateTransmit && !sAckWait) + if (sState == OT_RADIO_STATE_TRANSMIT && !sAckWait) { radioSendMessage(aInstance); } } -void radioTransmit(struct RadioMessage *msg, const struct RadioPacket *pkt) +void radioTransmit(struct RadioMessage *msg, const struct otRadioFrame *pkt) { uint32_t i; struct sockaddr_in sockaddr; @@ -678,7 +678,7 @@ void radioProcessFrame(otInstance *aInstance) } sReceiveFrame.mPower = -20; - sReceiveFrame.mLqi = kPhyNoLqi; + sReceiveFrame.mLqi = OT_RADIO_LQI_NONE; // generate acknowledgment if (isAckRequested(sReceiveFrame.mPsdu)) diff --git a/include/openthread/link.h b/include/openthread/link.h index 77584390d..9df373d9d 100644 --- a/include/openthread/link.h +++ b/include/openthread/link.h @@ -548,7 +548,7 @@ OTAPI const otMacCounters *OTCALL otLinkGetCounters(otInstance *aInstance); * @param[in] aContext A pointer to application-specific context. * */ -typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame, void *aContext); +typedef void (*otLinkPcapCallback)(const otRadioFrame *aFrame, void *aContext); /** * This function registers a callback to provide received raw IEEE 802.15.4 frames. diff --git a/include/openthread/link_raw.h b/include/openthread/link_raw.h index caa1b8d1d..8531ebfd6 100644 --- a/include/openthread/link_raw.h +++ b/include/openthread/link_raw.h @@ -151,12 +151,12 @@ otError otLinkRawSleep(otInstance *aInstance); * This function pointer on receipt of a IEEE 802.15.4 frame. * * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aPacket A pointer to the received packet or NULL if the receive operation was aborted. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation was aborted. * @param[in] aError OT_ERROR_NONE when successfully received a frame. * OT_ERROR_ABORT when reception was aborted and a frame was not received. * */ -typedef void (OTCALL *otLinkRawReceiveDone)(otInstance *aInstance, RadioPacket *aPacket, otError aError); +typedef void (OTCALL *otLinkRawReceiveDone)(otInstance *aInstance, otRadioFrame *aFrame, otError aError); /** * Transitioning the radio from Sleep to Receive. @@ -184,13 +184,13 @@ otError otLinkRawReceive(otInstance *aInstance, uint8_t aChannel, otLinkRawRecei * @returns A pointer to the transmit buffer or NULL if the raw link-layer isn't enabled. * */ -RadioPacket *otLinkRawGetTransmitBuffer(otInstance *aInstance); +otRadioFrame *otLinkRawGetTransmitBuffer(otInstance *aInstance); /** * This function pointer on receipt of a IEEE 802.15.4 frame. * * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aPacket A pointer to the packet that was transmitted. + * @param[in] aFrame A pointer to the frame that was transmitted. * @param[in] aFramePending TRUE if an ACK frame was received and the Frame Pending bit was set. * @param[in] aError OT_ERROR_NONE when the frame was transmitted. * OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received @@ -199,28 +199,28 @@ RadioPacket *otLinkRawGetTransmitBuffer(otInstance *aInstance); * OT_ERROR_ABORT when transmission was aborted for other reasons. * */ -typedef void (*otLinkRawTransmitDone)(otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, +typedef void (*otLinkRawTransmitDone)(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, otError aError); /** * This method begins the transmit sequence on the radio. * * The caller must form the IEEE 802.15.4 frame in the buffer provided by otLinkRawGetTransmitBuffer() before - * requesting transmission. The channel and transmit power are also included in the RadioPacket structure. + * requesting transmission. The channel and transmit power are also included in the otRadioFrame structure. * * The transmit sequence consists of: * 1. Transitioning the radio to Transmit from Receive. * 2. Transmits the psdu on the given channel and at the given transmit power. * * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aPacket A pointer to the packet that was transmitted. + * @param[in] aFrame A pointer to the frame that was transmitted. * @param[in] aCallback A pointer to a function called on completion of the transmission. * * @retval OT_ERROR_NONE Successfully transitioned to Transmit. * @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state. * */ -otError otLinkRawTransmit(otInstance *aInstance, RadioPacket *aPacket, otLinkRawTransmitDone aCallback); +otError otLinkRawTransmit(otInstance *aInstance, otRadioFrame *aFrame, otLinkRawTransmitDone aCallback); /** * Get the most recent RSSI measurement. diff --git a/include/openthread/platform/diag.h b/include/openthread/platform/diag.h index 69250544f..dd4b3c917 100644 --- a/include/openthread/platform/diag.h +++ b/include/openthread/platform/diag.h @@ -108,7 +108,7 @@ void otPlatDiagTxPowerSet(int8_t aTxPower); * @param[in] aError The received radio frame status. * */ -void otPlatDiagRadioReceived(otInstance *aInstance, RadioPacket *aFrame, otError aError); +void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError); /** * This function processes the alarm event. diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 4baa7b49b..c72cf469b 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -58,7 +58,7 @@ extern "C" { * @defgroup radio-types Types * * @brief - * This module includes the platform abstraction for a radio packet. + * This module includes the platform abstraction for a radio frame. * * @{ * @@ -66,61 +66,60 @@ extern "C" { enum { - kMaxPHYPacketSize = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006) - kPhyMinChannel = 11, ///< 2.4 GHz IEEE 802.15.4-2006 - kPhyMaxChannel = 26, ///< 2.4 GHz IEEE 802.15.4-2006 - kPhySupportedChannelMask = 0xffff << kPhyMinChannel, ///< 2.4 GHz IEEE 802.15.4-2006 - kPhySymbolsPerOctet = 2, ///< 2.4 GHz IEEE 802.15.4-2006 - kPhyBitRate = 250000, ///< 2.4 GHz IEEE 802.15.4 (kilobits per second) + 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 + OT_RADIO_SYMBOLS_PER_OCTET = 2, ///< 2.4 GHz IEEE 802.15.4-2006 + OT_RADIO_BIT_RATE = 250000, ///< 2.4 GHz IEEE 802.15.4 (kilobits per second) - kPhyBitsPerOctet = 8, - kPhyUsPerSymbol = ((kPhyBitsPerOctet / kPhySymbolsPerOctet) * 1000000) / kPhyBitRate, + OT_RADIO_BITS_PER_OCTET = 8, ///< Number of bits per octet + OT_RADIO_SYMBOL_TIME = ((OT_RADIO_BITS_PER_OCTET / OT_RADIO_SYMBOLS_PER_OCTET) * 1000000) / OT_RADIO_BIT_RATE, - kPhyNoLqi = 0, ///< LQI measurement not supported - kPhyInvalidRssi = 127, ///< Invalid or unknown RSSI value + OT_RADIO_LQI_NONE = 0, ///< LQI measurement not supported + OT_RADIO_RSSI_INVALID = 127, ///< Invalid or unknown RSSI value }; /** - * This enum represents radio capabilities. + * This enum represents radio capabilities. * */ - typedef enum otRadioCaps { - kRadioCapsNone = 0, ///< None - kRadioCapsAckTimeout = 1, ///< Radio supports AckTime event - kRadioCapsEnergyScan = 2, ///< Radio supports Energy Scans - kRadioCapsTransmitRetries = 4, ///< Radio supports transmission retry logic with collision avoidance (CSMA). - kRadioCapsCsmaBackOff = 8, ///< Radio supports CSMA backoff for frame transmission (but no retry). + OT_RADIO_CAPS_NONE = 0, ///< None + OT_RADIO_CAPS_ACK_TIMEOUT = 1, ///< Radio supports AckTime event + OT_RADIO_CAPS_ENERGY_SCAN = 2, ///< Radio supports Energy Scans + OT_RADIO_CAPS_TRANSMIT_RETRIES = 4, ///< Radio supports transmission retry logic with collision avoidance (CSMA). + OT_RADIO_CAPS_CSMA_BACKOFF = 8, ///< Radio supports CSMA backoff for frame transmission (but no retry). } otRadioCaps; /** * This structure represents an IEEE 802.15.4 radio frame. */ -typedef struct RadioPacket +typedef struct otRadioFrame { - uint8_t *mPsdu; ///< The PSDU. - uint8_t mLength; ///< Length of the PSDU. - uint8_t mChannel; ///< Channel used to transmit/receive the frame. - int8_t mPower; ///< Transmit/receive power in dBm. - uint8_t mLqi; ///< Link Quality Indicator for received frames. - uint8_t mMaxTxAttempts; ///< Max number of transmit attempts for an outbound frame. + uint8_t *mPsdu; ///< The PSDU. + uint8_t mLength; ///< Length of the PSDU. + uint8_t mChannel; ///< Channel used to transmit/receive the frame. + int8_t mPower; ///< Transmit/receive power in dBm. + uint8_t mLqi; ///< Link Quality Indicator for received frames. + uint8_t mMaxTxAttempts; ///< Max number of transmit attempts for an outbound frame. bool mSecurityValid: 1; ///< Security Enabled flag is set and frame passes security checks. - bool mDidTX: 1; ///< Set to true if this packet sent from the radio. Ignored by radio driver. - bool mIsARetx: 1; ///< Set to true if this packet is a retransmission. Should be ignored by radio driver. -} RadioPacket; + bool mDidTX: 1; ///< Set to true if this frame sent from the radio. Ignored by radio driver. + bool mIsARetx: 1; ///< Set to true if this frame is a retransmission. Should be ignored by radio driver. +} otRadioFrame; /** * This structure represents the state of a radio. * Initially, a radio is in the Disabled state. */ -typedef enum PhyState +typedef enum otRadioState { - kStateDisabled = 0, - kStateSleep = 1, - kStateReceive = 2, - kStateTransmit = 3 -} PhyState; + OT_RADIO_STATE_DISABLED = 0, + OT_RADIO_STATE_SLEEP = 1, + OT_RADIO_STATE_RECEIVE = 2, + OT_RADIO_STATE_TRANSMIT = 3 +} otRadioState; /** * The following are valid radio state transitions: @@ -212,7 +211,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aShortAddress); * * @return Current state of the radio. */ -PhyState otPlatRadioGetState(otInstance *aInstance); +otRadioState otPlatRadioGetState(otInstance *aInstance); /** * Enable the radio. @@ -347,16 +346,16 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance); void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance); /** - * The radio driver calls this method to notify OpenThread of a received packet. + * The radio driver calls this method to notify OpenThread of a received frame. * * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the received packet or NULL if the receive operation failed. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. * @param[in] aError OT_ERROR_NONE when successfully received a frame, OT_ERROR_ABORT when reception * was aborted and a frame was not received, OT_ERROR_NO_BUFS when a frame could not be * received due to lack of rx buffer space. * */ -extern void otPlatRadioReceiveDone(otInstance *aInstance, RadioPacket *aPacket, otError aError); +extern void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); /** * The radio transitions from Transmit to Receive. @@ -369,40 +368,40 @@ extern void otPlatRadioReceiveDone(otInstance *aInstance, RadioPacket *aPacket, * @returns A pointer to the transmit buffer. * */ -RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance); +otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance); /** * This method begins the transmit sequence on the radio. * * The caller must form the IEEE 802.15.4 frame in the buffer provided by otPlatRadioGetTransmitBuffer() before - * requesting transmission. The channel and transmit power are also included in the RadioPacket structure. + * requesting transmission. The channel and transmit power are also included in the otRadioFrame structure. * * The transmit sequence consists of: * 1. Transitioning the radio to Transmit from Receive. * 2. Transmits the psdu on the given channel and at the given transmit power. * * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the packet that will be transmitted. + * @param[in] aFrame A pointer to the frame that will be transmitted. * * @retval OT_ERROR_NONE Successfully transitioned to Transmit. * @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state. */ -otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket); +otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame); /** * The radio driver calls this method to notify OpenThread that the transmission has completed, * this callback pass up the ACK frame, new add platforms should use this callback function. * - * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the packet that was transmitted. - * @param[in] aAckPacket A pointer to the ACK packet, NULL if no ACK was received. - * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was - * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission - * could not take place due to activity on the channel, OT_ERROR_ABORT when transmission was - * aborted for other reasons. + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was + * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission + * could not take place due to activity on the channel, OT_ERROR_ABORT when transmission was + * aborted for other reasons. * */ -extern void otPlatRadioTxDone(otInstance *aInstance, RadioPacket *aPacket, RadioPacket *aAckPacket, +extern void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); /** @@ -410,7 +409,7 @@ extern void otPlatRadioTxDone(otInstance *aInstance, RadioPacket *aPacket, Radio * this function is going to be deprecated, new add platfroms should not use this callback function. * * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the packet that was transmitted. + * @param[in] aFrame A pointer to the frame that was transmitted. * @param[in] aFramePending TRUE if an ACK frame was received and the Frame Pending bit was set. * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission @@ -418,7 +417,7 @@ extern void otPlatRadioTxDone(otInstance *aInstance, RadioPacket *aPacket, Radio * aborted for other reasons. * */ -extern void otPlatRadioTransmitDone(otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, +extern void otPlatRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, otError aError); /** @@ -470,7 +469,7 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable); * The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed. * * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the packet that was transmitted. + * @param[in] aFrame A pointer to the frame that was transmitted. * @param[in] aFramePending TRUE if an ACK frame was received and the Frame Pending bit was set. * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission @@ -478,20 +477,20 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable); * aborted for other reasons. * */ -extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, +extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, otError aError); /** - * The radio driver calls this method to notify OpenThread diagnostics module of a received packet. + * The radio driver calls this method to notify OpenThread diagnostics module of a received frame. * * @param[in] aInstance The OpenThread instance structure. - * @param[in] aPacket A pointer to the received packet or NULL if the receive operation failed. + * @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed. * @param[in] aError OT_ERROR_NONE when successfully received a frame, OT_ERROR_ABORT when reception * was aborted and a frame was not received, OT_ERROR_NO_BUFS when a frame could not be * received due to lack of rx buffer space. * */ -extern void otPlatDiagRadioReceiveDone(otInstance *aInstance, RadioPacket *aPacket, otError aError); +extern void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); /** * This method begins the energy scan sequence on the radio. diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index fea00c59e..c94354f9e 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -1716,12 +1716,12 @@ exit: AppendResult(error); } -void Interpreter::s_HandleLinkPcapReceive(const RadioPacket *aFrame, void *aContext) +void Interpreter::s_HandleLinkPcapReceive(const otRadioFrame *aFrame, void *aContext) { static_cast(aContext)->HandleLinkPcapReceive(aFrame); } -void Interpreter::HandleLinkPcapReceive(const RadioPacket *aFrame) +void Interpreter::HandleLinkPcapReceive(const otRadioFrame *aFrame) { sServer->OutputFormat("\r\n"); diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index 7967e67d1..f327f5c61 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -280,7 +280,7 @@ private: static void OTCALL s_HandleActiveScanResult(otActiveScanResult *aResult, void *aContext); static void OTCALL s_HandleNetifStateChanged(uint32_t aFlags, void *aContext); #ifndef OTDLL - static void s_HandleLinkPcapReceive(const RadioPacket *aFrame, void *aContext); + static void s_HandleLinkPcapReceive(const otRadioFrame *aFrame, void *aContext); #endif static void OTCALL s_HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength, void *aContext); @@ -308,7 +308,7 @@ private: void HandleNetifStateChanged(uint32_t aFlags); #endif #ifndef OTDLL - void HandleLinkPcapReceive(const RadioPacket *aFrame); + void HandleLinkPcapReceive(const otRadioFrame *aFrame); #endif void HandleEnergyReport(uint32_t aChannelMask, const uint8_t *aEnergyList, uint8_t aEnergyListLength); void HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask); diff --git a/src/core/api/link_raw.hpp b/src/core/api/link_raw.hpp index e0d46e50c..b9e4e5e33 100644 --- a/src/core/api/link_raw.hpp +++ b/src/core/api/link_raw.hpp @@ -84,19 +84,19 @@ public: * This method invokes the mReceiveDoneCallback, if set. * */ - void InvokeReceiveDone(RadioPacket *aPacket, otError aError); + void InvokeReceiveDone(otRadioFrame *aFrame, otError aError); /** * This method starts a (single) Transmit on the link-layer. * */ - otError Transmit(RadioPacket *aPacket, otLinkRawTransmitDone aCallback); + otError Transmit(otRadioFrame *aFrame, otLinkRawTransmitDone aCallback); /** * This method invokes the mTransmitDoneCallback, if set. * */ - void InvokeTransmitDone(RadioPacket *aPacket, bool aFramePending, otError aError); + void InvokeTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); /** * This method starts a (single) Enery Scan on the link-layer. @@ -119,7 +119,7 @@ private: otLinkRawTransmitDone mTransmitDoneCallback; otLinkRawEnergyScanDone mEnergyScanDoneCallback; - otError DoTransmit(RadioPacket *aPacket); + otError DoTransmit(otRadioFrame *aFrame); #if OPENTHREAD_LINKRAW_TIMER_REQUIRED diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index 01d678b32..a6e7d24cf 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -140,9 +140,9 @@ otError otLinkRawReceive(otInstance *aInstance, uint8_t aChannel, otLinkRawRecei return aInstance->mLinkRaw.Receive(aChannel, aCallback); } -RadioPacket *otLinkRawGetTransmitBuffer(otInstance *aInstance) +otRadioFrame *otLinkRawGetTransmitBuffer(otInstance *aInstance) { - RadioPacket *buffer = NULL; + otRadioFrame *buffer = NULL; VerifyOrExit(aInstance->mLinkRaw.IsEnabled()); @@ -152,10 +152,10 @@ exit: return buffer; } -otError otLinkRawTransmit(otInstance *aInstance, RadioPacket *aPacket, otLinkRawTransmitDone aCallback) +otError otLinkRawTransmit(otInstance *aInstance, otRadioFrame *aFrame, otLinkRawTransmitDone aCallback) { - otLogInfoPlat(aInstance, "LinkRaw Transmit (%d bytes on channel %d)", aPacket->mLength, aPacket->mChannel); - return aInstance->mLinkRaw.Transmit(aPacket, aCallback); + otLogInfoPlat(aInstance, "LinkRaw Transmit (%d bytes on channel %d)", aFrame->mLength, aFrame->mChannel); + return aInstance->mLinkRaw.Transmit(aFrame, aCallback); } int8_t otLinkRawGetRssi(otInstance *aInstance) @@ -287,18 +287,18 @@ otRadioCaps LinkRaw::GetCaps() // time included into the raw link-layer code. #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT - assert((RadioCaps & kRadioCapsAckTimeout) == 0); - RadioCaps = (otRadioCaps)(RadioCaps | kRadioCapsAckTimeout); + assert((RadioCaps & OT_RADIO_CAPS_ACK_TIMEOUT) == 0); + RadioCaps = (otRadioCaps)(RadioCaps | OT_RADIO_CAPS_ACK_TIMEOUT); #endif // OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT - assert((RadioCaps & kRadioCapsTransmitRetries) == 0); - RadioCaps = (otRadioCaps)(RadioCaps | kRadioCapsTransmitRetries); + assert((RadioCaps & OT_RADIO_CAPS_TRANSMIT_RETRIES) == 0); + RadioCaps = (otRadioCaps)(RadioCaps | OT_RADIO_CAPS_TRANSMIT_RETRIES); #endif // OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ENERGY_SCAN - assert((RadioCaps & kRadioCapsEnergyScan) == 0); - RadioCaps = (otRadioCaps)(RadioCaps | kRadioCapsEnergyScan); + assert((RadioCaps & OT_RADIO_CAPS_ENERGY_SCAN) == 0); + RadioCaps = (otRadioCaps)(RadioCaps | OT_RADIO_CAPS_ENERGY_SCAN); #endif // OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ENERGY_SCAN return RadioCaps; @@ -318,24 +318,24 @@ otError LinkRaw::Receive(uint8_t aChannel, otLinkRawReceiveDone aCallback) return error; } -void LinkRaw::InvokeReceiveDone(RadioPacket *aPacket, otError aError) +void LinkRaw::InvokeReceiveDone(otRadioFrame *aFrame, otError aError) { if (mReceiveDoneCallback) { if (aError == OT_ERROR_NONE) { - otLogInfoPlat(&mInstance, "LinkRaw Invoke Receive Done (%d bytes)", aPacket->mLength); + otLogInfoPlat(&mInstance, "LinkRaw Invoke Receive Done (%d bytes)", aFrame->mLength); } else { otLogWarnPlat(&mInstance, "LinkRaw Invoke Receive Done (err=0x%x)", aError); } - mReceiveDoneCallback(&mInstance, aPacket, aError); + mReceiveDoneCallback(&mInstance, aFrame, aError); } } -otError LinkRaw::Transmit(RadioPacket *aPacket, otLinkRawTransmitDone aCallback) +otError LinkRaw::Transmit(otRadioFrame *aFrame, otLinkRawTransmitDone aCallback) { otError error = OT_ERROR_INVALID_STATE; @@ -344,7 +344,7 @@ otError LinkRaw::Transmit(RadioPacket *aPacket, otLinkRawTransmitDone aCallback) mTransmitDoneCallback = aCallback; #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT - (void)aPacket; + (void)aFrame; mTransmitAttempts = 0; mCsmaAttempts = 0; @@ -353,22 +353,22 @@ otError LinkRaw::Transmit(RadioPacket *aPacket, otLinkRawTransmitDone aCallback) error = OT_ERROR_NONE; #else // Let the hardware do the transmission logic - error = DoTransmit(aPacket); + error = DoTransmit(aFrame); #endif } return error; } -otError LinkRaw::DoTransmit(RadioPacket *aPacket) +otError LinkRaw::DoTransmit(otRadioFrame *aFrame) { - otError error = otPlatRadioTransmit(&mInstance, aPacket); + otError error = otPlatRadioTransmit(&mInstance, aFrame); #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ACK_TIMEOUT // If we are implementing the ACK timeout logic, start a timer here (if ACK request) // to fire if we don't get a transmit done callback in time. - if (static_cast(aPacket)->GetAckRequest()) + if (static_cast(aFrame)->GetAckRequest()) { otLogDebgPlat(aInstance, "LinkRaw Starting AckTimeout Timer"); mTimerReason = kTimerReasonAckTimeout; @@ -380,7 +380,7 @@ otError LinkRaw::DoTransmit(RadioPacket *aPacket) return error; } -void LinkRaw::InvokeTransmitDone(RadioPacket *aPacket, bool aFramePending, otError aError) +void LinkRaw::InvokeTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError) { otLogDebgPlat(aInstance, "LinkRaw Transmit Done (err=0x%x)", aError); @@ -406,7 +406,7 @@ void LinkRaw::InvokeTransmitDone(RadioPacket *aPacket, bool aFramePending, otErr if (aError == OT_ERROR_NO_ACK) { - if (mTransmitAttempts < aPacket->mMaxTxAttempts) + if (mTransmitAttempts < aFrame->mMaxTxAttempts) { mTransmitAttempts++; StartCsmaBackoff(); @@ -430,7 +430,7 @@ void LinkRaw::InvokeTransmitDone(RadioPacket *aPacket, bool aFramePending, otErr otLogWarnPlat(aInstance, "LinkRaw Invoke Transmit Failed (err=0x%x)", aError); } - mTransmitDoneCallback(&mInstance, aPacket, aFramePending, aError); + mTransmitDoneCallback(&mInstance, aFrame, aFramePending, aError); mTransmitDoneCallback = NULL; } @@ -507,14 +507,14 @@ void LinkRaw::HandleTimer(void) case kTimerReasonRetransmitTimeout: { - RadioPacket *aPacket = otPlatRadioGetTransmitBuffer(&mInstance); + otRadioFrame *aFrame = otPlatRadioGetTransmitBuffer(&mInstance); // Start the transmit now - otError error = DoTransmit(aPacket); + otError error = DoTransmit(aFrame); if (error != OT_ERROR_NONE) { - InvokeTransmitDone(aPacket, false, error); + InvokeTransmitDone(aFrame, false, error); } break; @@ -553,7 +553,7 @@ void LinkRaw::StartCsmaBackoff(void) } backoff = (otPlatRandomGet() % (1UL << backoffExponent)); - backoff *= (Mac::kUnitBackoffPeriod * kPhyUsPerSymbol); + backoff *= (Mac::kUnitBackoffPeriod * OT_RADIO_SYMBOL_TIME); #if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_BACKOFF_TIMER otPlatUsecAlarmTime now; diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 44a5d2b52..61deb3a58 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -77,8 +77,8 @@ static const uint8_t sExtendedPanidInit[] = {0xde, 0xad, 0x00, 0xbe, 0xef, 0x00, static const char sNetworkNameInit[] = "OpenThread"; #ifdef _WIN32 -const uint32_t kMinBackoffSum = kMinBackoff + (kUnitBackoffPeriod *kPhyUsPerSymbol * (1 << kMinBE)) / 1000; -const uint32_t kMaxBackoffSum = kMinBackoff + (kUnitBackoffPeriod *kPhyUsPerSymbol * (1 << kMaxBE)) / 1000; +const uint32_t kMinBackoffSum = kMinBackoff + (kUnitBackoffPeriod *OT_RADIO_SYMBOL_TIME * (1 << kMinBE)) / 1000; +const uint32_t kMaxBackoffSum = kMinBackoff + (kUnitBackoffPeriod *OT_RADIO_SYMBOL_TIME * (1 << kMaxBE)) / 1000; static_assert(kMinBackoffSum > 0, "The min backoff value should be greater than zero!"); #endif @@ -100,7 +100,7 @@ void Mac::StartCsmaBackoff(void) } backoff = (otPlatRandomGet() % (1UL << backoffExponent)); - backoff *= (kUnitBackoffPeriod * kPhyUsPerSymbol); + backoff *= (kUnitBackoffPeriod * OT_RADIO_SYMBOL_TIME); #if OPENTHREAD_CONFIG_ENABLE_PLATFORM_USEC_BACKOFF_TIMER otPlatUsecAlarmTime now; @@ -141,7 +141,7 @@ Mac::Mac(ThreadNetif &aThreadNetif): mTransmitBeacon(false), mBeaconsEnabled(false), mPendingScanRequest(kScanTypeNone), - mScanChannel(kPhyMinChannel), + mScanChannel(OT_RADIO_CHANNEL_MIN), mScanChannels(0xff), mScanDuration(0), mScanContext(NULL), @@ -206,8 +206,8 @@ otError Mac::Scan(ScanType aScanType, uint32_t aScanChannels, uint16_t aScanDura mScanChannels = (aScanChannels == 0) ? static_cast(kScanChannelsAll) : aScanChannels; mScanDuration = (aScanDuration == 0) ? static_cast(kScanDurationDefault) : aScanDuration; - mScanChannel = kPhyMinChannel; - mScanChannels >>= kPhyMinChannel; + mScanChannel = OT_RADIO_CHANNEL_MIN; + mScanChannels >>= OT_RADIO_CHANNEL_MIN; while ((mScanChannels & 1) == 0) { @@ -300,7 +300,7 @@ void Mac::StartEnergyScan(void) { mState = kStateEnergyScan; - if (!(otPlatRadioGetCaps(GetInstance()) & kRadioCapsEnergyScan)) + if (!(otPlatRadioGetCaps(GetInstance()) & OT_RADIO_CAPS_ENERGY_SCAN)) { mEnergyScanCurrentMaxRssi = kInvalidRssiValue; mMacTimer.Start(mScanDuration); @@ -355,7 +355,7 @@ void Mac::EnergyScanDone(int8_t aEnergyScanMaxRssi) // If we have scanned all the channels, then fire the final callback // and start the next transmission task - if (mScanChannels == 0 || mScanChannel > kPhyMaxChannel) + if (mScanChannels == 0 || mScanChannel > OT_RADIO_CHANNEL_MAX) { otPlatRadioReceive(GetInstance(), mChannel); mEnergyScanHandler(mScanContext, NULL); @@ -837,10 +837,10 @@ void Mac::HandleBeginTransmit(void) error = otPlatRadioReceive(GetInstance(), sendFrame.GetChannel()); assert(error == OT_ERROR_NONE); - error = otPlatRadioTransmit(GetInstance(), static_cast(&sendFrame)); + error = otPlatRadioTransmit(GetInstance(), static_cast(&sendFrame)); assert(error == OT_ERROR_NONE); - if (sendFrame.GetAckRequest() && !(otPlatRadioGetCaps(GetInstance()) & kRadioCapsAckTimeout)) + if (sendFrame.GetAckRequest() && !(otPlatRadioGetCaps(GetInstance()) & OT_RADIO_CAPS_ACK_TIMEOUT)) { mMacTimer.Start(kAckTimeout); otLogDebgMac(GetInstance(), "Ack timer start"); @@ -865,7 +865,7 @@ exit: } #if OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE -extern "C" void otPlatRadioTransmitDone(otInstance *aInstance, RadioPacket *aPacket, bool aRxPending, +extern "C" void otPlatRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aRxPending, otError aError) { otLogFuncEntryMsg("%!otError!, aRxPending=%u", aError, aRxPending ? 1 : 0); @@ -874,35 +874,35 @@ extern "C" void otPlatRadioTransmitDone(otInstance *aInstance, RadioPacket *aPac if (aInstance->mLinkRaw.IsEnabled()) { - aInstance->mLinkRaw.InvokeTransmitDone(aPacket, aRxPending, aError); + aInstance->mLinkRaw.InvokeTransmitDone(aFrame, aRxPending, aError); } else #endif // OPENTHREAD_ENABLE_RAW_LINK_API { - aInstance->mThreadNetif.GetMac().TransmitDoneTask(aPacket, aRxPending, aError); + aInstance->mThreadNetif.GetMac().TransmitDoneTask(aFrame, aRxPending, aError); } otLogFuncExit(); } -void Mac::TransmitDoneTask(RadioPacket *aPacket, bool aRxPending, otError aError) +void Mac::TransmitDoneTask(otRadioFrame *aFrame, bool aRxPending, otError aError) { mMacTimer.Stop(); mCounters.mTxTotal++; - Frame *packet = static_cast(aPacket); + Frame *frame = static_cast(aFrame); Address addr; - packet->GetDstAddr(addr); + frame->GetDstAddr(addr); if (addr.mShortAddress == kShortAddrBroadcast) { - // Broadcast packet + // Broadcast frame mCounters.mTxBroadcast++; } else { - // Unicast packet + // Unicast frame mCounters.mTxUnicast++; } @@ -953,7 +953,7 @@ exit: } #else // #if OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE -extern "C" void otPlatRadioTxDone(otInstance *aInstance, RadioPacket *aPacket, RadioPacket *aAckPacket, +extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) { otLogFuncEntryMsg("%!otError!", aError); @@ -962,20 +962,20 @@ extern "C" void otPlatRadioTxDone(otInstance *aInstance, RadioPacket *aPacket, R if (aInstance->mLinkRaw.IsEnabled()) { - aInstance->mLinkRaw.InvokeTransmitDone(aPacket, (static_cast(aAckPacket))->GetFramePending(), aError); + aInstance->mLinkRaw.InvokeTransmitDone(aFrame, (static_cast(aAckFrame))->GetFramePending(), aError); } else #endif // OPENTHREAD_ENABLE_RAW_LINK_API { - aInstance->mThreadNetif.GetMac().TransmitDoneTask(aPacket, aAckPacket, aError); + aInstance->mThreadNetif.GetMac().TransmitDoneTask(aFrame, aAckFrame, aError); } otLogFuncExit(); } -void Mac::TransmitDoneTask(RadioPacket *aPacket, RadioPacket *aAckPacket, otError aError) +void Mac::TransmitDoneTask(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) { - Frame *txFrame = static_cast(aPacket); + Frame *txFrame = static_cast(aFrame); Address addr; bool framePending = false; @@ -985,9 +985,9 @@ void Mac::TransmitDoneTask(RadioPacket *aPacket, RadioPacket *aAckPacket, otErro txFrame->GetDstAddr(addr); - if (aError == OT_ERROR_NONE && txFrame->GetAckRequest() && aAckPacket != NULL) + if (aError == OT_ERROR_NONE && txFrame->GetAckRequest() && aAckFrame != NULL) { - Frame *ackFrame = static_cast(aAckPacket); + Frame *ackFrame = static_cast(aAckFrame); Neighbor *neighbor; framePending = ackFrame->GetFramePending(); @@ -1001,12 +1001,12 @@ void Mac::TransmitDoneTask(RadioPacket *aPacket, RadioPacket *aAckPacket, otErro if (addr.mShortAddress == kShortAddrBroadcast) { - // Broadcast packet + // Broadcast frame mCounters.mTxBroadcast++; } else { - // Unicast packet + // Unicast frame mCounters.mTxUnicast++; } @@ -1075,7 +1075,7 @@ void Mac::HandleMacTimer(void) mScanChannels >>= 1; mScanChannel++; - if (mScanChannels == 0 || mScanChannel > kPhyMaxChannel) + if (mScanChannels == 0 || mScanChannel > OT_RADIO_CHANNEL_MAX) { otPlatRadioReceive(GetInstance(), mChannel); otPlatRadioSetPanId(GetInstance(), mPanId); @@ -1102,12 +1102,12 @@ void Mac::HandleMacTimer(void) if (addr.mShortAddress == kShortAddrBroadcast) { - // Broadcast packet + // Broadcast frame mCounters.mTxBroadcast++; } else { - // Unicast Packet + // Unicast Frame mCounters.mTxUnicast++; } @@ -1335,7 +1335,7 @@ otError Mac::ProcessReceiveSecurity(Frame &aFrame, const Address &aSrcAddr, Neig } else if ((frameCounter + 1) == aNeighbor->GetLinkFrameCounter()) { - // drop duplicated packets + // drop duplicated frames ExitNow(error = OT_ERROR_DUPLICATED); } } @@ -1388,7 +1388,7 @@ exit: return error; } -extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, RadioPacket *aFrame, otError aError) +extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { otLogFuncEntryMsg("%!otError!", aError); @@ -1513,12 +1513,12 @@ void Mac::ReceiveDoneTask(Frame *aFrame, otError aError) // Increment counters if (dstaddr.mShortAddress == kShortAddrBroadcast) { - // Broadcast packet + // Broadcast frame mCounters.mRxBroadcast++; } else { - // Unicast packet + // Unicast frame mCounters.mRxUnicast++; } @@ -1736,15 +1736,15 @@ void Mac::SetPromiscuous(bool aPromiscuous) bool Mac::RadioSupportsCsmaBackoff(void) { /* Check either of the following conditions: - * 1) Radio provides the CSMA backoff capability (i.e., `kRadioCapsCsmaBackOff` bit is set) or; - * 2) It provides `kRadioCapsTransmitRetries` which indicates support for MAC retries along with CSMA backoff. + * 1) Radio provides the CSMA backoff capability (i.e., `OT_RADIO_CAPS_CSMA_BACKOFF` bit is set) or; + * 2) It provides `OT_RADIO_CAPS_TRANSMIT_RETRIES` which indicates support for MAC retries along with CSMA backoff. */ - return (otPlatRadioGetCaps(GetInstance()) & (kRadioCapsTransmitRetries | kRadioCapsCsmaBackOff)) != 0; + return (otPlatRadioGetCaps(GetInstance()) & (OT_RADIO_CAPS_TRANSMIT_RETRIES | OT_RADIO_CAPS_CSMA_BACKOFF)) != 0; } bool Mac::RadioSupportsRetries(void) { - return (otPlatRadioGetCaps(GetInstance()) & kRadioCapsTransmitRetries) != 0; + return (otPlatRadioGetCaps(GetInstance()) & OT_RADIO_CAPS_TRANSMIT_RETRIES) != 0; } void Mac::FillMacCountersTlv(NetworkDiagnostic::MacCountersTlv &aMacCounters) const diff --git a/src/core/mac/mac.hpp b/src/core/mac/mac.hpp index 2d16f123e..e5e1e8ab6 100644 --- a/src/core/mac/mac.hpp +++ b/src/core/mac/mac.hpp @@ -518,29 +518,29 @@ public: /** * This method is called to handle transmit events. * - * @param[in] aPacket A pointer to the packet that was transmitted. + * @param[in] aFrame A pointer to the frame that was transmitted. * @param[in] aFramePending TRUE if an ACK frame was received and the Frame Pending bit was set. * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was - * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission - * could not take place due to activity on the channel, OT_ERROR_ABORT when transmission - * was aborted for other reasons. + * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the + * transmission could not take place due to activity on the channel, OT_ERROR_ABORT when + * transmission was aborted for other reasons. * */ - void TransmitDoneTask(RadioPacket *aPacket, bool aRxPending, otError aError); + void TransmitDoneTask(otRadioFrame *aFrame, bool aRxPending, otError aError); #else // #if OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE /** * This method is called to handle transmit events. * - * @param[in] aPacket A pointer to the packet that was transmitted. - * @param[in] aAckPacket A pointer to the ACK packet, NULL if no ACK was received. - * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was - * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission - * could not take place due to activity on the channel, OT_ERROR_ABORT when transmission - * was aborted for other reasons. + * @param[in] aFrame A pointer to the frame that was transmitted. + * @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received. + * @param[in] aError OT_ERROR_NONE when the frame was transmitted, OT_ERROR_NO_ACK when the frame was + * transmitted but no ACK was received, OT_ERROR_CHANNEL_ACCESS_FAILURE when the + * transmission could not take place due to activity on the channel, OT_ERROR_ABORT when + * transmission was aborted for other reasons. * */ - void TransmitDoneTask(RadioPacket *aPacket, RadioPacket *aAckPacket, otError aError); + void TransmitDoneTask(otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError); #endif // OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE /** diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index f1e8894e1..8db7c9841 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -182,7 +182,7 @@ struct Address * */ OT_TOOL_PACKED_BEGIN -class Frame: public RadioPacket +class Frame: public otRadioFrame { public: enum diff --git a/src/core/meshcop/dataset_manager.cpp b/src/core/meshcop/dataset_manager.cpp index de80680f7..5aa0acc93 100644 --- a/src/core/meshcop/dataset_manager.cpp +++ b/src/core/meshcop/dataset_manager.cpp @@ -430,8 +430,8 @@ otError DatasetManager::Set(Coap::Header &aHeader, Message &aMessage, const Ip6: if (Tlv::GetTlv(aMessage, Tlv::kChannel, sizeof(channel), channel) == OT_ERROR_NONE) { VerifyOrExit(channel.IsValid() && - channel.GetChannel() >= kPhyMinChannel && - channel.GetChannel() <= kPhyMaxChannel, + channel.GetChannel() >= OT_RADIO_CHANNEL_MIN && + channel.GetChannel() <= OT_RADIO_CHANNEL_MAX, state = StateTlv::kReject); if (channel.GetChannel() != mNetif.GetMac().GetChannel()) diff --git a/src/core/meshcop/dataset_manager_ftd.cpp b/src/core/meshcop/dataset_manager_ftd.cpp index 7ebd4a70c..7d5fedf21 100644 --- a/src/core/meshcop/dataset_manager_ftd.cpp +++ b/src/core/meshcop/dataset_manager_ftd.cpp @@ -110,7 +110,7 @@ otError ActiveDataset::GenerateLocal(void) { ChannelMask0Tlv tlv; tlv.Init(); - tlv.SetMask(kPhySupportedChannelMask); + tlv.SetMask(OT_RADIO_SUPPORTED_CHANNELS); mLocal.Set(tlv); } diff --git a/src/core/thread/announce_begin_server.cpp b/src/core/thread/announce_begin_server.cpp index f24e683b6..903a6565c 100644 --- a/src/core/thread/announce_begin_server.cpp +++ b/src/core/thread/announce_begin_server.cpp @@ -84,12 +84,12 @@ otError AnnounceBeginServer::SendAnnounce(uint32_t aChannelMask, uint8_t aCount, mChannelMask = aChannelMask; mCount = aCount; mPeriod = aPeriod; - mChannel = kPhyMinChannel; + mChannel = OT_RADIO_CHANNEL_MIN; while ((mChannelMask & (1 << mChannel)) == 0) { mChannel++; - VerifyOrExit(mChannel <= kPhyMaxChannel, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit(mChannel <= OT_RADIO_CHANNEL_MAX, error = OT_ERROR_INVALID_ARGS); } mTimer.Start(mPeriod); @@ -154,9 +154,9 @@ void AnnounceBeginServer::HandleTimer(void) mChannel++; - if (mChannel > kPhyMaxChannel) + if (mChannel > OT_RADIO_CHANNEL_MAX) { - mChannel = kPhyMinChannel; + mChannel = OT_RADIO_CHANNEL_MIN; mCount--; } } diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index b161b83c8..ba09a3840 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -444,8 +444,8 @@ otError MeshForwarder::PrepareDiscoverRequest(void) VerifyOrExit(!mScanning); - mScanChannel = kPhyMinChannel; - mScanChannels >>= kPhyMinChannel; + mScanChannel = OT_RADIO_CHANNEL_MIN; + mScanChannels >>= OT_RADIO_CHANNEL_MIN; mRestoreChannel = mNetif.GetMac().GetChannel(); mRestorePanId = mNetif.GetMac().GetPanId(); @@ -454,7 +454,7 @@ otError MeshForwarder::PrepareDiscoverRequest(void) mScanChannels >>= 1; mScanChannel++; - if (mScanChannel > kPhyMaxChannel) + if (mScanChannel > OT_RADIO_CHANNEL_MAX) { mNetif.GetMle().HandleDiscoverComplete(); ExitNow(error = OT_ERROR_DROP); @@ -1645,7 +1645,7 @@ void MeshForwarder::HandleDiscoverTimer(void) mScanChannels >>= 1; mScanChannel++; - if (mScanChannel > kPhyMaxChannel) + if (mScanChannel > OT_RADIO_CHANNEL_MAX) { mSendQueue.Dequeue(*mSendMessage); mSendMessage->Free(); diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index eed7eba98..ac8595717 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -95,7 +95,7 @@ Mle::Mle(ThreadNetif &aThreadNetif) : mDiscoverContext(NULL), mIsDiscoverInProgress(false), mEnableEui64Filtering(false), - mAnnounceChannel(kPhyMinChannel), + mAnnounceChannel(OT_RADIO_CHANNEL_MIN), mPreviousChannel(0), mPreviousPanId(Mac::kPanIdBroadcast) { @@ -1866,9 +1866,9 @@ void Mle::SendOrphanAnnounce(void) { channel++; - if (channel > kPhyMaxChannel) + if (channel > OT_RADIO_CHANNEL_MAX) { - channel = kPhyMinChannel; + channel = OT_RADIO_CHANNEL_MIN; } VerifyOrExit(channel != mAnnounceChannel); @@ -1880,9 +1880,9 @@ void Mle::SendOrphanAnnounce(void) // Move to next channel mAnnounceChannel = channel + 1; - if (mAnnounceChannel > kPhyMaxChannel) + if (mAnnounceChannel > OT_RADIO_CHANNEL_MAX) { - mAnnounceChannel = kPhyMinChannel; + mAnnounceChannel = OT_RADIO_CHANNEL_MIN; } exit: diff --git a/src/core/utils/jam_detector.cpp b/src/core/utils/jam_detector.cpp index 1c5fa1030..4775db007 100644 --- a/src/core/utils/jam_detector.cpp +++ b/src/core/utils/jam_detector.cpp @@ -155,7 +155,7 @@ void JamDetector::HandleTimer(void) // If the RSSI is valid, check if it exceeds the threshold // and try to update the history bit map - if (rssi != kPhyInvalidRssi) + if (rssi != OT_RADIO_RSSI_INVALID) { didExceedThreshold = (rssi >= mRssiThreshold); UpdateHistory(didExceedThreshold); diff --git a/src/diag/diag_process.cpp b/src/diag/diag_process.cpp index fccf42a00..fb2ae1fd1 100644 --- a/src/diag/diag_process.cpp +++ b/src/diag/diag_process.cpp @@ -67,7 +67,7 @@ uint8_t Diag::sChannel; uint8_t Diag::sTxLen; uint32_t Diag::sTxPeriod; uint32_t Diag::sTxPackets; -RadioPacket * Diag::sTxPacket; +otRadioFrame * Diag::sTxPacket; bool Diag::sRepeatActive; otInstance *Diag::sContext; @@ -218,7 +218,7 @@ void Diag::ProcessChannel(int argc, char *argv[], char *aOutput, size_t aOutputM long value; SuccessOrExit(error = ParseLong(argv[0], value)); - VerifyOrExit(value >= kPhyMinChannel && value <= kPhyMaxChannel, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit(value >= OT_RADIO_CHANNEL_MIN && value <= OT_RADIO_CHANNEL_MAX, error = OT_ERROR_INVALID_ARGS); sChannel = static_cast(value); // listen on the set channel immediately @@ -267,7 +267,7 @@ void Diag::ProcessSend(int argc, char *argv[], char *aOutput, size_t aOutputMaxL sTxPackets = static_cast(value); SuccessOrExit(error = ParseLong(argv[1], value)); - VerifyOrExit(value <= kMaxPHYPacketSize, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit(value <= OT_RADIO_FRAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS); sTxLen = static_cast(value); snprintf(aOutput, aOutputMaxLen, "sending %#x packet(s), length %#x\r\nstatus 0x%02x\r\n", static_cast(sTxPackets), static_cast(sTxLen), error); @@ -300,7 +300,7 @@ void Diag::ProcessRepeat(int argc, char *argv[], char *aOutput, size_t aOutputMa sTxPeriod = static_cast(value); SuccessOrExit(error = ParseLong(argv[1], value)); - VerifyOrExit(value <= kMaxPHYPacketSize, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit(value <= OT_RADIO_FRAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS); sTxLen = static_cast(value); sRepeatActive = true; @@ -358,7 +358,7 @@ void Diag::DiagTransmitDone(otInstance *aInstance, bool aRxPending, otError aErr } } -void Diag::DiagReceiveDone(otInstance *aInstance, RadioPacket *aFrame, otError aError) +void Diag::DiagReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { (void)aInstance; if (aError == OT_ERROR_NONE) @@ -396,14 +396,14 @@ extern "C" void otPlatDiagAlarmFired(otInstance *aInstance) Diag::AlarmFired(aInstance); } -extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, RadioPacket *aPacket, bool aRxPending, otError aError) +extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aRxPending, otError aError) { - (void)aPacket; + (void)aFrame; Diag::DiagTransmitDone(aInstance, aRxPending, aError); } -extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, RadioPacket *aFrame, otError aError) +extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { Diag::DiagReceiveDone(aInstance, aFrame, aError); } diff --git a/src/diag/diag_process.hpp b/src/diag/diag_process.hpp index 181d30456..86adb50ab 100644 --- a/src/diag/diag_process.hpp +++ b/src/diag/diag_process.hpp @@ -69,7 +69,7 @@ public: static bool isEnabled(void); static void DiagTransmitDone(otInstance *aInstance, bool aRxPending, otError aError); - static void DiagReceiveDone(otInstance *aInstance, RadioPacket *aFrame, otError aError); + static void DiagReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); static void AlarmFired(otInstance *aInstance); private: @@ -93,7 +93,7 @@ private: static uint8_t sTxLen; static uint32_t sTxPeriod; static uint32_t sTxPackets; - static RadioPacket *sTxPacket; + static otRadioFrame *sTxPacket; static otInstance *sContext; static bool sRepeatActive; }; diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index f042fe5fb..6f5cde85a 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -568,8 +568,8 @@ NcpBase::NcpBase(otInstance *aInstance): mInstance(aInstance), mTxFrameBuffer(mTxBuffer, sizeof(mTxBuffer)), mLastStatus(SPINEL_STATUS_OK), - mSupportedChannelMask(kPhySupportedChannelMask), - mChannelMask(kPhySupportedChannelMask), + mSupportedChannelMask(OT_RADIO_SUPPORTED_CHANNELS), + mChannelMask(OT_RADIO_SUPPORTED_CHANNELS), mScanPeriod(200), // ms mDiscoveryScanJoinerFlag(false), mDiscoveryScanEnableFiltering(false), @@ -785,12 +785,12 @@ exit: // MARK: Raw frame handling // ---------------------------------------------------------------------------- -void NcpBase::HandleRawFrame(const RadioPacket *aFrame, void *aContext) +void NcpBase::HandleRawFrame(const otRadioFrame *aFrame, void *aContext) { static_cast(aContext)->HandleRawFrame(aFrame); } -void NcpBase::HandleRawFrame(const RadioPacket *aFrame) +void NcpBase::HandleRawFrame(const otRadioFrame *aFrame) { otError errorCode = OT_ERROR_NONE; uint16_t flags = 0; @@ -966,19 +966,19 @@ void NcpBase::HandleEnergyScanResult(otEnergyScanResult *aResult) #if OPENTHREAD_ENABLE_RAW_LINK_API -void NcpBase::LinkRawReceiveDone(otInstance *, RadioPacket *aPacket, otError aError) +void NcpBase::LinkRawReceiveDone(otInstance *, otRadioFrame *aFrame, otError aError) { - sNcpInstance->LinkRawReceiveDone(aPacket, aError); + sNcpInstance->LinkRawReceiveDone(aFrame, aError); } -void NcpBase::LinkRawReceiveDone(RadioPacket *aPacket, otError aError) +void NcpBase::LinkRawReceiveDone(otRadioFrame *aFrame, otError aError) { otError errorCode = OT_ERROR_NONE; uint16_t flags = 0; SuccessOrExit(errorCode = OutboundFrameBegin()); - if (aPacket->mDidTX) + if (aFrame->mDidTX) { flags |= SPINEL_MD_FLAG_TX; } @@ -990,13 +990,13 @@ void NcpBase::LinkRawReceiveDone(RadioPacket *aPacket, otError aError) SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_STREAM_RAW, - (aError == OT_ERROR_NONE) ? aPacket->mLength : 0 + (aError == OT_ERROR_NONE) ? aFrame->mLength : 0 )); if (aError == OT_ERROR_NONE) { // Append the frame contents - SuccessOrExit(errorCode = OutboundFrameFeedData(aPacket->mPsdu, aPacket->mLength)); + SuccessOrExit(errorCode = OutboundFrameFeedData(aFrame->mPsdu, aFrame->mLength)); } // Append metadata (rssi, etc) @@ -1012,12 +1012,12 @@ void NcpBase::LinkRawReceiveDone(RadioPacket *aPacket, otError aError) SPINEL_DATATYPE_STRUCT_S( // Vendor-data SPINEL_DATATYPE_UINT_PACKED_S ), - aPacket->mPower, // TX Power - -128, // Noise Floor (Currently unused) - flags, // Flags - aPacket->mChannel, // Receive channel - aPacket->mLqi, // Link quality indicator - aError // Receive error + aFrame->mPower, // TX Power + -128, // Noise Floor (Currently unused) + flags, // Flags + aFrame->mChannel, // Receive channel + aFrame->mLqi, // Link quality indicator + aError // Receive error )); SuccessOrExit(errorCode = OutboundFrameSend()); @@ -1026,12 +1026,12 @@ exit: return; } -void NcpBase::LinkRawTransmitDone(otInstance *, RadioPacket *aPacket, bool aFramePending, otError aError) +void NcpBase::LinkRawTransmitDone(otInstance *, otRadioFrame *aFrame, bool aFramePending, otError aError) { - sNcpInstance->LinkRawTransmitDone(aPacket, aFramePending, aError); + sNcpInstance->LinkRawTransmitDone(aFrame, aFramePending, aError); } -void NcpBase::LinkRawTransmitDone(RadioPacket *, bool aFramePending, otError aError) +void NcpBase::LinkRawTransmitDone(otRadioFrame *, bool aFramePending, otError aError) { if (mCurTransmitTID) { @@ -4598,7 +4598,7 @@ otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t uint8_t *frame_buffer(NULL); unsigned int frame_len(0); - RadioPacket *packet = otLinkRawGetTransmitBuffer(mInstance); + otRadioFrame *frame = otLinkRawGetTransmitBuffer(mInstance); parsedLength = spinel_datatype_unpack( value_ptr, @@ -4608,25 +4608,25 @@ otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t SPINEL_DATATYPE_INT8_S, &frame_buffer, &frame_len, - &packet->mChannel, - &packet->mPower + &frame->mChannel, + &frame->mPower ); - if (parsedLength > 0 && frame_len <= kMaxPHYPacketSize) + if (parsedLength > 0 && frame_len <= OT_RADIO_FRAME_MAX_SIZE) { // Cache the transaction ID for async response mCurTransmitTID = SPINEL_HEADER_GET_TID(header); - // Update packet buffer and length - packet->mLength = static_cast(frame_len); - memcpy(packet->mPsdu, frame_buffer, packet->mLength); + // Update frame buffer and length + frame->mLength = static_cast(frame_len); + memcpy(frame->mPsdu, frame_buffer, frame->mLength); // TODO: This should be later added in the STREAM_RAW argument to allow user to directly specify it. - packet->mMaxTxAttempts = OPENTHREAD_CONFIG_MAX_TX_ATTEMPTS_DIRECT; + frame->mMaxTxAttempts = OPENTHREAD_CONFIG_MAX_TX_ATTEMPTS_DIRECT; - // Pass packet to the radio layer. Note, this fails if we + // Pass frame to the radio layer. Note, this fails if we // haven't enabled raw stream or are already transmitting. - errorCode = otLinkRawTransmit(mInstance, packet, &NcpBase::LinkRawTransmitDone); + errorCode = otLinkRawTransmit(mInstance, frame, &NcpBase::LinkRawTransmitDone); } else { diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index d9331bcd2..a3f3cf6f0 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -178,9 +178,9 @@ private: /** * Trampoline for HandleRawFrame(). */ - static void HandleRawFrame(const RadioPacket *aFrame, void *aContext); + static void HandleRawFrame(const otRadioFrame *aFrame, void *aContext); - void HandleRawFrame(const RadioPacket *aFrame); + void HandleRawFrame(const otRadioFrame *aFrame); /** * Trampoline for HandleActiveScanResult(). @@ -222,17 +222,17 @@ private: /** * Trampoline for LinkRawReceiveDone(). */ - static void LinkRawReceiveDone(otInstance *aInstance, RadioPacket *aPacket, otError aError); + static void LinkRawReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); - void LinkRawReceiveDone(RadioPacket *aPacket, otError aError); + void LinkRawReceiveDone(otRadioFrame *aFrame, otError aError); /** * Trampoline for LinkRawTransmitDone(). */ - static void LinkRawTransmitDone(otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, + static void LinkRawTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, otError aError); - void LinkRawTransmitDone(RadioPacket *aPacket, bool aFramePending, otError aError); + void LinkRawTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); /** * Trampoline for LinkRawEnergyScanDone(). diff --git a/tests/unit/test_diag.cpp b/tests/unit/test_diag.cpp index ee8529de8..807f80d49 100644 --- a/tests/unit/test_diag.cpp +++ b/tests/unit/test_diag.cpp @@ -57,14 +57,14 @@ extern "C" void otPlatAlarmFired(otInstance *) { } -extern "C" void otPlatRadioTxDone(otInstance *, RadioPacket *aFrame, RadioPacket *aAckFrame, otError aError) +extern "C" void otPlatRadioTxDone(otInstance *, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError) { (void)aFrame; (void)aAckFrame; (void)aError; } -extern "C" void otPlatRadioReceiveDone(otInstance *, RadioPacket *aFrame, otError aError) +extern "C" void otPlatRadioReceiveDone(otInstance *, otRadioFrame *aFrame, otError aError) { (void)aFrame; (void)aError; diff --git a/tests/unit/test_fuzz.cpp b/tests/unit/test_fuzz.cpp index bcbc14ec8..a8027b7ef 100644 --- a/tests/unit/test_fuzz.cpp +++ b/tests/unit/test_fuzz.cpp @@ -34,7 +34,7 @@ bool g_fRadioEnabled = false; uint8_t g_RecvChannel = 0; uint8_t g_TransmitPsdu[128]; -RadioPacket g_TransmitRadioPacket; +otRadioFrame g_TransmitRadioFrame; bool g_fTransmit = false; bool testFuzzRadioIsEnabled(otInstance *) @@ -78,18 +78,18 @@ otError testFuzzRadioTransmit(otInstance *) return OT_ERROR_NONE; } -RadioPacket *testFuzztRadioGetTransmitBuffer(otInstance *) +otRadioFrame *testFuzztRadioGetTransmitBuffer(otInstance *) { - return &g_TransmitRadioPacket; + return &g_TransmitRadioFrame; } void TestFuzz(uint32_t aSeconds) { // Set the radio capabilities to disable any Mac related timer dependencies - g_testPlatRadioCaps = (otRadioCaps)(kRadioCapsAckTimeout | kRadioCapsTransmitRetries); + g_testPlatRadioCaps = (otRadioCaps)(OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_TRANSMIT_RETRIES); // Set the platform function pointers - g_TransmitRadioPacket.mPsdu = g_TransmitPsdu; + g_TransmitRadioFrame.mPsdu = g_TransmitPsdu; g_testPlatRadioIsEnabled = testFuzzRadioIsEnabled; g_testPlatRadioEnable = testFuzzRadioEnable; g_testPlatRadioDisable = testFuzzRadioDisable; @@ -151,7 +151,7 @@ void TestFuzz(uint32_t aSeconds) if (g_fTransmit) { g_fTransmit = false; - otPlatRadioTxDone(aInstance, &g_TransmitRadioPacket, NULL, OT_ERROR_NONE); + otPlatRadioTxDone(aInstance, &g_TransmitRadioFrame, NULL, OT_ERROR_NONE); #ifdef DBG_FUZZ Log("<== transmit"); #endif @@ -160,7 +160,7 @@ void TestFuzz(uint32_t aSeconds) if (g_RecvChannel != 0) { uint8_t fuzzRecvBuff[128]; - RadioPacket fuzzPacket; + otRadioFrame fuzzPacket; // Initialize the radio packet with a random length memset(&fuzzPacket, 0, sizeof(fuzzPacket)); diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 90b8c2837..37584ac3c 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -46,7 +46,7 @@ testPlatAlarmStop g_testPlatAlarmStop = NULL; testPlatAlarmStartAt g_testPlatAlarmStartAt = NULL; testPlatAlarmGetNow g_testPlatAlarmGetNow = NULL; -otRadioCaps g_testPlatRadioCaps = kRadioCapsNone; +otRadioCaps g_testPlatRadioCaps = OT_RADIO_CAPS_NONE; testPlatRadioSetPanId g_testPlatRadioSetPanId = NULL; testPlatRadioSetExtendedAddress g_testPlatRadioSetExtendedAddress = NULL; testPlatRadioIsEnabled g_testPlatRadioIsEnabled = NULL; @@ -65,7 +65,7 @@ void testPlatResetToDefaults(void) g_testPlatAlarmStartAt = NULL; g_testPlatAlarmGetNow = NULL; - g_testPlatRadioCaps = kRadioCapsNone; + g_testPlatRadioCaps = OT_RADIO_CAPS_NONE; g_testPlatRadioSetPanId = NULL; g_testPlatRadioSetExtendedAddress = NULL; g_testPlatRadioSetShortAddress = NULL; @@ -229,9 +229,9 @@ extern "C" { } } - otError otPlatRadioTransmit(otInstance *aInstance, RadioPacket *aPacket) + otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { - (void)aPacket; + (void)aFrame; if (g_testPlatRadioTransmit) { @@ -243,7 +243,7 @@ extern "C" { } } - RadioPacket *otPlatRadioGetTransmitBuffer(otInstance *aInstance) + otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) { if (g_testPlatRadioGetTransmitBuffer) { @@ -251,7 +251,7 @@ extern "C" { } else { - return (RadioPacket *)0; + return (otRadioFrame *)0; } } @@ -383,11 +383,11 @@ exit: { } - void otPlatDiagRadioTransmitDone(otInstance *, RadioPacket *, bool, otError) + void otPlatDiagRadioTransmitDone(otInstance *, otRadioFrame *, bool, otError) { } - void otPlatDiagRadioReceiveDone(otInstance *, RadioPacket *, otError) + void otPlatDiagRadioReceiveDone(otInstance *, otRadioFrame *, otError) { } diff --git a/tests/unit/test_platform.h b/tests/unit/test_platform.h index 2185be5c8..20ae9fd5a 100644 --- a/tests/unit/test_platform.h +++ b/tests/unit/test_platform.h @@ -75,7 +75,7 @@ typedef otError(*testPlatRadioEnable)(otInstance *); typedef otError(*testPlatRadioDisable)(otInstance *); typedef otError(*testPlatRadioReceive)(otInstance *, uint8_t); typedef otError(*testPlatRadioTransmit)(otInstance *); -typedef RadioPacket *(*testPlatRadioGetTransmitBuffer)(otInstance *); +typedef otRadioFrame *(*testPlatRadioGetTransmitBuffer)(otInstance *); extern otRadioCaps g_testPlatRadioCaps; extern testPlatRadioSetPanId g_testPlatRadioSetPanId;