nRF5 SDK for Thread v0.9.0
Functions
Operation

This module includes the platform abstraction for radio operations. More...

Functions

PhyState otPlatRadioGetState (otInstance *aInstance)
 
ThreadError otPlatRadioEnable (otInstance *aInstance)
 
ThreadError otPlatRadioDisable (otInstance *aInstance)
 
bool otPlatRadioIsEnabled (otInstance *aInstance)
 
ThreadError otPlatRadioSleep (otInstance *aInstance)
 
ThreadError otPlatRadioReceive (otInstance *aInstance, uint8_t aChannel)
 
void otPlatRadioEnableSrcMatch (otInstance *aInstance, bool aEnable)
 
ThreadError otPlatRadioAddSrcMatchShortEntry (otInstance *aInstance, const uint16_t aShortAddress)
 
ThreadError otPlatRadioAddSrcMatchExtEntry (otInstance *aInstance, const uint8_t *aExtAddress)
 
ThreadError otPlatRadioClearSrcMatchShortEntry (otInstance *aInstance, const uint16_t aShortAddress)
 
ThreadError otPlatRadioClearSrcMatchExtEntry (otInstance *aInstance, const uint8_t *aExtAddress)
 
void otPlatRadioClearSrcMatchShortEntries (otInstance *aInstance)
 
void otPlatRadioClearSrcMatchExtEntries (otInstance *aInstance)
 
void otPlatRadioReceiveDone (otInstance *aInstance, RadioPacket *aPacket, ThreadError aError)
 
RadioPacketotPlatRadioGetTransmitBuffer (otInstance *aInstance)
 
ThreadError otPlatRadioTransmit (otInstance *aInstance, RadioPacket *aPacket)
 
void otPlatRadioTransmitDone (otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, ThreadError aError)
 
int8_t otPlatRadioGetRssi (otInstance *aInstance)
 
otRadioCaps otPlatRadioGetCaps (otInstance *aInstance)
 
void otPlatRadioSetDefaultTxPower (otInstance *aInstance, int8_t aPower)
 
bool otPlatRadioGetPromiscuous (otInstance *aInstance)
 
void otPlatRadioSetPromiscuous (otInstance *aInstance, bool aEnable)
 
void otPlatDiagRadioTransmitDone (otInstance *aInstance, RadioPacket *aPacket, bool aFramePending, ThreadError aError)
 
void otPlatDiagRadioReceiveDone (otInstance *aInstance, RadioPacket *aPacket, ThreadError aError)
 
