Radio Operation

This module includes the platform abstraction for radio operations.

Summary

Functions

otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
void
The radio driver calls this function to notify OpenThread diagnostics module of a received frame.
otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
void
The radio driver calls this function to notify OpenThread diagnostics module that the transmission has completed.
otPlatRadioAddCalibratedPower(otInstance *aInstance, uint8_t aChannel, int16_t aActualPower, const uint8_t *aRawPowerSetting, uint16_t aRawPowerSettingLength)
Add a calibrated power of the specified channel to the power calibration table.
otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
Add an extended address to the source address match table.
otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress)
Add a short address to the source address match table.
otPlatRadioBusLatencyChanged(otInstance *aInstance)
void
The radio driver calls this function to notify OpenThread that the spinel bus latency has been changed.
otPlatRadioClearCalibratedPowers(otInstance *aInstance)
Clear all calibrated powers from the power calibration table.
otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
void
Clear all the extended/long addresses from source address match table.
otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
Remove an extended address from the source address match table.
otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
void
Clear all short addresses from the source address match table.
otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress)
Remove a short address from the source address match table.
otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics aLinkMetrics, otShortAddress aShortAddress, const otExtAddress *aExtAddress)
Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator.
otPlatRadioDisable(otInstance *aInstance)
Disable the radio.
otPlatRadioEnable(otInstance *aInstance)
Enable the radio.
otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShortAddress aShortAddr, const otExtAddress *aExtAddr)
Enable or disable CSL receiver.
otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
void
Enable/Disable source address match feature.
otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
Begin the energy scan sequence on the radio.
otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
void
The radio driver calls this function to notify OpenThread that the energy scan is complete.
otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics)
Get the radio coexistence metrics.
otPlatRadioGetCslAccuracy(otInstance *aInstance)
uint8_t
Get the current estimated worst case accuracy (maximum ± deviation from the nominal frequency) of the local radio clock in units of PPM.
otPlatRadioGetCslUncertainty(otInstance *aInstance)
uint8_t
The fixed uncertainty (i.e.
otPlatRadioGetPreferredChannelMask(otInstance *aInstance)
uint32_t
Gets the radio preferred channel mask that the device prefers to form on.
otPlatRadioGetRawPowerSetting(otInstance *aInstance, uint8_t aChannel, uint8_t *aRawPowerSetting, uint16_t *aRawPowerSettingLength)
Get the raw power setting for the given channel.
otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
Get the region code.
otPlatRadioGetRssi(otInstance *aInstance)
int8_t
Return a recent RSSI measurement when the radio is in receive state.
otPlatRadioGetState(otInstance *aInstance)
Get current state of the radio.
otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
uint32_t
Get the radio supported channel mask that the device is allowed to be on.
otPlatRadioGetTransmitBuffer(otInstance *aInstance)
Get the radio transmit frame buffer.
otPlatRadioIsCoexEnabled(otInstance *aInstance)
bool
Check whether radio coex is enabled or not.
otPlatRadioIsEnabled(otInstance *aInstance)
bool
Check whether radio is enabled or not.
otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
Transition the radio from Sleep to Receive (turn on the radio).
otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, otRadioTime32 aStart, uint32_t aDuration)
Schedules a radio reception window at a specific time and duration.
otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
void
The radio driver calls this function to notify OpenThread of a received frame.
otPlatRadioResetCsl(otInstance *aInstance)
Reset CSL receiver in the platform.
otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower)
Set the max transmit power for a specific channel.
otPlatRadioSetChannelTargetPower(otInstance *aInstance, uint8_t aChannel, int16_t aTargetPower)
Set the target power for the given channel.
otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled)
Enable the radio coex.
otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode)
Set the region code.
otPlatRadioSleep(otInstance *aInstance)
Transition the radio to the Sleep state (turn off the radio).
otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
Begin the transmit sequence on the radio.
otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
void
The radio driver calls this function to notify OpenThread that the transmit operation has completed, providing both the transmitted frame and, if applicable, the received ack frame.
otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame)
void
The radio driver calls this function to notify OpenThread that the transmission has started.
otPlatRadioUpdateCslSampleTime(otInstance *aInstance, otRadioTime32 aCslSampleTime)
void
Update CSL sample time in radio driver.

