mirror of
https://github.com/espressif/openthread.git
synced 2026-08-30 13:59:54 +00:00
[radio] update "radio.h" documentations (#3230)
This commit updates the `radio.h` header file: - Re-orders the definitions so keep the related functions close. - Updates the documentation/comments. - Uses `otPanId` and `otShortAddress` for function parameter types.
This commit is contained in:
committed by
Jonathan Hui
parent
13fb20ed26
commit
3a4a61f7ca
@@ -633,7 +633,7 @@ void otPlatRadioEnableSrcMatch(_In_ otInstance *otCtx, bool aEnable)
|
||||
}
|
||||
}
|
||||
|
||||
otError otPlatRadioAddSrcMatchShortEntry(_In_ otInstance *otCtx, const uint16_t aShortAddress)
|
||||
otError otPlatRadioAddSrcMatchShortEntry(_In_ otInstance *otCtx, otShortAddress aShortAddress)
|
||||
{
|
||||
NT_ASSERT(otCtx);
|
||||
PMS_FILTER pFilter = otCtxToFilter(otCtx);
|
||||
@@ -675,7 +675,7 @@ otError otPlatRadioAddSrcMatchExtEntry(_In_ otInstance *otCtx, const otExtAddres
|
||||
return NT_SUCCESS(status) ? OT_ERROR_NONE : OT_ERROR_FAILED;
|
||||
}
|
||||
|
||||
otError otPlatRadioClearSrcMatchShortEntry(_In_ otInstance *otCtx, const uint16_t aShortAddress)
|
||||
otError otPlatRadioClearSrcMatchShortEntry(_In_ otInstance *otCtx, otShortAddress aShortAddress)
|
||||
{
|
||||
NT_ASSERT(otCtx);
|
||||
PMS_FILTER pFilter = otCtxToFilter(otCtx);
|
||||
|
||||
+318
-294
@@ -240,6 +240,39 @@ typedef enum otRadioState
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the radio capabilities.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The radio capability bit vector (see `OT_RADIO_CAP_*` definitions).
|
||||
*
|
||||
*/
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the radio version string.
|
||||
*
|
||||
* This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses
|
||||
* the OpenThread version instead (@sa otGetVersionString()).
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns A pointer to the OpenThread radio version.
|
||||
*
|
||||
*/
|
||||
const char *otPlatRadioGetVersionString(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the radio receive sensitivity value.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The radio receive sensitivity value in dBm.
|
||||
*
|
||||
*/
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the factory-assigned IEEE EUI-64 for this interface.
|
||||
*
|
||||
@@ -256,7 +289,7 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64);
|
||||
* @param[in] aPanId The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId);
|
||||
void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId);
|
||||
|
||||
/**
|
||||
* Set the Extended Address for address filtering.
|
||||
@@ -275,255 +308,7 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aE
|
||||
* @param[in] aShortAddress The IEEE 802.15.4 Short Address.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aShortAddress);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup radio-operation Operation
|
||||
*
|
||||
* @brief
|
||||
* This module includes the platform abstraction for radio operations.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @return Current state of the radio.
|
||||
*/
|
||||
otRadioState otPlatRadioGetState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully enabled.
|
||||
* @retval OT_ERROR_FAILED The radio could not be enabled.
|
||||
*/
|
||||
otError otPlatRadioEnable(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Disable the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Disabled.
|
||||
*/
|
||||
otError otPlatRadioDisable(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Check whether radio is enabled or not.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns TRUE if the radio is enabled, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
bool otPlatRadioIsEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Transition the radio from Receive to Sleep.
|
||||
* Turn off the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Sleep.
|
||||
* @retval OT_ERROR_BUSY The radio was transmitting
|
||||
* @retval OT_ERROR_INVALID_STATE The radio was disabled
|
||||
*/
|
||||
otError otPlatRadioSleep(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Transitioning the radio from Sleep to Receive.
|
||||
* Turn on the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aChannel The channel to use for receiving.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Receive.
|
||||
* @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting.
|
||||
*/
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aEnable Enable/disable source address match feature.
|
||||
*/
|
||||
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable);
|
||||
|
||||
/**
|
||||
* Add a short address to the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aShortAddress The short address to be added.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added short address to the source match table.
|
||||
* @retval OT_ERROR_NO_BUFS No available entry in the source match table.
|
||||
*/
|
||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress);
|
||||
|
||||
/**
|
||||
* Add an extended address to the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aExtAddress The extended address to be added stored in little-endian byte order.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added extended address to the source match table.
|
||||
* @retval OT_ERROR_NO_BUFS No available entry in the source match table.
|
||||
*/
|
||||
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Remove a short address from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aShortAddress The short address to be removed.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed short address from the source match table.
|
||||
* @retval OT_ERROR_NO_ADDRESS The short address is not in source address match table.
|
||||
*/
|
||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress);
|
||||
|
||||
/**
|
||||
* Remove an extended address from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aExtAddress The extended address to be removed stored in little-endian byte order.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed the extended address from the source match table.
|
||||
* @retval OT_ERROR_NO_ADDRESS The extended address is not in source address match table.
|
||||
*/
|
||||
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Clear all short addresses from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Clear all the extended/long addresses from source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread of a received frame.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @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, otRadioFrame *aFrame, otError aError);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns A pointer to the transmit buffer.
|
||||
*
|
||||
*/
|
||||
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 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] aFrame A pointer to the transmitted frame.
|
||||
*
|
||||
* @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, otRadioFrame *aFrame);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread that the transmission has started.
|
||||
*
|
||||
* @note This function should be called by the same thread that executes all of the other OpenThread code. It should
|
||||
* not be called by ISR or any other task.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance structure.
|
||||
* @param[in] aFrame A pointer to the frame that is being transmitted.
|
||||
*
|
||||
*/
|
||||
extern void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError);
|
||||
|
||||
/**
|
||||
* Get the most recent RSSI measurement.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid.
|
||||
*/
|
||||
int8_t otPlatRadioGetRssi(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the radio capabilities.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The radio capability bit vector. The stack enables or disables some functions based on this value.
|
||||
*/
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance);
|
||||
void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* Get the radio's transmit power in dBm.
|
||||
@@ -555,8 +340,9 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower);
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval true Promiscuous mode is enabled.
|
||||
* @retval false Promiscuous mode is disabled.
|
||||
* @retval TRUE Promiscuous mode is enabled.
|
||||
* @retval FALSE Promiscuous mode is disabled.
|
||||
*
|
||||
*/
|
||||
bool otPlatRadioGetPromiscuous(otInstance *aInstance);
|
||||
|
||||
@@ -564,70 +350,201 @@ bool otPlatRadioGetPromiscuous(otInstance *aInstance);
|
||||
* Enable or disable promiscuous mode.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aEnable A value to enable or disable promiscuous mode.
|
||||
* @param[in] aEnable TRUE to enable or FALSE to disable promiscuous mode.
|
||||
*
|
||||
*/
|
||||
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] aFrame A pointer to the frame that was transmitted.
|
||||
* @param[in] aError OT_ERROR_NONE when the frame was transmitted, 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 otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError);
|
||||
|
||||
/**
|
||||
* @defgroup radio-operation Operation
|
||||
*
|
||||
* @brief
|
||||
* This module includes the platform abstraction for radio operations.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @return Current state of the radio.
|
||||
*
|
||||
*/
|
||||
otRadioState otPlatRadioGetState(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully enabled.
|
||||
* @retval OT_ERROR_FAILED The radio could not be enabled.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioEnable(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Disable the radio.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Disabled.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioDisable(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Check whether radio is enabled or not.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns TRUE if the radio is enabled, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
bool otPlatRadioIsEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Transition the radio from Receive to Sleep (turn off the radio).
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Sleep.
|
||||
* @retval OT_ERROR_BUSY The radio was transmitting.
|
||||
* @retval OT_ERROR_INVALID_STATE The radio was disabled.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioSleep(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Transition the radio from Sleep to Receive (turn on the radio).
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aChannel The channel to use for receiving.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully transitioned to Receive.
|
||||
* @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread of a received frame.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @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, otRadioFrame *aFrame, otError aError);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread diagnostics module of a received frame.
|
||||
*
|
||||
* This function is used when diagnostics is enabled.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @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.
|
||||
* @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, otRadioFrame *aFrame, otError aError);
|
||||
|
||||
/**
|
||||
* This method begins the energy scan sequence on the radio.
|
||||
* Get the radio transmit frame buffer.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aScanChannel The channel to perform the energy scan on.
|
||||
* @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started scanning the channel.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning.
|
||||
*/
|
||||
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread that the energy scan is complete.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel.
|
||||
*
|
||||
*/
|
||||
extern void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi);
|
||||
|
||||
/**
|
||||
* Get the radio receive sensitivity value.
|
||||
* OpenThread forms the IEEE 802.15.4 frame in this buffer then calls `otPlatRadioTransmit()` to request transmission.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The radio receive sensitivity value in dBm.
|
||||
* @returns A pointer to the transmit frame buffer.
|
||||
*
|
||||
*/
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance);
|
||||
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* 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 Receive.
|
||||
* 2. Transmits the psdu on the given channel and at the given transmit power.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aFrame A pointer to the frame to 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, otRadioFrame *aFrame);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread that the transmission has started.
|
||||
*
|
||||
* @note This function should be called by the same thread that executes all of the other OpenThread code. It should
|
||||
* not be called by ISR or any other task.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance structure.
|
||||
* @param[in] aFrame A pointer to the frame that is being transmitted.
|
||||
*
|
||||
*/
|
||||
extern void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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 tx 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, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed.
|
||||
*
|
||||
* This function is used when diagnostics is enabled.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aFrame A pointer to the frame that was transmitted.
|
||||
* @param[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.
|
||||
*
|
||||
*/
|
||||
extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread to process transmit security for the frame,
|
||||
* this happens when the frame includes Header IE(s) that were updated before transmission.
|
||||
*
|
||||
* @note This function will be called from interrupt context, it should only read/write data passed in
|
||||
* via @p aFrame, but should not read/write any state within OpenThread.
|
||||
* This function is used when feature `OPENTHREAD_CONFIG_HEADER_IE_SUPPORT` is enabled.
|
||||
*
|
||||
* @note This function can be called from interrupt context and it would only read/write data passed in
|
||||
* via @p aFrame, but would not read/write any state within OpenThread.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aFrame The radio frame which needs to process transmit security.
|
||||
@@ -636,17 +553,124 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance);
|
||||
extern void otPlatRadioFrameUpdated(otInstance *aInstance, otRadioFrame *aFrame);
|
||||
|
||||
/**
|
||||
* Get the radio version string.
|
||||
* Get the most recent RSSI measurement.
|
||||
*
|
||||
* This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses
|
||||
* the OpenThread version instead (@sa otGetVersionString()).
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns The RSSI in dBm when it is valid. 127 when RSSI is invalid.
|
||||
*
|
||||
*/
|
||||
int8_t otPlatRadioGetRssi(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Begin the energy scan sequence on the radio.
|
||||
*
|
||||
* This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aScanChannel The channel to perform the energy scan on.
|
||||
* @param[in] aScanDuration The duration, in milliseconds, for the channel to be scanned.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully started scanning the channel.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED The radio doesn't support energy scanning.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration);
|
||||
|
||||
/**
|
||||
* The radio driver calls this method to notify OpenThread that the energy scan is complete.
|
||||
*
|
||||
* This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel.
|
||||
*
|
||||
*/
|
||||
extern void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aEnable Enable/disable source address match feature.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable);
|
||||
|
||||
/**
|
||||
* Add a short address to the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aShortAddress The short address to be added.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added short address to the source match table.
|
||||
* @retval OT_ERROR_NO_BUFS No available entry in the source match table.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* Add an extended address to the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aExtAddress The extended address to be added stored in little-endian byte order.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully added extended address to the source match table.
|
||||
* @retval OT_ERROR_NO_BUFS No available entry in the source match table.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Remove a short address from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aShortAddress The short address to be removed.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed short address from the source match table.
|
||||
* @retval OT_ERROR_NO_ADDRESS The short address is not in source address match table.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress);
|
||||
|
||||
/**
|
||||
* Remove an extended address from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aExtAddress The extended address to be removed stored in little-endian byte order.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully removed the extended address from the source match table.
|
||||
* @retval OT_ERROR_NO_ADDRESS The extended address is not in source address match table.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
|
||||
|
||||
/**
|
||||
* Clear all short addresses from the source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
* @returns A pointer to the OpenThread radio version.
|
||||
*/
|
||||
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Clear all the extended/long addresses from source address match table.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
*
|
||||
*/
|
||||
const char *otPlatRadioGetVersionString(otInstance *aInstance);
|
||||
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user