• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2016, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /**
30  * @file
31  * @brief
32  *   This file defines the radio interface for OpenThread.
33  *
34  */
35 
36 #ifndef OPENTHREAD_PLATFORM_RADIO_H_
37 #define OPENTHREAD_PLATFORM_RADIO_H_
38 
39 #include <stdint.h>
40 
41 #include <openthread/error.h>
42 #include <openthread/instance.h>
43 #include <openthread/platform/crypto.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**
50  * @addtogroup plat-radio
51  *
52  * @brief
53  *   This module includes the platform abstraction for radio communication.
54  *
55  * @{
56  *
57  */
58 
59 /**
60  * @defgroup radio-types Radio Types
61  *
62  * @brief
63  *   This module includes the platform abstraction for a radio frame.
64  *
65  * @{
66  *
67  */
68 
69 enum
70 {
71     OT_RADIO_FRAME_MAX_SIZE    = 127,    ///< aMaxPHYPacketSize (IEEE 802.15.4-2006)
72     OT_RADIO_FRAME_MIN_SIZE    = 3,      ///< Minimal size of frame FCS + CONTROL
73     OT_RADIO_SYMBOLS_PER_OCTET = 2,      ///< 2.4 GHz IEEE 802.15.4-2006
74     OT_RADIO_BIT_RATE          = 250000, ///< 2.4 GHz IEEE 802.15.4 (bits per second)
75     OT_RADIO_BITS_PER_OCTET    = 8,      ///< Number of bits per octet
76 
77     OT_RADIO_SYMBOL_TIME   = ((OT_RADIO_BITS_PER_OCTET / OT_RADIO_SYMBOLS_PER_OCTET) * 1000000) / OT_RADIO_BIT_RATE,
78     OT_RADIO_LQI_NONE      = 0,   ///< LQI measurement not supported
79     OT_RADIO_RSSI_INVALID  = 127, ///< Invalid or unknown RSSI value
80     OT_RADIO_POWER_INVALID = 127, ///< Invalid or unknown power value
81 };
82 
83 /**
84  * This enumeration defines the channel page.
85  *
86  */
87 enum
88 {
89     OT_RADIO_CHANNEL_PAGE_0      = 0,                               ///< 2.4 GHz IEEE 802.15.4-2006
90     OT_RADIO_CHANNEL_PAGE_0_MASK = (1U << OT_RADIO_CHANNEL_PAGE_0), ///< 2.4 GHz IEEE 802.15.4-2006
91     OT_RADIO_CHANNEL_PAGE_2      = 2,                               ///< 915 MHz IEEE 802.15.4-2006
92     OT_RADIO_CHANNEL_PAGE_2_MASK = (1U << OT_RADIO_CHANNEL_PAGE_2), ///< 915 MHz IEEE 802.15.4-2006
93 };
94 
95 /**
96  * This enumeration defines the frequency band channel range.
97  *
98  */
99 enum
100 {
101     OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN  = 1,                                           ///< 915 MHz IEEE 802.15.4-2006
102     OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX  = 10,                                          ///< 915 MHz IEEE 802.15.4-2006
103     OT_RADIO_915MHZ_OQPSK_CHANNEL_MASK = 0x3ff << OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN,  ///< 915 MHz IEEE 802.15.4-2006
104     OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN  = 11,                                          ///< 2.4 GHz IEEE 802.15.4-2006
105     OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX  = 26,                                          ///< 2.4 GHz IEEE 802.15.4-2006
106     OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MASK = 0xffff << OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN, ///< 2.4 GHz IEEE 802.15.4-2006
107 };
108 
109 /**
110  * This type represents radio capabilities.
111  *
112  * The value is a bit-field indicating the capabilities supported by the radio. See `OT_RADIO_CAPS_*` definitions.
113  *
114  */
115 typedef uint8_t otRadioCaps;
116 
117 /**
118  * This enumeration defines constants that are used to indicate different radio capabilities. See `otRadioCaps`.
119  *
120  */
121 enum
122 {
123     OT_RADIO_CAPS_NONE             = 0,      ///< Radio supports no capability.
124     OT_RADIO_CAPS_ACK_TIMEOUT      = 1 << 0, ///< Radio supports AckTime event.
125     OT_RADIO_CAPS_ENERGY_SCAN      = 1 << 1, ///< Radio supports Energy Scans.
126     OT_RADIO_CAPS_TRANSMIT_RETRIES = 1 << 2, ///< Radio supports tx retry logic with collision avoidance (CSMA).
127     OT_RADIO_CAPS_CSMA_BACKOFF     = 1 << 3, ///< Radio supports CSMA backoff for frame transmission (but no retry).
128     OT_RADIO_CAPS_SLEEP_TO_TX      = 1 << 4, ///< Radio supports direct transition from sleep to TX with CSMA.
129     OT_RADIO_CAPS_TRANSMIT_SEC     = 1 << 5, ///< Radio supports tx security.
130     OT_RADIO_CAPS_TRANSMIT_TIMING  = 1 << 6, ///< Radio supports tx at specific time.
131     OT_RADIO_CAPS_RECEIVE_TIMING   = 1 << 7, ///< Radio supports rx at specific time.
132 };
133 
134 #define OT_PANID_BROADCAST 0xffff ///< IEEE 802.15.4 Broadcast PAN ID
135 
136 /**
137  * This type represents the IEEE 802.15.4 PAN ID.
138  *
139  */
140 typedef uint16_t otPanId;
141 
142 /**
143  * This type represents the IEEE 802.15.4 Short Address.
144  *
145  */
146 typedef uint16_t otShortAddress;
147 
148 #define OT_EXT_ADDRESS_SIZE 8 ///< Size of an IEEE 802.15.4 Extended Address (bytes)
149 
150 /**
151  * This enumeration defines constants about size of header IE in ACK.
152  *
153  */
154 enum
155 {
156     OT_IE_HEADER_SIZE               = 2,  ///< Size of IE header in bytes.
157     OT_CSL_IE_SIZE                  = 4,  ///< Size of CSL IE content in bytes.
158     OT_ACK_IE_MAX_SIZE              = 16, ///< Max length for header IE in ACK.
159     OT_ENH_PROBING_IE_DATA_MAX_SIZE = 2,  ///< Max length of Link Metrics data in Vendor-Specific IE.
160 };
161 
162 #define CSL_IE_HEADER_BYTES_LO 0x04 ///< Fixed CSL IE header first byte
163 #define CSL_IE_HEADER_BYTES_HI 0x0d ///< Fixed CSL IE header second byte
164 
165 /**
166  * @struct otExtAddress
167  *
168  * This structure represents the IEEE 802.15.4 Extended Address.
169  *
170  */
171 OT_TOOL_PACKED_BEGIN
172 struct otExtAddress
173 {
174     uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes
175 } OT_TOOL_PACKED_END;
176 
177 /**
178  * This structure represents the IEEE 802.15.4 Extended Address.
179  *
180  */
181 typedef struct otExtAddress otExtAddress;
182 
183 #define OT_MAC_KEY_SIZE 16 ///< Size of the MAC Key in bytes.
184 
185 /**
186  * @struct otMacKey
187  *
188  * This structure represents a MAC Key.
189  *
190  */
191 OT_TOOL_PACKED_BEGIN
192 struct otMacKey
193 {
194     uint8_t m8[OT_MAC_KEY_SIZE]; ///< MAC Key bytes.
195 } OT_TOOL_PACKED_END;
196 
197 /**
198  * This structure represents a MAC Key.
199  *
200  */
201 typedef struct otMacKey otMacKey;
202 
203 /**
204  * This type represents a MAC Key Ref used by PSA.
205  *
206  */
207 typedef otCryptoKeyRef otMacKeyRef;
208 
209 /**
210  * @struct otMacKeyMaterial
211  *
212  * This structure represents a MAC Key.
213  *
214  */
215 typedef struct otMacKeyMaterial
216 {
217     union
218     {
219         otMacKeyRef mKeyRef; ///< Reference to the key stored.
220         otMacKey    mKey;    ///< Key stored as literal.
221     } mKeyMaterial;
222 } otMacKeyMaterial;
223 
224 /**
225  * This enumeration defines constants about key types.
226  *
227  */
228 typedef enum
229 {
230     OT_KEY_TYPE_LITERAL_KEY = 0, ///< Use Literal Keys.
231     OT_KEY_TYPE_KEY_REF     = 1, ///< Use Reference to Key.
232 } otRadioKeyType;
233 
234 /**
235  * This structure represents the IEEE 802.15.4 Header IE (Information Element) related information of a radio frame.
236  */
237 typedef struct otRadioIeInfo
238 {
239     int64_t mNetworkTimeOffset; ///< The time offset to the Thread network time.
240     uint8_t mTimeIeOffset;      ///< The Time IE offset from the start of PSDU.
241     uint8_t mTimeSyncSeq;       ///< The Time sync sequence.
242 } otRadioIeInfo;
243 
244 /**
245  * This structure represents an IEEE 802.15.4 radio frame.
246  */
247 typedef struct otRadioFrame
248 {
249     uint8_t *mPsdu; ///< The PSDU.
250 
251     uint16_t mLength;  ///< Length of the PSDU.
252     uint8_t  mChannel; ///< Channel used to transmit/receive the frame.
253 
254     uint8_t mRadioType; ///< Radio link type - should be ignored by radio driver.
255 
256     /**
257      * The union of transmit and receive information for a radio frame.
258      */
259     union
260     {
261         /**
262          * Structure representing radio frame transmit information.
263          */
264         struct
265         {
266             const otMacKeyMaterial *mAesKey;  ///< The key material used for AES-CCM frame security.
267             otRadioIeInfo *         mIeInfo;  ///< The pointer to the Header IE(s) related information.
268             uint32_t                mTxDelay; ///< The delay time for this transmission (based on `mTxDelayBaseTime`).
269             uint32_t                mTxDelayBaseTime; ///< The base time for the transmission delay.
270             uint8_t mMaxCsmaBackoffs; ///< Maximum number of backoffs attempts before declaring CCA failure.
271             uint8_t mMaxFrameRetries; ///< Maximum number of retries allowed after a transmission failure.
272 
273             /**
274              * Indicates whether frame counter and CSL IEs are properly updated in the header.
275              *
276              * If the platform layer does not provide `OT_RADIO_CAPS_TRANSMIT_SEC` capability, it can ignore this flag.
277              *
278              * If the platform provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, then platform is expected to handle tx
279              * security processing and assignment of frame counter. In this case the following behavior is expected:
280              *
281              * When `mIsHeaderUpdated` is set, it indicates that OpenThread core has already set the frame counter and
282              * CSL IEs (if security is enabled) in the prepared frame. The counter is ensured to match the counter value
283              * from the previous attempts of the same frame. The platform should not assign or change the frame counter
284              * (but may still need to perform security processing depending on `mIsSecurityProcessed` flag).
285              *
286              * If `mIsHeaderUpdated` is not set, then the frame counter and key CSL IE not set in the frame by
287              * OpenThread core and it is the responsibility of the radio platform to assign them. The platform
288              * must update the frame header (assign counter and CSL IE values) before sending the frame over the air,
289              * however if the the transmission gets aborted and the frame is never sent over the air (e.g., channel
290              * access error) the platform may choose to not update the header. If the platform updates the header,
291              * it must also set this flag before passing the frame back from the `otPlatRadioTxDone()` callback.
292              *
293              */
294             bool mIsHeaderUpdated : 1;
295             bool mIsARetx : 1;             ///< Indicates whether the frame is a retransmission or not.
296             bool mCsmaCaEnabled : 1;       ///< Set to true to enable CSMA-CA for this packet, false otherwise.
297             bool mCslPresent : 1;          ///< Set to true if CSL header IE is present.
298             bool mIsSecurityProcessed : 1; ///< True if SubMac should skip the AES processing of this frame.
299         } mTxInfo;
300 
301         /**
302          * Structure representing radio frame receive information.
303          */
304         struct
305         {
306             /**
307              * The timestamp when the frame was received in microseconds.
308              *
309              * The value SHALL be the time when the SFD was received when TIME_SYNC or CSL is enabled.
310              * Otherwise, the time when the MAC frame was fully received is also acceptable.
311              *
312              */
313             uint64_t mTimestamp;
314 
315             uint32_t mAckFrameCounter; ///< ACK security frame counter (applicable when `mAckedWithSecEnhAck` is set).
316             uint8_t  mAckKeyId;        ///< ACK security key index (applicable when `mAckedWithSecEnhAck` is set).
317             int8_t   mRssi;            ///< Received signal strength indicator in dBm for received frames.
318             uint8_t  mLqi;             ///< Link Quality Indicator for received frames.
319 
320             // Flags
321             bool mAckedWithFramePending : 1; ///< This indicates if this frame was acknowledged with frame pending set.
322             bool mAckedWithSecEnhAck : 1; ///< This indicates if this frame was acknowledged with secured enhance ACK.
323         } mRxInfo;
324     } mInfo;
325 } otRadioFrame;
326 
327 /**
328  * This structure represents the state of a radio.
329  * Initially, a radio is in the Disabled state.
330  */
331 typedef enum otRadioState
332 {
333     OT_RADIO_STATE_DISABLED = 0,
334     OT_RADIO_STATE_SLEEP    = 1,
335     OT_RADIO_STATE_RECEIVE  = 2,
336     OT_RADIO_STATE_TRANSMIT = 3,
337     OT_RADIO_STATE_INVALID  = 255,
338 } otRadioState;
339 
340 /**
341  * The following are valid radio state transitions:
342  *
343  *                                    (Radio ON)
344  *  +----------+  Enable()  +-------+  Receive() +---------+   Transmit()  +----------+
345  *  |          |----------->|       |----------->|         |-------------->|          |
346  *  | Disabled |            | Sleep |            | Receive |               | Transmit |
347  *  |          |<-----------|       |<-----------|         |<--------------|          |
348  *  +----------+  Disable() +-------+   Sleep()  +---------+   Receive()   +----------+
349  *                                    (Radio OFF)                 or
350  *                                                        signal TransmitDone
351  *
352  * During the IEEE 802.15.4 data request command the transition Sleep->Receive->Transmit
353  * can be shortened to direct transition from Sleep to Transmit if the platform supports
354  * the OT_RADIO_CAPS_SLEEP_TO_TX capability.
355  */
356 
357 /**
358  * This structure represents radio coexistence metrics.
359  */
360 typedef struct otRadioCoexMetrics
361 {
362     uint32_t mNumGrantGlitch;          ///< Number of grant glitches.
363     uint32_t mNumTxRequest;            ///< Number of tx requests.
364     uint32_t mNumTxGrantImmediate;     ///< Number of tx requests while grant was active.
365     uint32_t mNumTxGrantWait;          ///< Number of tx requests while grant was inactive.
366     uint32_t mNumTxGrantWaitActivated; ///< Number of tx requests while grant was inactive that were ultimately granted.
367     uint32_t mNumTxGrantWaitTimeout;   ///< Number of tx requests while grant was inactive that timed out.
368     uint32_t mNumTxGrantDeactivatedDuringRequest; ///< Number of tx that were in progress when grant was deactivated.
369     uint32_t mNumTxDelayedGrant;                  ///< Number of tx requests that were not granted within 50us.
370     uint32_t mAvgTxRequestToGrantTime;            ///< Average time in usec from tx request to grant.
371     uint32_t mNumRxRequest;                       ///< Number of rx requests.
372     uint32_t mNumRxGrantImmediate;                ///< Number of rx requests while grant was active.
373     uint32_t mNumRxGrantWait;                     ///< Number of rx requests while grant was inactive.
374     uint32_t mNumRxGrantWaitActivated; ///< Number of rx requests while grant was inactive that were ultimately granted.
375     uint32_t mNumRxGrantWaitTimeout;   ///< Number of rx requests while grant was inactive that timed out.
376     uint32_t mNumRxGrantDeactivatedDuringRequest; ///< Number of rx that were in progress when grant was deactivated.
377     uint32_t mNumRxDelayedGrant;                  ///< Number of rx requests that were not granted within 50us.
378     uint32_t mAvgRxRequestToGrantTime;            ///< Average time in usec from rx request to grant.
379     uint32_t mNumRxGrantNone;                     ///< Number of rx requests that completed without receiving grant.
380     bool     mStopped;                            ///< Stats collection stopped due to saturation.
381 } otRadioCoexMetrics;
382 
383 /**
384  * This structure represents what metrics are specified to query.
385  *
386  */
387 typedef struct otLinkMetrics
388 {
389     bool mPduCount : 1;   ///< Pdu count.
390     bool mLqi : 1;        ///< Link Quality Indicator.
391     bool mLinkMargin : 1; ///< Link Margin.
392     bool mRssi : 1;       ///< Received Signal Strength Indicator.
393     bool mReserved : 1;   ///< Reserved, this is for reference device.
394 } otLinkMetrics;
395 
396 /**
397  * @}
398  *
399  */
400 
401 /**
402  * @defgroup radio-config Radio Configuration
403  *
404  * @brief
405  *   This module includes the platform abstraction for radio configuration.
406  *
407  * @{
408  *
409  */
410 
411 /**
412  * Get the radio capabilities.
413  *
414  * @param[in] aInstance  The OpenThread instance structure.
415  *
416  * @returns The radio capability bit vector (see `OT_RADIO_CAP_*` definitions).
417  *
418  */
419 otRadioCaps otPlatRadioGetCaps(otInstance *aInstance);
420 
421 /**
422  * Get the radio version string.
423  *
424  * This is an optional radio driver platform function. If not provided by platform radio driver, OpenThread uses
425  * the OpenThread version instead (@sa otGetVersionString()).
426  *
427  * @param[in]  aInstance   The OpenThread instance structure.
428  *
429  * @returns A pointer to the OpenThread radio version.
430  *
431  */
432 const char *otPlatRadioGetVersionString(otInstance *aInstance);
433 
434 /**
435  * Get the radio receive sensitivity value.
436  *
437  * @param[in] aInstance  The OpenThread instance structure.
438  *
439  * @returns The radio receive sensitivity value in dBm.
440  *
441  */
442 int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance);
443 
444 /**
445  * Gets the factory-assigned IEEE EUI-64 for this interface.
446  *
447  * @param[in]  aInstance   The OpenThread instance structure.
448  * @param[out] aIeeeEui64  A pointer to the factory-assigned IEEE EUI-64.
449  *
450  */
451 void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64);
452 
453 /**
454  * Set the PAN ID for address filtering.
455  *
456  * @param[in] aInstance  The OpenThread instance structure.
457  * @param[in] aPanId     The IEEE 802.15.4 PAN ID.
458  *
459  */
460 void otPlatRadioSetPanId(otInstance *aInstance, otPanId aPanId);
461 
462 /**
463  * Set the Extended Address for address filtering.
464  *
465  * @param[in] aInstance    The OpenThread instance structure.
466  * @param[in] aExtAddress  A pointer to the IEEE 802.15.4 Extended Address stored in little-endian byte order.
467  *
468  *
469  */
470 void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress);
471 
472 /**
473  * Set the Short Address for address filtering.
474  *
475  * @param[in] aInstance      The OpenThread instance structure.
476  * @param[in] aShortAddress  The IEEE 802.15.4 Short Address.
477  *
478  */
479 void otPlatRadioSetShortAddress(otInstance *aInstance, otShortAddress aShortAddress);
480 
481 /**
482  * Get the radio's transmit power in dBm.
483  *
484  * @note The transmit power returned will be no larger than the power specified in the max power table for
485  * the current channel.
486  *
487  * @param[in] aInstance  The OpenThread instance structure.
488  * @param[out] aPower    The transmit power in dBm.
489  *
490  * @retval OT_ERROR_NONE             Successfully retrieved the transmit power.
491  * @retval OT_ERROR_INVALID_ARGS     @p aPower was NULL.
492  * @retval OT_ERROR_NOT_IMPLEMENTED  Transmit power configuration via dBm is not implemented.
493  *
494  */
495 otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower);
496 
497 /**
498  * Set the radio's transmit power in dBm.
499  *
500  * @note The real transmit power will be no larger than the power specified in the max power table for
501  * the current channel.
502  *
503  * @param[in] aInstance  The OpenThread instance structure.
504  * @param[in] aPower     The transmit power in dBm.
505  *
506  * @retval OT_ERROR_NONE             Successfully set the transmit power.
507  * @retval OT_ERROR_NOT_IMPLEMENTED  Transmit power configuration via dBm is not implemented.
508  *
509  */
510 otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower);
511 
512 /**
513  * Get the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
514  *
515  * @param[in] aInstance    The OpenThread instance structure.
516  * @param[out] aThreshold  The CCA ED threshold in dBm.
517  *
518  * @retval OT_ERROR_NONE             Successfully retrieved the CCA ED threshold.
519  * @retval OT_ERROR_INVALID_ARGS     @p aThreshold was NULL.
520  * @retval OT_ERROR_NOT_IMPLEMENTED  CCA ED threshold configuration via dBm is not implemented.
521  *
522  */
523 otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold);
524 
525 /**
526  * Set the radio's CCA ED threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
527  *
528  * @param[in] aInstance   The OpenThread instance structure.
529  * @param[in] aThreshold  The CCA ED threshold in dBm.
530  *
531  * @retval OT_ERROR_NONE             Successfully set the transmit power.
532  * @retval OT_ERROR_INVALID_ARGS     Given threshold is out of range.
533  * @retval OT_ERROR_NOT_IMPLEMENTED  CCA ED threshold configuration via dBm is not implemented.
534  *
535  */
536 otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold);
537 
538 /**
539  * Get the external FEM's Rx LNA gain in dBm.
540  *
541  * @param[in]  aInstance  The OpenThread instance structure.
542  * @param[out] aGain     The external FEM's Rx LNA gain in dBm.
543  *
544  * @retval OT_ERROR_NONE             Successfully retrieved the external FEM's LNA gain.
545  * @retval OT_ERROR_INVALID_ARGS     @p aGain was NULL.
546  * @retval OT_ERROR_NOT_IMPLEMENTED  External FEM's LNA setting is not implemented.
547  *
548  */
549 otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain);
550 
551 /**
552  * Set the external FEM's Rx LNA gain in dBm.
553  *
554  * @param[in] aInstance  The OpenThread instance structure.
555  * @param[in] aGain      The external FEM's Rx LNA gain in dBm.
556  *
557  * @retval OT_ERROR_NONE             Successfully set the external FEM's LNA gain.
558  * @retval OT_ERROR_NOT_IMPLEMENTED  External FEM's LNA gain setting is not implemented.
559  *
560  */
561 otError otPlatRadioSetFemLnaGain(otInstance *aInstance, int8_t aGain);
562 
563 /**
564  * Get the status of promiscuous mode.
565  *
566  * @param[in] aInstance  The OpenThread instance structure.
567  *
568  * @retval TRUE   Promiscuous mode is enabled.
569  * @retval FALSE  Promiscuous mode is disabled.
570  *
571  */
572 bool otPlatRadioGetPromiscuous(otInstance *aInstance);
573 
574 /**
575  * Enable or disable promiscuous mode.
576  *
577  * @param[in]  aInstance The OpenThread instance structure.
578  * @param[in]  aEnable   TRUE to enable or FALSE to disable promiscuous mode.
579  *
580  */
581 void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable);
582 
583 /**
584  * Update MAC keys and key index
585  *
586  * This function is used when radio provides OT_RADIO_CAPS_TRANSMIT_SEC capability.
587  *
588  * @param[in]   aInstance    A pointer to an OpenThread instance.
589  * @param[in]   aKeyIdMode   The key ID mode.
590  * @param[in]   aKeyId       Current MAC key index.
591  * @param[in]   aPrevKey     A pointer to the previous MAC key.
592  * @param[in]   aCurrKey     A pointer to the current MAC key.
593  * @param[in]   aNextKey     A pointer to the next MAC key.
594  * @param[in]   aKeyType     Key Type used.
595  *
596  */
597 void otPlatRadioSetMacKey(otInstance *            aInstance,
598                           uint8_t                 aKeyIdMode,
599                           uint8_t                 aKeyId,
600                           const otMacKeyMaterial *aPrevKey,
601                           const otMacKeyMaterial *aCurrKey,
602                           const otMacKeyMaterial *aNextKey,
603                           otRadioKeyType          aKeyType);
604 
605 /**
606  * This method sets the current MAC frame counter value.
607  *
608  * This function is used when radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability.
609  *
610  * @param[in]   aInstance         A pointer to an OpenThread instance.
611  * @param[in]   aMacFrameCounter  The MAC frame counter value.
612  *
613  */
614 void otPlatRadioSetMacFrameCounter(otInstance *aInstance, uint32_t aMacFrameCounter);
615 
616 /**
617  * Get the current estimated time (in microseconds) of the radio chip.
618  *
619  * This microsecond timer must be a free-running timer. The timer must continue to advance with microsecond precision
620  * even when the radio is in the sleep state.
621  *
622  * @param[in]   aInstance    A pointer to an OpenThread instance.
623  *
624  * @returns The current time in microseconds. UINT64_MAX when platform does not support or radio time is not ready.
625  *
626  */
627 uint64_t otPlatRadioGetNow(otInstance *aInstance);
628 
629 /**
630  * Get the bus speed in bits/second between the host and the radio chip.
631  *
632  * @param[in]   aInstance    A pointer to an OpenThread instance.
633  *
634  * @returns The bus speed in bits/second between the host and the radio chip.
635  *          Return 0 when the MAC and above layer and Radio layer resides on the same chip.
636  *
637  */
638 uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance);
639 
640 /**
641  * @}
642  *
643  */
644 
645 /**
646  * @defgroup radio-operation Radio Operation
647  *
648  * @brief
649  *   This module includes the platform abstraction for radio operations.
650  *
651  * @{
652  *
653  */
654 
655 /**
656  * Get current state of the radio.
657  *
658  * This function is not required by OpenThread. It may be used for debugging and/or application-specific purposes.
659  *
660  * @note This function may be not implemented. It does not affect OpenThread.
661  *
662  * @param[in] aInstance  The OpenThread instance structure.
663  *
664  * @return  Current state of the radio.
665  *
666  */
667 otRadioState otPlatRadioGetState(otInstance *aInstance);
668 
669 /**
670  * Enable the radio.
671  *
672  * @param[in] aInstance  The OpenThread instance structure.
673  *
674  * @retval OT_ERROR_NONE     Successfully enabled.
675  * @retval OT_ERROR_FAILED   The radio could not be enabled.
676  *
677  */
678 otError otPlatRadioEnable(otInstance *aInstance);
679 
680 /**
681  * Disable the radio.
682  *
683  * @param[in] aInstance  The OpenThread instance structure.
684  *
685  * @retval OT_ERROR_NONE            Successfully transitioned to Disabled.
686  * @retval OT_ERROR_INVALID_STATE   The radio was not in sleep state.
687  *
688  */
689 otError otPlatRadioDisable(otInstance *aInstance);
690 
691 /**
692  * Check whether radio is enabled or not.
693  *
694  * @param[in] aInstance  The OpenThread instance structure.
695  *
696  * @returns TRUE if the radio is enabled, FALSE otherwise.
697  *
698  */
699 bool otPlatRadioIsEnabled(otInstance *aInstance);
700 
701 /**
702  * Transition the radio from Receive to Sleep (turn off the radio).
703  *
704  * @param[in] aInstance  The OpenThread instance structure.
705  *
706  * @retval OT_ERROR_NONE          Successfully transitioned to Sleep.
707  * @retval OT_ERROR_BUSY          The radio was transmitting.
708  * @retval OT_ERROR_INVALID_STATE The radio was disabled.
709  *
710  */
711 otError otPlatRadioSleep(otInstance *aInstance);
712 
713 /**
714  * Transition the radio from Sleep to Receive (turn on the radio).
715  *
716  * @param[in]  aInstance  The OpenThread instance structure.
717  * @param[in]  aChannel   The channel to use for receiving.
718  *
719  * @retval OT_ERROR_NONE          Successfully transitioned to Receive.
720  * @retval OT_ERROR_INVALID_STATE The radio was disabled or transmitting.
721  *
722  */
723 otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel);
724 
725 /**
726  * Schedule a radio reception window at a specific time and duration.
727  *
728  * @param[in]  aChannel   The radio channel on which to receive.
729  * @param[in]  aStart     The receive window start time, in microseconds.
730  * @param[in]  aDuration  The receive window duration, in microseconds
731  *
732  * @retval OT_ERROR_NONE    Successfully scheduled receive window.
733  * @retval OT_ERROR_FAILED  The receive window could not be scheduled.
734  */
735 otError otPlatRadioReceiveAt(otInstance *aInstance, uint8_t aChannel, uint32_t aStart, uint32_t aDuration);
736 
737 /**
738  * The radio driver calls this method to notify OpenThread of a received frame.
739  *
740  * @param[in]  aInstance The OpenThread instance structure.
741  * @param[in]  aFrame    A pointer to the received frame or NULL if the receive operation failed.
742  * @param[in]  aError    OT_ERROR_NONE when successfully received a frame,
743  *                       OT_ERROR_ABORT when reception was aborted and a frame was not received,
744  *                       OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
745  *
746  */
747 extern void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError);
748 
749 /**
750  * The radio driver calls this method to notify OpenThread diagnostics module of a received frame.
751  *
752  * This function is used when diagnostics is enabled.
753  *
754  * @param[in]  aInstance The OpenThread instance structure.
755  * @param[in]  aFrame    A pointer to the received frame or NULL if the receive operation failed.
756  * @param[in]  aError    OT_ERROR_NONE when successfully received a frame,
757  *                       OT_ERROR_ABORT when reception was aborted and a frame was not received,
758  *                       OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
759  *
760  */
761 extern void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError);
762 
763 /**
764  * Get the radio transmit frame buffer.
765  *
766  * OpenThread forms the IEEE 802.15.4 frame in this buffer then calls `otPlatRadioTransmit()` to request transmission.
767  *
768  * @param[in] aInstance  The OpenThread instance structure.
769  *
770  * @returns A pointer to the transmit frame buffer.
771  *
772  */
773 otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance);
774 
775 /**
776  * Begin the transmit sequence on the radio.
777  *
778  * The caller must form the IEEE 802.15.4 frame in the buffer provided by `otPlatRadioGetTransmitBuffer()` before
779  * requesting transmission.  The channel and transmit power are also included in the otRadioFrame structure.
780  *
781  * The transmit sequence consists of:
782  * 1. Transitioning the radio to Transmit from one of the following states:
783  *    - Receive if RX is on when the device is idle or OT_RADIO_CAPS_SLEEP_TO_TX is not supported
784  *    - Sleep if RX is off when the device is idle and OT_RADIO_CAPS_SLEEP_TO_TX is supported.
785  * 2. Transmits the psdu on the given channel and at the given transmit power.
786  *
787  * @param[in] aInstance  The OpenThread instance structure.
788  * @param[in] aFrame     A pointer to the frame to be transmitted.
789  *
790  * @retval OT_ERROR_NONE          Successfully transitioned to Transmit.
791  * @retval OT_ERROR_INVALID_STATE The radio was not in the Receive state.
792  *
793  */
794 otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame);
795 
796 /**
797  * The radio driver calls this method to notify OpenThread that the transmission has started.
798  *
799  * @note  This function should be called by the same thread that executes all of the other OpenThread code. It should
800  *        not be called by ISR or any other task.
801  *
802  * @param[in]  aInstance  A pointer to the OpenThread instance structure.
803  * @param[in]  aFrame     A pointer to the frame that is being transmitted.
804  *
805  */
806 extern void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame);
807 
808 /**
809  * The radio driver calls this function to notify OpenThread that the transmit operation has completed,
810  * providing both the transmitted frame and, if applicable, the received ack frame.
811  *
812  * When radio provides `OT_RADIO_CAPS_TRANSMIT_SEC` capability, radio platform layer updates @p aFrame
813  * with the security frame counter and key index values maintained by the radio.
814  *
815  * @param[in]  aInstance  The OpenThread instance structure.
816  * @param[in]  aFrame     A pointer to the frame that was transmitted.
817  * @param[in]  aAckFrame  A pointer to the ACK frame, NULL if no ACK was received.
818  * @param[in]  aError     OT_ERROR_NONE when the frame was transmitted,
819  *                        OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received,
820  *                        OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel,
821  *                        OT_ERROR_ABORT when transmission was aborted for other reasons.
822  *
823  */
824 extern void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError);
825 
826 /**
827  * The radio driver calls this method to notify OpenThread diagnostics module that the transmission has completed.
828  *
829  * This function is used when diagnostics is enabled.
830  *
831  * @param[in]  aInstance      The OpenThread instance structure.
832  * @param[in]  aFrame         A pointer to the frame that was transmitted.
833  * @param[in]  aError         OT_ERROR_NONE when the frame was transmitted,
834  *                            OT_ERROR_CHANNEL_ACCESS_FAILURE tx could not take place due to activity on the channel,
835  *                            OT_ERROR_ABORT when transmission was aborted for other reasons.
836  *
837  */
838 extern void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError);
839 
840 /**
841  * Get the most recent RSSI measurement.
842  *
843  * @param[in] aInstance  The OpenThread instance structure.
844  *
845  * @returns The RSSI in dBm when it is valid.  127 when RSSI is invalid.
846  *
847  */
848 int8_t otPlatRadioGetRssi(otInstance *aInstance);
849 
850 /**
851  * Begin the energy scan sequence on the radio.
852  *
853  * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.
854  *
855  * @param[in] aInstance      The OpenThread instance structure.
856  * @param[in] aScanChannel   The channel to perform the energy scan on.
857  * @param[in] aScanDuration  The duration, in milliseconds, for the channel to be scanned.
858  *
859  * @retval OT_ERROR_NONE             Successfully started scanning the channel.
860  * @retval OT_ERROR_BUSY             The radio is performing enery scanning.
861  * @retval OT_ERROR_NOT_IMPLEMENTED  The radio doesn't support energy scanning.
862  *
863  */
864 otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration);
865 
866 /**
867  * The radio driver calls this method to notify OpenThread that the energy scan is complete.
868  *
869  * This function is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability.
870  *
871  * @param[in]  aInstance           The OpenThread instance structure.
872  * @param[in]  aEnergyScanMaxRssi  The maximum RSSI encountered on the scanned channel.
873  *
874  */
875 extern void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi);
876 
877 /**
878  * Enable/Disable source address match feature.
879  *
880  * The source address match feature controls how the radio layer decides the "frame pending" bit for acks sent in
881  * response to data request commands from children.
882  *
883  * If disabled, the radio layer must set the "frame pending" on all acks to data request commands.
884  *
885  * If enabled, the radio layer uses the source address match table to determine whether to set or clear the "frame
886  * pending" bit in an ack to a data request command.
887  *
888  * The source address match table provides the list of children for which there is a pending frame. Either a short
889  * address or an extended/long address can be added to the source address match table.
890  *
891  * @param[in]  aInstance   The OpenThread instance structure.
892  * @param[in]  aEnable     Enable/disable source address match feature.
893  *
894  */
895 void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable);
896 
897 /**
898  * Add a short address to the source address match table.
899  *
900  * @param[in]  aInstance      The OpenThread instance structure.
901  * @param[in]  aShortAddress  The short address to be added.
902  *
903  * @retval OT_ERROR_NONE      Successfully added short address to the source match table.
904  * @retval OT_ERROR_NO_BUFS   No available entry in the source match table.
905  *
906  */
907 otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress);
908 
909 /**
910  * Add an extended address to the source address match table.
911  *
912  * @param[in]  aInstance    The OpenThread instance structure.
913  * @param[in]  aExtAddress  The extended address to be added stored in little-endian byte order.
914  *
915  * @retval OT_ERROR_NONE      Successfully added extended address to the source match table.
916  * @retval OT_ERROR_NO_BUFS   No available entry in the source match table.
917  *
918  */
919 otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
920 
921 /**
922  * Remove a short address from the source address match table.
923  *
924  * @param[in]  aInstance      The OpenThread instance structure.
925  * @param[in]  aShortAddress  The short address to be removed.
926  *
927  * @retval OT_ERROR_NONE        Successfully removed short address from the source match table.
928  * @retval OT_ERROR_NO_ADDRESS  The short address is not in source address match table.
929  *
930  */
931 otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, otShortAddress aShortAddress);
932 
933 /**
934  * Remove an extended address from the source address match table.
935  *
936  * @param[in]  aInstance    The OpenThread instance structure.
937  * @param[in]  aExtAddress  The extended address to be removed stored in little-endian byte order.
938  *
939  * @retval OT_ERROR_NONE        Successfully removed the extended address from the source match table.
940  * @retval OT_ERROR_NO_ADDRESS  The extended address is not in source address match table.
941  *
942  */
943 otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress);
944 
945 /**
946  * Clear all short addresses from the source address match table.
947  *
948  * @param[in]  aInstance   The OpenThread instance structure.
949  *
950  */
951 void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance);
952 
953 /**
954  * Clear all the extended/long addresses from source address match table.
955  *
956  * @param[in]  aInstance   The OpenThread instance structure.
957  *
958  */
959 void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance);
960 
961 /**
962  * Get the radio supported channel mask that the device is allowed to be on.
963  *
964  * @param[in]  aInstance   The OpenThread instance structure.
965  *
966  * @returns The radio supported channel mask.
967  *
968  */
969 uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance);
970 
971 /**
972  * Get the radio preferred channel mask that the device prefers to form on.
973  *
974  * @param[in]  aInstance   The OpenThread instance structure.
975  *
976  * @returns The radio preferred channel mask.
977  *
978  */
979 uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance);
980 
981 /**
982  * Enable the radio coex.
983  *
984  * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.
985  *
986  * @param[in] aInstance  The OpenThread instance structure.
987  * @param[in] aEnabled   TRUE to enable the radio coex, FALSE otherwise.
988  *
989  * @retval OT_ERROR_NONE     Successfully enabled.
990  * @retval OT_ERROR_FAILED   The radio coex could not be enabled.
991  *
992  */
993 otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled);
994 
995 /**
996  * Check whether radio coex is enabled or not.
997  *
998  * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.
999  *
1000  * @param[in] aInstance  The OpenThread instance structure.
1001  *
1002  * @returns TRUE if the radio coex is enabled, FALSE otherwise.
1003  *
1004  */
1005 bool otPlatRadioIsCoexEnabled(otInstance *aInstance);
1006 
1007 /**
1008  * Get the radio coexistence metrics.
1009  *
1010  * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled.
1011  *
1012  * @param[in]  aInstance     The OpenThread instance structure.
1013  * @param[out] aCoexMetrics  A pointer to the coexistence metrics structure.
1014  *
1015  * @retval OT_ERROR_NONE          Successfully retrieved the coex metrics.
1016  * @retval OT_ERROR_INVALID_ARGS  @p aCoexMetrics was NULL.
1017  */
1018 otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics);
1019 
1020 /**
1021  * Enable or disable CSL receiver.
1022  *
1023  * @param[in]  aInstance     The OpenThread instance structure.
1024  * @param[in]  aCslPeriod    CSL period, 0 for disabling CSL.
1025  * @param[in]  aShortAddr    The short source address of CSL receiver's peer.
1026  * @param[in]  aExtAddr      The extended source address of CSL receiver's peer.
1027  *
1028  * @note Platforms should use CSL peer addresses to include CSL IE when generating enhanced acks.
1029  *
1030  * @retval  kErrorNotImplemented Radio driver doesn't support CSL.
1031  * @retval  kErrorFailed         Other platform specific errors.
1032  * @retval  kErrorNone           Successfully enabled or disabled CSL.
1033  *
1034  */
1035 otError otPlatRadioEnableCsl(otInstance *        aInstance,
1036                              uint32_t            aCslPeriod,
1037                              otShortAddress      aShortAddr,
1038                              const otExtAddress *aExtAddr);
1039 
1040 /**
1041  * Update CSL sample time in radio driver.
1042  *
1043  * Sample time is stored in radio driver as a copy to calculate phase when sending ACK with CSL IE.
1044  *
1045  * @param[in]  aInstance         The OpenThread instance structure.
1046  * @param[in]  aCslSampleTime    The latest sample time.
1047  *
1048  */
1049 void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime);
1050 
1051 /**
1052  * Get the current accuracy, in units of ± ppm, of the clock used for scheduling CSL operations.
1053  *
1054  * @note Platforms may optimize this value based on operational conditions (i.e.: temperature).
1055  *
1056  * @param[in]   aInstance    A pointer to an OpenThread instance.
1057  *
1058  * @returns The current CSL rx/tx scheduling drift, in units of ± ppm.
1059  *
1060  */
1061 uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance);
1062 
1063 /**
1064  * The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds.
1065  *
1066  * @param[in]   aInstance    A pointer to an OpenThread instance.
1067  *
1068  * @returns The CSL Uncertainty in units of 10 us.
1069  *
1070  */
1071 uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance);
1072 
1073 /**
1074  * Set the max transmit power for a specific channel.
1075  *
1076  * @param[in]  aInstance    The OpenThread instance structure.
1077  * @param[in]  aChannel     The radio channel.
1078  * @param[in]  aMaxPower    The max power in dBm, passing OT_RADIO_RSSI_INVALID will disable this channel.
1079  *
1080  * @retval  OT_ERROR_NOT_IMPLEMENTED  The feature is not implemented
1081  * @retval  OT_ERROR_INVALID_ARGS     The specified channel is not valid.
1082  * @retval  OT_ERROR_FAILED           Other platform specific errors.
1083  * @retval  OT_ERROR_NONE             Successfully set max transmit power.
1084  *
1085  */
1086 otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower);
1087 
1088 /**
1089  * Set the region code.
1090  *
1091  * The radio region format is the 2-bytes ascii representation of the
1092  * ISO 3166 alpha-2 code.
1093  *
1094  * @param[in]  aInstance    The OpenThread instance structure.
1095  * @param[in]  aRegionCode  The radio region.
1096  *
1097  * @retval  OT_ERROR_FAILED           Other platform specific errors.
1098  * @retval  OT_ERROR_NONE             Successfully set region code.
1099  *
1100  */
1101 otError otPlatRadioSetRegion(otInstance *aInstance, uint16_t aRegionCode);
1102 
1103 /**
1104  * Get the region code.
1105  *
1106  * The radio region format is the 2-bytes ascii representation of the
1107  * ISO 3166 alpha-2 code.
1108 
1109  * @param[in]  aInstance    The OpenThread instance structure.
1110  * @param[out] aRegionCode  The radio region.
1111  *
1112  * @retval  OT_ERROR_INVALID_ARGS     @p aRegionCode is nullptr.
1113  * @retval  OT_ERROR_FAILED           Other platform specific errors.
1114  * @retval  OT_ERROR_NONE             Successfully got region code.
1115  *
1116  */
1117 otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode);
1118 
1119 /**
1120  * Enable/disable or update Enhanced-ACK Based Probing in radio for a specific Initiator.
1121  *
1122  * After Enhanced-ACK Based Probing is configured by a specific Probing Initiator, the Enhanced-ACK sent to that
1123  * node should include Vendor-Specific IE containing Link Metrics data. This method informs the radio to start/stop to
1124  * collect Link Metrics data and include Vendor-Specific IE that containing the data in Enhanced-ACK sent to that
1125  * Probing Initiator.
1126  *
1127  * @param[in]  aInstance     The OpenThread instance structure.
1128  * @param[in]  aLinkMetrics  This parameter specifies what metrics to query. Per spec 4.11.3.4.4.6, at most 2 metrics
1129  *                           can be specified. The probing would be disabled if @p `aLinkMetrics` is bitwise 0.
1130  * @param[in]  aShortAddress The short address of the Probing Initiator.
1131  * @param[in]  aExtAddress   The extended source address of the Probing Initiator. @p aExtAddr MUST NOT be `NULL`.
1132  *
1133  * @retval  OT_ERROR_NONE            Successfully configured the Enhanced-ACK Based Probing.
1134  * @retval  OT_ERROR_INVALID_ARGS    @p aExtAddress is `NULL`.
1135  * @retval  OT_ERROR_NOT_FOUND       The Initiator indicated by @p aShortAddress is not found when trying to clear.
1136  * @retval  OT_ERROR_NO_BUFS         No more Initiator can be supported.
1137  *
1138  */
1139 otError otPlatRadioConfigureEnhAckProbing(otInstance *        aInstance,
1140                                           otLinkMetrics       aLinkMetrics,
1141                                           otShortAddress      aShortAddress,
1142                                           const otExtAddress *aExtAddress);
1143 
1144 /**
1145  * @}
1146  *
1147  */
1148 
1149 /**
1150  * @}
1151  *
1152  */
1153 
1154 #ifdef __cplusplus
1155 } // end of extern "C"
1156 #endif
1157 
1158 #endif // OPENTHREAD_PLATFORM_RADIO_H_
1159