Functions

otPlatDiagRadioReceiveDone

void otPlatDiagRadioReceiveDone(
  otInstance *aInstance,
  otRadioFrame *aFrame,
  otError aError
)

The radio driver calls this function to notify OpenThread diagnostics module of a received frame.

Is used when diagnostics is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aFrame
A pointer to the received frame or NULL if the receive operation failed.
[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.

otPlatDiagRadioTransmitDone

void otPlatDiagRadioTransmitDone(
  otInstance *aInstance,
  otRadioFrame *aFrame,
  otError aError
)

The radio driver calls this function to notify OpenThread diagnostics module that the transmission has completed.

Is used when diagnostics is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aFrame
A pointer to the frame that was transmitted.
[in] aError
OT_ERROR_NONE when the frame was transmitted, OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel, OT_ERROR_ABORT when transmission was aborted for other reasons.

otPlatRadioAddCalibratedPower

otError otPlatRadioAddCalibratedPower(
  otInstance *aInstance,
  uint8_t aChannel,
  int16_t aActualPower,
  const uint8_t *aRawPowerSetting,
  uint16_t aRawPowerSettingLength
)

Add a calibrated power of the specified channel to the power calibration table.

The aActualPower is the actual measured output power when the parameters of the radio hardware modules are set to the aRawPowerSetting.

The raw power setting is an opaque byte array. OpenThread doesn't define the format of the raw power setting. Its format is radio hardware related and it should be defined by the developers in the platform radio driver. For example, if the radio hardware contains both the radio chip and the FEM chip, the raw power setting can be a combination of the radio power register and the FEM gain value.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The radio channel.
[in] aActualPower
The actual power in 0.01dBm.
[in] aRawPowerSetting
A pointer to the raw power setting byte array.
[in] aRawPowerSettingLength
The length of the aRawPowerSetting.
Return Values
OT_ERROR_NONE
Successfully added the calibrated power to the power calibration table.
OT_ERROR_NO_BUFS
No available entry in the power calibration table.
OT_ERROR_INVALID_ARGS
The aChannel, aActualPower or aRawPowerSetting is invalid or the aActualPower already exists in the power calibration table.
OT_ERROR_NOT_IMPLEMENTED
This feature is not implemented.

otPlatRadioAddSrcMatchExtEntry

otError otPlatRadioAddSrcMatchExtEntry(
  otInstance *aInstance,
  const otExtAddress *aExtAddress
)

Add an extended address to the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aExtAddress
The extended address to be added stored in little-endian byte order.
Return Values
OT_ERROR_NONE
Successfully added extended address to the source match table.
OT_ERROR_NO_BUFS
No available entry in the source match table.

otPlatRadioAddSrcMatchShortEntry

otError otPlatRadioAddSrcMatchShortEntry(
  otInstance *aInstance,
  otShortAddress aShortAddress
)

Add a short address to the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aShortAddress
The short address to be added.
Return Values
OT_ERROR_NONE
Successfully added short address to the source match table.
OT_ERROR_NO_BUFS
No available entry in the source match table.

otPlatRadioBusLatencyChanged

void otPlatRadioBusLatencyChanged(
  otInstance *aInstance
)

The radio driver calls this function to notify OpenThread that the spinel bus latency has been changed.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatRadioClearCalibratedPowers

otError otPlatRadioClearCalibratedPowers(
  otInstance *aInstance
)

Clear all calibrated powers from the power calibration table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully cleared all calibrated powers from the power calibration table.
OT_ERROR_NOT_IMPLEMENTED
This feature is not implemented.

otPlatRadioClearSrcMatchExtEntries

void otPlatRadioClearSrcMatchExtEntries(
  otInstance *aInstance
)

Clear all the extended/long addresses from source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatRadioClearSrcMatchExtEntry

otError otPlatRadioClearSrcMatchExtEntry(
  otInstance *aInstance,
  const otExtAddress *aExtAddress
)

Remove an extended address from the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aExtAddress
The extended address to be removed stored in little-endian byte order.
Return Values
OT_ERROR_NONE
Successfully removed the extended address from the source match table.
OT_ERROR_NO_ADDRESS
The extended address is not in source address match table.

otPlatRadioClearSrcMatchShortEntries

void otPlatRadioClearSrcMatchShortEntries(
  otInstance *aInstance
)

Clear all short addresses from the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.

otPlatRadioClearSrcMatchShortEntry

otError otPlatRadioClearSrcMatchShortEntry(
  otInstance *aInstance,
  otShortAddress aShortAddress
)

Remove a short address from the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aShortAddress
The short address to be removed.
Return Values
OT_ERROR_NONE
Successfully removed short address from the source match table.
OT_ERROR_NO_ADDRESS
The short address is not in source address match table.

otPlatRadioConfigureEnhAckProbing

otError otPlatRadioConfigureEnhAckProbing(
  otInstance *aInstance,
  otLinkMetrics aLinkMetrics,
  otShortAddress aShortAddress,
  const otExtAddress *aExtAddress
)

Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator.

After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that node should include Vendor-Specific IE containing Link Metrics data. This function informs the radio to start/stop to collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that Probing Initiator.

Regarding aExtAddress, this function assumes big-endian byte order. Note that this differs from otPlatRadioSetExtendedAddress(), otPlatRadioAddSrcMatchExtEntry(), and otPlatRadioClearSrcMatchExtEntry(), which use little-endian byte order for the Extended MAC address.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aLinkMetrics
This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics can be specified. The probing would be disabled if aLinkMetrics is bitwise 0.
[in] aShortAddress
The short address of the Probing Initiator.
[in] aExtAddress
The extended source address of the Probing Initiator. aExtAddress MUST NOT be NULL. The aExtAddress assumes big-endian byte order.
Return Values
OT_ERROR_NONE
Successfully configured the Enhanced-ACK Based Probing.
OT_ERROR_INVALID_ARGS
aExtAddress is NULL.
OT_ERROR_NOT_FOUND
The Initiator indicated by aShortAddress is not found when trying to clear.
OT_ERROR_NO_BUFS
No more Initiator can be supported.
OT_ERROR_NOT_IMPLEMENTED
The feature is not implemented.

otPlatRadioDisable

otError otPlatRadioDisable(
  otInstance *aInstance
)

Disable the radio.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully transitioned to Disabled.
OT_ERROR_INVALID_STATE
The radio was not in sleep state.

otPlatRadioEnable

otError otPlatRadioEnable(
  otInstance *aInstance
)

Enable the radio.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully enabled.
OT_ERROR_FAILED
The radio could not be enabled.

otPlatRadioEnableCsl

otError otPlatRadioEnableCsl(
  otInstance *aInstance,
  uint32_t aCslPeriod,
  otShortAddress aShortAddr,
  const otExtAddress *aExtAddr
)

Enable or disable CSL receiver.

Regarding aExtAddr, this function assumes big-endian byte order. Note that this differs from otPlatRadioSetExtendedAddress(), otPlatRadioAddSrcMatchExtEntry(), and otPlatRadioClearSrcMatchExtEntry(), which use little-endian byte order for the Extended MAC address.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aCslPeriod
CSL period, 0 for disabling CSL. CSL period is in unit of 10 symbols.
[in] aShortAddr
The short source address of CSL receiver's peer.
[in] aExtAddr
The extended source address of CSL receiver's peer. The aExtAddr assumes big-endian byte order.
Return Values
OT_ERROR_NOT_IMPLEMENTED
Radio driver doesn't support CSL.
OT_ERROR_FAILED
Other platform specific errors.
OT_ERROR_NONE
Successfully enabled or disabled CSL.

otPlatRadioEnableSrcMatch

void otPlatRadioEnableSrcMatch(
  otInstance *aInstance,
  bool aEnable
)

Enable/Disable source address match feature.

The source address match feature controls how the radio layer decides the "frame pending" bit for acks sent in response to data request commands from children.

If disabled, the radio layer must set the "frame pending" on all acks to data request commands.

If enabled, the radio layer uses the source address match table to determine whether to set or clear the "frame pending" bit in an ack to a data request command.

The source address match table provides the list of children for which there is a pending frame. Either a short address or an extended/long address can be added to the source address match table.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aEnable
Enable/disable source address match feature.

otPlatRadioEnergyScan

otError otPlatRadioEnergyScan(
  otInstance *aInstance,
  uint8_t aScanChannel,
  uint16_t aScanDuration
)

Begin the energy scan sequence on the radio.

Is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aScanChannel
The channel to perform the energy scan on.
[in] aScanDuration
The duration, in milliseconds, for the channel to be scanned.
Return Values
OT_ERROR_NONE
Successfully started scanning the channel.
OT_ERROR_BUSY
The radio is performing energy scanning.
OT_ERROR_NOT_IMPLEMENTED
The radio doesn't support energy scanning.

otPlatRadioEnergyScanDone

void otPlatRadioEnergyScanDone(
  otInstance *aInstance,
  int8_t aEnergyScanMaxRssi
)

The radio driver calls this function to notify OpenThread that the energy scan is complete.

Is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aEnergyScanMaxRssi
The maximum RSSI encountered on the scanned channel.

otPlatRadioGetCoexMetrics

otError otPlatRadioGetCoexMetrics(
  otInstance *aInstance,
  otRadioCoexMetrics *aCoexMetrics
)

Get the radio coexistence metrics.

Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[out] aCoexMetrics
A pointer to the coexistence metrics structure.
Return Values
OT_ERROR_NONE
Successfully retrieved the coex metrics.
OT_ERROR_INVALID_ARGS
aCoexMetrics was NULL.

otPlatRadioGetCslAccuracy

uint8_t otPlatRadioGetCslAccuracy(
  otInstance *aInstance
)

Get the current estimated worst case accuracy (maximum ± deviation from the nominal frequency) of the local radio clock in units of PPM.

This is the clock used to schedule CSL operations.

In case the implementation does not estimate the current value but returns a fixed value, this value MUST be the worst-case accuracy over all possible foreseen operating conditions (temperature, pressure, etc) of the implementation.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The current CSL rx/tx scheduling drift, in PPM.

otPlatRadioGetCslUncertainty

uint8_t otPlatRadioGetCslUncertainty(
  otInstance *aInstance
)

The fixed uncertainty (i.e.

random jitter) of the arrival time of CSL transmissions received by this device in units of 10 microseconds.

This designates the worst case constant positive or negative deviation of the actual arrival time of a transmission from the transmission time calculated relative to the local radio clock independent of elapsed time. In addition to uncertainty accumulated over elapsed time, the CSL channel sample ("RX window") must be extended by twice this deviation such that an actual transmission is guaranteed to be detected by the local receiver in the presence of random arrival time jitter.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The CSL Uncertainty in units of 10 us.

otPlatRadioGetPreferredChannelMask

uint32_t otPlatRadioGetPreferredChannelMask(
  otInstance *aInstance
)

Gets the radio preferred channel mask that the device prefers to form on.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
The radio preferred channel mask.

otPlatRadioGetRawPowerSetting

otError otPlatRadioGetRawPowerSetting(
  otInstance *aInstance,
  uint8_t aChannel,
  uint8_t *aRawPowerSetting,
  uint16_t *aRawPowerSettingLength
)

Get the raw power setting for the given channel.

Platform radio layer should parse the raw power setting based on the radio layer defined format and set the parameters of each radio hardware module.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The radio channel.
[out] aRawPowerSetting
A pointer to the raw power setting byte array.
[in,out] aRawPowerSettingLength
On input, a pointer to the size of aRawPowerSetting. On output, a pointer to the length of the raw power setting data.
Return Values
OT_ERROR_NONE
Successfully got the target power.
OT_ERROR_INVALID_ARGS
The aChannel is invalid, aRawPowerSetting or aRawPowerSettingLength is NULL or is too short.
OT_ERROR_NOT_FOUND
The raw power setting for the aChannel was not found.

otPlatRadioGetRegion

otError otPlatRadioGetRegion(
  otInstance *aInstance,
  uint16_t *aRegionCode
)

Get the region code.

The radio region format is the 2-bytes ascii representation of the ISO 3166 alpha-2 code.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[out] aRegionCode
The radio region.
Return Values
OT_ERROR_INVALID_ARGS
aRegionCode is NULL.
OT_ERROR_FAILED
Other platform specific errors.
OT_ERROR_NONE
Successfully got region code.
OT_ERROR_NOT_IMPLEMENTED
The feature is not implemented.

otPlatRadioGetRssi

int8_t otPlatRadioGetRssi(
  otInstance *aInstance
)

Return a recent RSSI measurement when the radio is in receive state.

If the radio is not in receive state, then OT_RADIO_RSSI_INVALID MUST be returned. If the radio is in receive state, then a single RSSI measurement is taken on the current receive channel and returned.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
The RSSI in dBm when it is valid. OT_RADIO_RSSI_INVALID when RSSI is invalid.

otPlatRadioGetState

otRadioState otPlatRadioGetState(
  otInstance *aInstance
)

Get current state of the radio.

Is not required by OpenThread. It may be used for debugging and/or application-specific purposes.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
Current state of the radio.

otPlatRadioGetSupportedChannelMask

uint32_t otPlatRadioGetSupportedChannelMask(
  otInstance *aInstance
)

Get the radio supported channel mask that the device is allowed to be on.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
The radio supported channel mask.

otPlatRadioGetTransmitBuffer

otRadioFrame * otPlatRadioGetTransmitBuffer(
  otInstance *aInstance
)

Get the radio transmit frame buffer.

OpenThread forms the IEEE 802.15.4 frame in this buffer then calls otPlatRadioTransmit() to request transmission.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
A pointer to the transmit frame buffer.

otPlatRadioIsCoexEnabled

bool otPlatRadioIsCoexEnabled(
  otInstance *aInstance
)

Check whether radio coex is enabled or not.

Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
TRUE if the radio coex is enabled, FALSE otherwise.

otPlatRadioIsEnabled

bool otPlatRadioIsEnabled(
  otInstance *aInstance
)

Check whether radio is enabled or not.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Returns
TRUE if the radio is enabled, FALSE otherwise.

otPlatRadioReceive

otError otPlatRadioReceive(
  otInstance *aInstance,
  uint8_t aChannel
)

Transition the radio from Sleep to Receive (turn on the radio).

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The channel to use for receiving.
Return Values
OT_ERROR_NONE
Successfully transitioned to Receive.
OT_ERROR_INVALID_STATE
The radio was disabled or transmitting.

otPlatRadioReceiveAt

otError otPlatRadioReceiveAt(
  otInstance *aInstance,
  uint8_t aChannel,
  otRadioTime32 aStart,
  uint32_t aDuration
)

Schedules a radio reception window at a specific time and duration.

This function is an optional platform API used to schedule a future reception window on a specific channel for features such as Coordinated Sampled Listening (CSL) or Thread Direct.

OpenThread supports two approaches for timed reception:

Because OpenThread's built-in SubMac software implementation is comprehensive, robust, and fully tested, it is strongly recommended that radio platform implementers rely on the default software-driven mode and do NOT implement otPlatRadioReceiveAt(), unless there is a clear justification for offloading timed reception to the radio platform.

If the radio platform implements this function, the following rules and behaviors are expected:

If this function is called while the radio is disabled (OT_RADIO_STATE_DISABLED), the radio platform MUST return OT_ERROR_INVALID_STATE.

When the radio is enabled, this function can be called from any radio state (OT_RADIO_STATE_SLEEP, OT_RADIO_STATE_RECEIVE, or OT_RADIO_STATE_TRANSMIT). The radio platform driver MUST handle the scheduling internally: calling this function merely registers a (future) time window for the radio to sample/receive and MUST NOT immediately force the radio into Receive mode at the time of the call (unless the window is already active).

The radio platform MUST execute the scheduled reception as follows:

  • Operational Precedence and Radio Sleep:
    • Timed reception scheduled by this function is only applicable when the radio is in the Sleep state (whether the radio is put to sleep explicitly via otPlatRadioSleep() or manages sleep state automatically on its own).
    • Any active radio operation, such as transmission (otPlatRadioTransmit()) or continuous reception (otPlatRadioReceive()), takes precedence over timed reception.
  • Starting the Reception Window:
    • At the scheduled start time aStart, the radio receiver MUST enter Receive mode on channel aChannel, provided the radio is not busy with another operation. This MUST behave the same as if otPlatRadioReceive() were called at that time.
    • The OpenThread stack already accounts for and includes any necessary radio ramp-up and receiver settling time when computing aStart. Therefore, the radio platform driver does not need to adjust aStart or schedule ramp-up ahead of time.
  • Ending the Reception Window:
    • At the end of the duration (aStart + aDuration), the radio MUST automatically transition back to Sleep unless it is actively receiving a frame.
    • If frame reception has started (e.g., SHR detected) before the duration expires, the radio receiver MUST remain on until the frame reception completes (either successfully or with an error) and any subsequent acknowledgment transmission is finished, after which the radio transitions to Sleep.
  • Subsequent Schedules and Overlapping Windows:
    • If the start time of a previously scheduled reception window has not yet arrived, a subsequent call to otPlatRadioReceiveAt() MUST cancel and replace the previous schedule.
    • If a previous reception window has already started and is currently active:
      • A subsequent call to otPlatRadioReceiveAt() with a future start time MUST NOT abort or interrupt the ongoing reception. The new window is scheduled to start at its specified time.
      • At the start time of the new window (or immediately if its start time has already arrived), the radio MUST honor the new window:
        • Channel: If the new window specifies the same channel, reception SHOULD continue seamlessly without toggling the receiver state off and on. If the new window specifies a different channel, the radio MUST switch to the new channel. However, if the radio has started receiving a frame on the previous channel (e.g., SHR detected) or is transmitting an acknowledgment, it MUST complete the frame reception and any acknowledgment transmission before switching to the new channel (or transitioning to Sleep if the new window has already expired).
        • End time: The reception window MUST end according to the new window (aStart + aDuration). The new window always dictates when reception ends, replacing any previous end time. Note that this behavior is common and often used to shrink an ongoing sample window.
    • If a new window starts immediately upon the end of the previous window (back-to-back), the transition SHOULD occur seamlessly without cycling the radio through Sleep.
  • Interactions with Sleep and Other Operations:
    • If the radio is busy executing another operation (such as transmission or continuous reception) when the scheduled window starts or while it is active, that operation takes precedence. Once that operation completes and the radio returns to Sleep, if the scheduled window is still ongoing (before aStart + aDuration), the radio SHOULD start or resume the scheduled timed reception by entering Receive mode on aChannel for the remaining duration of the window.
    • Calls to otPlatRadioSleep() MUST NOT cancel a scheduled reception window, nor abort an ongoing active timed reception window. If the radio is already in the Sleep state and performing an active scheduled timed reception, subsequent calls to otPlatRadioSleep() MUST NOT interrupt or alter its operation.
    • Calls to otPlatRadioDisable() MUST immediately abort and cancel any pending (scheduled) or ongoing active timed reception window.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The radio channel on which to receive.
[in] aStart
The receive window start time relative to the local radio clock (see otPlatRadioGetNow()), representing the lower 32 bits of the radio clock.
[in] aDuration
The receive window duration in microseconds.
Return Values
OT_ERROR_NONE
Successfully scheduled receive window.
OT_ERROR_FAILED
The receive window could not be scheduled.
OT_ERROR_INVALID_STATE
The radio is disabled.
OT_ERROR_INVALID_ARGS
Invalid arguments provided (e.g., invalid channel).

otPlatRadioReceiveDone

void otPlatRadioReceiveDone(
  otInstance *aInstance,
  otRadioFrame *aFrame,
  otError aError
)

The radio driver calls this function to notify OpenThread of a received frame.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aFrame
A pointer to the received frame or NULL if the receive operation failed.
[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.

otPlatRadioResetCsl

otError otPlatRadioResetCsl(
  otInstance *aInstance
)

Reset CSL receiver in the platform.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NOT_IMPLEMENTED
Radio driver doesn't support CSL.
OT_ERROR_FAILED
Other platform specific errors.
OT_ERROR_NONE
Successfully disabled CSL.

otPlatRadioSetChannelMaxTransmitPower

otError otPlatRadioSetChannelMaxTransmitPower(
  otInstance *aInstance,
  uint8_t aChannel,
  int8_t aMaxPower
)

Set the max transmit power for a specific channel.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The radio channel.
[in] aMaxPower
The max power in dBm, passing OT_RADIO_RSSI_INVALID will disable this channel.
Return Values
OT_ERROR_NOT_IMPLEMENTED
The feature is not implemented
OT_ERROR_INVALID_ARGS
The specified channel is not valid.
OT_ERROR_FAILED
Other platform specific errors.
OT_ERROR_NONE
Successfully set max transmit power.

otPlatRadioSetChannelTargetPower

otError otPlatRadioSetChannelTargetPower(
  otInstance *aInstance,
  uint8_t aChannel,
  int16_t aTargetPower
)

Set the target power for the given channel.

The radio driver should set the actual output power to be less than or equal to the aTargetPower and as close as possible to the aTargetPower. If the aTargetPower is lower than the minimum output power supported by the platform, the output power should be set to the minimum output power supported by the platform. If the aTargetPower is higher than the maximum output power supported by the platform, the output power should be set to the maximum output power supported by the platform. If the aTargetPower is set to INT16_MAX, the corresponding channel is disabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aChannel
The radio channel.
[in] aTargetPower
The target power in 0.01dBm.
Return Values
OT_ERROR_NONE
Successfully set the target power.
OT_ERROR_INVALID_ARGS
The aChannel is invalid.
OT_ERROR_NOT_IMPLEMENTED
The feature is not implemented.

otPlatRadioSetCoexEnabled

otError otPlatRadioSetCoexEnabled(
  otInstance *aInstance,
  bool aEnabled
)

Enable the radio coex.

Is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aEnabled
TRUE to enable the radio coex, FALSE otherwise.
Return Values
OT_ERROR_NONE
Successfully enabled.
OT_ERROR_FAILED
The radio coex could not be enabled.

otPlatRadioSetRegion

otError otPlatRadioSetRegion(
  otInstance *aInstance,
  uint16_t aRegionCode
)

Set the region code.

The radio region format is the 2-bytes ascii representation of the ISO 3166 alpha-2 code.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aRegionCode
The radio region code. The aRegionCode >> 8 is first ascii char and the aRegionCode & 0xff is the second ascii char.
Return Values
OT_ERROR_FAILED
Other platform specific errors.
OT_ERROR_NONE
Successfully set region code.
OT_ERROR_NOT_IMPLEMENTED
The feature is not implemented.

otPlatRadioSleep

otError otPlatRadioSleep(
  otInstance *aInstance
)

Transition the radio to the Sleep state (turn off the radio).

If the radio is already in the Sleep state, this function MUST return OT_ERROR_NONE with no effect.

If otPlatRadioSleep() is called while the radio is in the middle of receiving a frame or transmitting an ACK (e.g., during AIFS/turnaround wait or actively transmitting the ACK frame), the radio MUST complete the ongoing operation (finish frame reception and/or ACK transmission) and transition to Sleep immediately thereafter. In this scenario:

  • The radio MUST return OT_ERROR_NONE to indicate that the sleep request has been accepted and scheduled.
  • Upon finishing the frame reception (and any associated ACK transmission), the radio driver MUST invoke otPlatRadioReceiveDone() to deliver the received frame (or report reception error) before transitioning to Sleep.

If any subsequent radio state transition function (e.g., otPlatRadioReceive() or otPlatRadioTransmit()) is called while a scheduled transition to Sleep is pending, the pending Sleep transition MUST be canceled/superseded, and the radio MUST transition to the newly requested state upon completing the ongoing reception and/or ACK transmission.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
Return Values
OT_ERROR_NONE
Successfully transitioned to Sleep, radio is already in Sleep, or transition is accepted and scheduled.
OT_ERROR_BUSY
The radio was transmitting a frame (initiated by otPlatRadioTransmit()).
OT_ERROR_INVALID_STATE
The radio was disabled.

otPlatRadioTransmit

otError otPlatRadioTransmit(
  otInstance *aInstance,
  otRadioFrame *aFrame
)

Begin 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 otRadioFrame structure.

The transmit sequence consists of:

  1. Transitioning the radio to Transmit from one of the following states:
    • Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported
    • Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported.
  2. Transmits the psdu on the given channel and at the given transmit power.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aFrame
A pointer to the frame to be transmitted.
Return Values
OT_ERROR_NONE
Successfully transitioned to Transmit.
OT_ERROR_INVALID_STATE
The radio was not in the Receive state.

otPlatRadioTxDone

void otPlatRadioTxDone(
  otInstance *aInstance,
  otRadioFrame *aFrame,
  otRadioFrame *aAckFrame,
  otError aError
)

The radio driver calls this function to notify OpenThread that the transmit operation has completed, providing both the transmitted frame and, if applicable, the received ack frame.

When radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability, radio platform layer updates aFrame with the security frame counter and key index values maintained by the radio.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aFrame
A pointer to the frame that was transmitted.
[in] aAckFrame
A pointer to the ACK frame, NULL if no ACK was received.
[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 tx could not take place due to activity on the channel, OT_ERROR_ABORT when transmission was aborted for other reasons.

otPlatRadioTxStarted

void otPlatRadioTxStarted(
  otInstance *aInstance,
  otRadioFrame *aFrame
)

The radio driver calls this function to notify OpenThread that the transmission has started.

Details
Parameters
[in] aInstance
A pointer to the OpenThread instance structure.
[in] aFrame
A pointer to the frame that is being transmitted.

otPlatRadioUpdateCslSampleTime

void otPlatRadioUpdateCslSampleTime(
  otInstance *aInstance,
  otRadioTime32 aCslSampleTime
)

Update CSL sample time in radio driver.

Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE. The CSL sample (window) of the CSL receiver extends before and after the sample time. The CSL sample time marks a timestamp in the CSL sample window when a frame should be received in "ideal conditions" if there would be no inaccuracy/clock-drift.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aCslSampleTime
The next sample time, in microseconds. It is the time when the first symbol of the MHR of the frame is expected.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.