ThreadError otPlatRadioEnergyScan (otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
 
void otPlatRadioEnergyScanDone (otInstance *aInstance, int8_t aEnergyScanMaxRssi)
 

Detailed Description

This module includes the platform abstraction for radio operations.

Function Documentation

void otPlatDiagRadioReceiveDone ( otInstance *  aInstance,
RadioPacket aPacket,
ThreadError  aError 
)

The radio driver calls this method to notify OpenThread diagnostics module of a received packet.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPacketA pointer to the received packet or NULL if the receive operation failed.
[in]aError::kThreadError_None when successfully received a frame, ::kThreadError_Abort when reception was aborted and a frame was not received, ::kThreadError_NoBufs when a frame could not be received due to lack of rx buffer space.
void otPlatDiagRadioTransmitDone ( otInstance *  aInstance,
RadioPacket aPacket,
bool  aFramePending,
ThreadError  aError 
)

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

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPacketA pointer to the packet that was transmitted.
[in]aFramePendingTRUE if an ACK frame was received and the Frame Pending bit was set.
[in]aError::kThreadError_None when the frame was transmitted, ::kThreadError_NoAck when the frame was transmitted but no ACK was received, ::kThreadError_ChannelAccessFailure when the transmission could not take place due to activity on the channel, ::kThreadError_Abort when transmission was aborted for other reasons.
ThreadError otPlatRadioAddSrcMatchExtEntry ( otInstance *  aInstance,
const uint8_t *  aExtAddress 
)

Add an extended address to the source address match table.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aExtAddressThe extended address to be added.
Return values
::kThreadError_NoneSuccessfully added extended address to the source match table.
::kThreadError_NoBufsNo available entry in the source match table.
ThreadError otPlatRadioAddSrcMatchShortEntry ( otInstance *  aInstance,
const uint16_t  aShortAddress 
)

Add a short address to the source address match table.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aShortAddressThe short address to be added.
Return values
::kThreadError_NoneSuccessfully added short address to the source match table.
::kThreadError_NoBufsNo available entry in the source match table.
void otPlatRadioClearSrcMatchExtEntries ( otInstance *  aInstance)

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

Parameters
[in]aInstanceThe OpenThread instance structure.
ThreadError otPlatRadioClearSrcMatchExtEntry ( otInstance *  aInstance,
const uint8_t *  aExtAddress 
)

Remove an extended address from the source address match table.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aExtAddressThe extended address to be removed.
Return values
::kThreadError_NoneSuccessfully removed the extended address from the source match table.
::kThreadError_NoAddressThe extended address is not in source address match table.
void otPlatRadioClearSrcMatchShortEntries ( otInstance *  aInstance)

Clear all short addresses from the source address match table.

Parameters
[in]aInstanceThe OpenThread instance structure.
ThreadError otPlatRadioClearSrcMatchShortEntry ( otInstance *  aInstance,
const uint16_t  aShortAddress 
)

Remove a short address from the source address match table.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aShortAddressThe short address to be removed.
Return values
::kThreadError_NoneSuccessfully removed short address from the source match table.
::kThreadError_NoAddressThe short address is not in source address match table.
ThreadError otPlatRadioDisable ( otInstance *  aInstance)

Disable the radio.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
::kThreadError_NoneSuccessfully transitioned to Disabled.
ThreadError otPlatRadioEnable ( otInstance *  aInstance)

Enable the radio.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
::kThreadError_NoneSuccessfully enabled.
::kThreadError_FailureThe radio could not be enabled.
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.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aEnableEnable/disable source address match feature.
ThreadError otPlatRadioEnergyScan ( otInstance *  aInstance,
uint8_t  aScanChannel,
uint16_t  aScanDuration 
)

This method begins the energy scan sequence on the radio.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aScanChannelThe channel to perform the energy scan on.
[in]aScanDurationThe duration, in milliseconds, for the channel to be scanned.
Return values
::kThreadError_NoneSuccessfully started scanning the channel.
::kThreadError_NotImplementedThe radio doesn't support energy scanning.
void otPlatRadioEnergyScanDone ( otInstance *  aInstance,
int8_t  aEnergyScanMaxRssi 
)

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

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aEnergyScanMaxRssiThe maximum RSSI encountered on the scanned channel.
otRadioCaps otPlatRadioGetCaps ( otInstance *  aInstance)

Get the radio capabilities.

Parameters
[in]aInstanceThe OpenThread instance structure.
Returns
The radio capability bit vector. The stack enables or disables some functions based on this value.
bool otPlatRadioGetPromiscuous ( otInstance *  aInstance)

Get the status of promiscuous mode.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
truePromiscuous mode is enabled.
falsePromiscuous mode is disabled.
int8_t otPlatRadioGetRssi ( otInstance *  aInstance)

Get the most recent RSSI measurement.

Parameters
[in]aInstanceThe OpenThread instance structure.
Returns
The RSSI in dBm when it is valid. 127 when RSSI is invalid.
PhyState otPlatRadioGetState ( otInstance *  aInstance)

Get current state of the radio.

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

Note
This function may be not implemented. It does not affect OpenThread.
Parameters
[in]aInstanceThe OpenThread instance structure.
Returns
Current state of the radio.
RadioPacket* otPlatRadioGetTransmitBuffer ( otInstance *  aInstance)

The radio transitions from Transmit to Receive. This method returns a pointer to the transmit buffer.

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

Parameters
[in]aInstanceThe OpenThread instance structure.
Returns
A pointer to the transmit buffer.
bool otPlatRadioIsEnabled ( otInstance *  aInstance)

Check whether radio is enabled or not.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
::trueradio is enabled.
::falseradio is disabled.
ThreadError otPlatRadioReceive ( otInstance *  aInstance,
uint8_t  aChannel 
)

Transitioning the radio from Sleep to Receive. Turn on the radio.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aChannelThe channel to use for receiving.
Return values
::kThreadError_NoneSuccessfully transitioned to Receive.
::kThreadError_InvalidStateThe radio was disabled or transmitting.
void otPlatRadioReceiveDone ( otInstance *  aInstance,
RadioPacket aPacket,
ThreadError  aError 
)

The radio driver calls this method to notify OpenThread of a received packet.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPacketA pointer to the received packet or NULL if the receive operation failed.
[in]aError::kThreadError_None when successfully received a frame, ::kThreadError_Abort when reception was aborted and a frame was not received, ::kThreadError_NoBufs when a frame could not be received due to lack of rx buffer space.
void otPlatRadioSetDefaultTxPower ( otInstance *  aInstance,
int8_t  aPower 
)

Set the radio Tx power used for auto-generated frames.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPowerThe Tx power to use in dBm.
void otPlatRadioSetPromiscuous ( otInstance *  aInstance,
bool  aEnable 
)

Enable or disable promiscuous mode.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aEnableA value to enable or disable promiscuous mode.
ThreadError otPlatRadioSleep ( otInstance *  aInstance)

Transition the radio from Receive to Sleep. Turn off the radio.

Parameters
[in]aInstanceThe OpenThread instance structure.
Return values
::kThreadError_NoneSuccessfully transitioned to Sleep.
::kThreadError_BusyThe radio was transmitting
::kThreadError_InvalidStateThe radio was disabled
ThreadError otPlatRadioTransmit ( otInstance *  aInstance,
RadioPacket aPacket 
)

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.

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.
Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPacketA pointer to the packet that will be transmitted.
Return values
::kThreadError_NoneSuccessfully transitioned to Transmit.
::kThreadError_InvalidStateThe radio was not in the Receive state.
void otPlatRadioTransmitDone ( otInstance *  aInstance,
RadioPacket aPacket,
bool  aFramePending,
ThreadError  aError 
)

The radio driver calls this method to notify OpenThread that the transmission has completed.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aPacketA pointer to the packet that was transmitted.
[in]aFramePendingTRUE if an ACK frame was received and the Frame Pending bit was set.
[in]aError::kThreadError_None when the frame was transmitted, ::kThreadError_NoAck when the frame was transmitted but no ACK was received, ::kThreadError_ChannelAccessFailure when the transmission could not take place due to activity on the channel, ::kThreadError_Abort when transmission was aborted for other reasons.

Documentation feedback | Developer Zone | Subscribe | Updated