1 /***************************************************************************//**
2 * @file
3 * @brief The main header file for the RAIL library. It describes the external
4 * APIs available to a RAIL user
5 *******************************************************************************
6 * # License
7 * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
8 *******************************************************************************
9 *
10 * SPDX-License-Identifier: Zlib
11 *
12 * The licensor of this software is Silicon Laboratories Inc.
13 *
14 * This software is provided 'as-is', without any express or implied
15 * warranty. In no event will the authors be held liable for any damages
16 * arising from the use of this software.
17 *
18 * Permission is granted to anyone to use this software for any purpose,
19 * including commercial applications, and to alter it and redistribute it
20 * freely, subject to the following restrictions:
21 *
22 * 1. The origin of this software must not be misrepresented; you must not
23 * claim that you wrote the original software. If you use this software
24 * in a product, an acknowledgment in the product documentation would be
25 * appreciated but is not required.
26 * 2. Altered source versions must be plainly marked as such, and must not be
27 * misrepresented as being the original software.
28 * 3. This notice may not be removed or altered from any source distribution.
29 *
30 ******************************************************************************/
31
32 #ifndef __RAIL_H__
33 #define __RAIL_H__
34
35 #include <string.h> // For memcpy()
36
37 // Get the RAIL-specific structures and types
38 #include "rail_types.h"
39 #include "rail_assert_error_codes.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46 * @addtogroup RAIL_API RAIL API
47 * @brief This is the primary API layer for the Radio Abstraction Interface
48 * Layer (RAIL)
49 * @{
50 */
51
52 /**
53 * @defgroup Chip_Specific Chip-Specific
54 * @brief Chip-Specific RAIL APIs, types, and information
55 */
56
57 /**
58 * @defgroup Protocol_Specific Protocol-specific
59 * @brief Protocol-Specific RAIL APIs
60 */
61
62 /******************************************************************************
63 * General Radio Operation
64 *****************************************************************************/
65 /**
66 * @addtogroup General
67 * @brief Basic APIs to set up and interact with the RAIL library
68 * @{
69 */
70
71 /**
72 * Get the version information for the compiled RAIL library.
73 *
74 * @param[out] version A pointer to \ref RAIL_Version_t structure to
75 * populate with version information.
76 * @param[in] verbose Populate \ref RAIL_Version_t struct with verbose
77 * information.
78 *
79 * The version information contains a major version number, a minor version
80 * number, and a rev (revision) number.
81 */
82 void RAIL_GetVersion(RAIL_Version_t *version, bool verbose);
83
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85
86 /**
87 * A global pointer to the head of a linked list of state buffers
88 * \ref RAIL_Init() can use.
89 *
90 * RAIL internally provides one statically-allocated RAM state buffer
91 * for a single protocol and two for dynamic multiprotocol. If your
92 * application needs more, they can be provided via \ref
93 * RAIL_AddStateBuffer3() or RAIL_AddStateBuffer4(), which use
94 * internal buffers, or the more general \ref RAIL_AddStateBuffer().
95 *
96 * This symbol is WEAK in the RAIL library in case an application wants
97 * to allocate and provide its own buffers. However, this use is highly
98 * discouraged.
99 */
100 extern RAIL_StateBufferEntry_t *RAIL_StateBufferHead;
101
102 /**
103 * Get the run-time size of the radio's state buffer.
104 *
105 * @param[in] genericRailHandle A generic RAIL instance handle.
106 * @return Size, in bytes, of the radio's internal state buffer.
107 * If the handle is invalid, 0 is returned.
108 *
109 * See \ref RAIL_STATE_BUFFER_BYTES for a compile-time estimated size
110 * definition, which may be larger than what this function returns.
111 */
112 uint32_t RAIL_GetStateBufferSize(RAIL_Handle_t genericRailHandle);
113
114 /**
115 * Add an app-provided state buffer to the \ref RAIL_StateBufferHead list.
116 *
117 * @param[in] genericRailHandle A generic RAIL instance handle.
118 * @param[in] newEntry pointer to a \ref RAIL_StateBufferEntry_t to
119 * add to the liked list of state buffers headed by
120 * \ref RAIL_StateBufferHead. Both the \ref RAIL_StateBufferEntry_t
121 * to which this parameter points and the \ref
122 * RAIL_StateBufferEntry_t::buffer to which that points must be
123 * allocated in RAM and persist indefinitely beyond this call.
124 * @return Status code indicating success of the function call.
125 * An error should be returned if the entry's
126 * \ref RAIL_StateBufferEntry_t::bufferBytes is too small or
127 * the RAIL_StateBufferEntry_t::buffer pointer seems invalid.
128 *
129 * RAIL's internal \ref RAIL_StateBufferHead should prove
130 * sufficient for most applications, providing one (single protocol)
131 * or two (dynamic multiprotocol) buffers preallocated in RAM for
132 * use by \ref RAIL_Init(). This function exists for dynamic
133 * multiprotocol applications that needs more than two protocols, or
134 * that prefer to dynamically allocate RAIL state buffers just prior
135 * to calling \ref RAIL_Init() rather than having them statically
136 * allocated in RAM.
137 */
138 RAIL_Status_t RAIL_AddStateBuffer(RAIL_Handle_t genericRailHandle,
139 RAIL_StateBufferEntry_t *newEntry);
140
141 #endif//DOXYGEN_SHOULD_SKIP_THIS
142
143 /**
144 * Add a 3rd multiprotocol internal state buffer for use by \ref RAIL_Init().
145 *
146 * @param[in] genericRailHandle A generic RAIL instance handle.
147 * @return Status code indicating success of the function call.
148 * An error is returned if the 3rd state buffer was previously added
149 * or this isn't the RAIL multiprotocol library.
150 */
151 RAIL_Status_t RAIL_AddStateBuffer3(RAIL_Handle_t genericRailHandle);
152
153 /**
154 * Add a 4th multiprotocol internal state buffer for use by \ref RAIL_Init().
155 *
156 * @param[in] genericRailHandle A generic RAIL instance handle.
157 * @return Status code indicating success of the function call.
158 * An error is returned if the 4th state buffer was previously added.
159 * or this isn't the RAIL multiprotocol library.
160 */
161 RAIL_Status_t RAIL_AddStateBuffer4(RAIL_Handle_t genericRailHandle);
162
163 /**
164 * Allocate a DMA channel for RAIL to work with.
165 *
166 * @param[in] channel The DMA channel to use when copying memory. If a value of
167 * RAIL_DMA_INVALID is passed, RAIL will stop using any DMA channel.
168 * @return Status code indicating success of the function call.
169 *
170 * To use this API, the application must initialize the DMA engine
171 * on the chip and allocate a DMA channel. This channel will be used
172 * periodically to copy memory more efficiently. Call this function
173 * before RAIL_Init to have the most benefit. If the application needs
174 * to take back control of the DMA channel that RAIL is using, this API may be
175 * called with a channel of RAIL_DMA_INVALID to tell RAIL to stop using DMA.
176 */
177 RAIL_Status_t RAIL_UseDma(uint8_t channel);
178
179 /**
180 * Initialize RAIL.
181 *
182 * @param[in,out] railCfg The configuration and state structure for setting up
183 * the library, which contains memory and other options that RAIL needs.
184 * This structure must be allocated in application global read-write
185 * memory. RAIL may modify fields within or referenced by this structure
186 * during its operation.
187 * @param[in] cb A callback that notifies the application when the radio is
188 * finished initializing and is ready for further configuration. This
189 * callback is useful for potential transceiver products that require a
190 * power up sequence before further configuration is available. After the
191 * callback fires, the radio is ready for additional configuration before
192 * transmit and receive operations.
193 * @return Handle for initialized rail instance or NULL if an
194 * invalid value was passed in the railCfg.
195 *
196 * @note Call this function only once per protocol. If called
197 * again, it will do nothing and return NULL.
198 */
199 RAIL_Handle_t RAIL_Init(RAIL_Config_t *railCfg,
200 RAIL_InitCompleteCallbackPtr_t cb);
201
202 /**
203 * Get RAIL initialization status.
204 *
205 * @return True if the radio has finished initializing and
206 * false otherwise.
207 *
208 * RAIL APIs, e.g., RAIL_GetTime(), which work only if RAIL_Init() has been called,
209 * can use RAIL_IsInitialized() to determine whether RAIL has been initialized or not.
210 */
211 bool RAIL_IsInitialized(void);
212
213 /**
214 * Collect entropy from the radio if available.
215 *
216 * @param[in] railHandle A RAIL instance handle.
217 * @param[out] buffer The buffer to write the collected entropy.
218 * @param[in] bytes The number of bytes to fill in the input buffer.
219 * @return Returns the number of bytes of entropy collected. For
220 * chips that don't support entropy collection, the function returns 0.
221 * Values less than the requested amount may also be returned on platforms
222 * that use entropy pools to collect random data periodically.
223 *
224 * Attempts to fill the provided buffer with the requested number of bytes of
225 * entropy. If the requested number of bytes can't be provided, as many
226 * bytes as possible will be filled and returned. For chips
227 * that do not support this function, 0 bytes are always returned. For
228 * information about the specific mechanism for gathering entropy, see
229 * documentation for the chip family.
230 */
231 uint16_t RAIL_GetRadioEntropy(RAIL_Handle_t railHandle,
232 uint8_t *buffer,
233 uint16_t bytes);
234
235 /** @} */ // end of group General
236
237 /******************************************************************************
238 * PTI
239 *****************************************************************************/
240 /**
241 * @addtogroup PTI Packet Trace (PTI)
242 * @brief Basic APIs to set up and interact with PTI settings
243 * @{
244 */
245
246 /**
247 * Configure PTI pin locations, serial protocols, and baud rates.
248 *
249 * @param[in] railHandle A RAIL instance handle (currently not used).
250 * @param[in] ptiConfig A configuration structure applied to the
251 * relevant PTI registers. A NULL ptiConfig will produce undefined
252 * behavior.
253 * @return Status code indicating success of the function call.
254 *
255 * This method must be called before RAIL_EnablePti() is called.
256 * Although a RAIL handle is included for potential future
257 * expansion of this function, it is currently not used. That is,
258 * there is only one PTI configuration that can be active on a
259 * chip, regardless of the number of protocols (unless the application
260 * updates the configuration upon a protocol switch),
261 * and the configuration is not saved in the RAIL instance. For optimal
262 * future compatibility, pass in a chip-specific handle, such as
263 * \ref RAIL_EFR32_HANDLE.
264 *
265 * PTI should be configured only when the radio is off (idle).
266 *
267 * @note On EFR32 platforms GPIO configuration must be unlocked
268 * (see GPIO->LOCK register) to configure or use PTI.
269 */
270 RAIL_Status_t RAIL_ConfigPti(RAIL_Handle_t railHandle,
271 const RAIL_PtiConfig_t *ptiConfig);
272
273 /**
274 * Get the currently-active PTI configuration.
275 *
276 * @param[in] railHandle A RAIL instance handle (currently not used).
277 * @param[out] ptiConfig A configuration structure filled with the active
278 * PTI configuration.
279 * @return RAIL status indicating success of the function call.
280 *
281 * Although most combinations of configurations can be set, it is safest
282 * to call this method after configuration to confirm which values were
283 * actually set. As in RAIL_ConfigPti, railHandle is not used. This function
284 * always returns the single active PTI configuration regardless of the
285 * active protocol. For optimal future compatibility, pass in a
286 * chip-specific handle, such as \ref RAIL_EFR32_HANDLE.
287 */
288 RAIL_Status_t RAIL_GetPtiConfig(RAIL_Handle_t railHandle,
289 RAIL_PtiConfig_t *ptiConfig);
290
291 /**
292 * Enable Packet Trace Interface (PTI) output of packet data.
293 *
294 * @param[in] railHandle A RAIL instance handle (currently not used).
295 * @param[in] enable PTI is enabled if true; disable if false.
296 * @return RAIL status indicating success of the function call.
297 *
298 * Similarly to having only one PTI configuration per chip,
299 * PTI can only be enabled or disabled for all protocols. It cannot
300 * be individually set to enabled and disabled per protocol
301 * (unless the application switches it when
302 * the protocol switches), and enable/disable is not saved as part of the
303 * RAIL instance. For optimal future compatibility, pass in a chip-specific
304 * handle, such as \ref RAIL_EFR32_HANDLE.
305 *
306 * PTI should be enabled or disabled only when the radio is off (idle).
307 *
308 * @warning On EFR32 platforms GPIO configuration must be unlocked
309 * (see GPIO->LOCK register) to configure or use PTI, otherwise a fault
310 * or assert might occur.
311 * If GPIO configuration locking is desired, PTI must be disabled
312 * beforehand either with this function or with \ref RAIL_ConfigPti()
313 * using \ref RAIL_PTI_MODE_DISABLED.
314 */
315 RAIL_Status_t RAIL_EnablePti(RAIL_Handle_t railHandle,
316 bool enable);
317
318 /**
319 * Set a protocol that RAIL outputs on PTI.
320 *
321 * @param[in] railHandle A RAIL instance handle.
322 * @param[in] protocol The enumeration representing which protocol the node is using.
323 * @return Status code indicating success of the function call.
324 *
325 * The protocol is output via PTI for each packet.
326 * Before any protocol is set, the default value is \ref
327 * RAIL_PTI_PROTOCOL_CUSTOM. Use one of the enumeration values so that
328 * the Network Analyzer can decode the packet.
329 *
330 * @note This function cannot be called unless the radio is currently in the
331 * \ref RAIL_RF_STATE_IDLE or \ref RAIL_RF_STATE_INACTIVE states. For this
332 * reason, call this function early on before starting radio
333 * operations and not changed later.
334 */
335 RAIL_Status_t RAIL_SetPtiProtocol(RAIL_Handle_t railHandle,
336 RAIL_PtiProtocol_t protocol);
337
338 /**
339 * Get the protocol that RAIL outputs on PTI.
340 *
341 * @param[in] railHandle A RAIL instance handle.
342 * @return PTI protocol in use.
343 */
344 RAIL_PtiProtocol_t RAIL_GetPtiProtocol(RAIL_Handle_t railHandle);
345
346 /** @} */ // end of group PTI
347
348 /******************************************************************************
349 * Antenna Control
350 *****************************************************************************/
351 /**
352 * @addtogroup Antenna_Control Antenna Control
353 * @brief Basic APIs to control the antenna functionality
354 * @{
355 */
356 /**
357 * Configure antenna path and pin locations.
358 *
359 * @warning This API must be called before any TX or RX occurs. Otherwise,
360 * the antenna configurations for those functions will not take effect.
361 *
362 * @param[in] railHandle A RAIL instance handle.
363 * @param[in] config A configuration structure applied to the relevant Antenna
364 * Configuration registers. A NULL configuration will produce undefined behavior.
365 * @return Status code indicating success of the function call.
366 *
367 * This function informs RAIL how to select each antenna, but not when.
368 * Antenna selection for receive is controlled by the
369 * \ref RAIL_RxOptions_t::RAIL_RX_OPTION_ANTENNA0 and
370 * \ref RAIL_RxOptions_t::RAIL_RX_OPTION_ANTENNA1 options
371 * (and the \ref RAIL_RxOptions_t::RAIL_RX_OPTION_ANTENNA_AUTO combination).
372 * Antenna selection for transmit is controlled by the
373 * \ref RAIL_TxOptions_t::RAIL_TX_OPTION_ANTENNA0 and
374 * \ref RAIL_TxOptions_t::RAIL_TX_OPTION_ANTENNA1 options.
375 *
376 * Although a RAIL handle is included for potential future
377 * expansion of this function, it is currently not used. That is,
378 * only one antenna configuration can be active on a
379 * chip, regardless of the number of protocols (unless the application
380 * updates the configuration upon a protocol switch),
381 * and the configuration is not saved in the RAIL instance. For optimal
382 * future compatibility, pass in a chip-specific handle, such as
383 * \ref RAIL_EFR32_HANDLE.
384 */
385 RAIL_Status_t RAIL_ConfigAntenna(RAIL_Handle_t railHandle,
386 const RAIL_AntennaConfig_t *config);
387
388 /**
389 * Get the default RF path.
390 *
391 * @param[in] railHandle A RAIL instance handle.
392 * @param[out] rfPath Pointer to RF path.
393 * @return A status code indicating success of the function call.
394 *
395 * If multiple protocols are used, this function returns
396 * \ref RAIL_STATUS_INVALID_STATE if it is called and the given railHandle is
397 * not active. In that case, the caller must attempt to re-call this function later,
398 * for example when \ref RAIL_EVENT_CONFIG_SCHEDULED trigger.
399 */
400 RAIL_Status_t RAIL_GetRfPath(RAIL_Handle_t railHandle, RAIL_AntennaSel_t *rfPath);
401
402 /** @} */ // end of group Antenna_Control
403
404 /******************************************************************************
405 * Radio Configuration
406 *****************************************************************************/
407 /// @addtogroup Radio_Configuration Radio Configuration
408 /// @brief Routines for setting up and querying radio configuration information.
409 ///
410 /// These routines allow for runtime flexibility in the radio
411 /// configuration. Some of the parameters, however, are meant to be generated
412 /// from the radio calculator in Simplicity Studio. The basic code to configure
413 /// the radio from this calculator output looks like the example below.
414 ///
415 /// @code{.c}
416 /// // Associate a specific channel configuration with a particular RAIL instance and
417 /// // load the settings that correspond to the first usable channel.
418 /// RAIL_ConfigChannels(railHandle, channelConfigs[0]);
419 /// @endcode
420 ///
421 /// For more information about the types of parameters that can be changed in
422 /// the other functions and how to use them, see their individual documentation.
423 ///
424 /// @{
425
426 /**
427 * Load a static radio configuration.
428 *
429 * @param[in] railHandle A RAIL instance handle.
430 * @param[in] config A pointer to a radio configuration.
431 * @return Status code indicating success of the function call.
432 *
433 * The configuration passed into this function should be auto-generated
434 * and not manually created or edited. By default, do not call this function
435 * in RAIL 2.x and later unless instructed by Silicon Labs because it
436 * may bypass updating certain RAIL state. In RAIL 2.x and later, the
437 * RAIL_ConfigChannels function applies the default radio configuration
438 * automatically.
439 */
440 RAIL_Status_t RAIL_ConfigRadio(RAIL_Handle_t railHandle,
441 RAIL_RadioConfig_t config);
442
443 /**
444 * Modify the currently configured fixed frame length in bytes.
445 *
446 * @param[in] railHandle A RAIL instance handle.
447 * @param[in] length The expected fixed frame length. A value of 0 is infinite.
448 * A value of RAIL_SETFIXEDLENGTH_INVALID restores the frame's length back to
449 * the length specified by the default frame type configuration.
450 * @return Length configured; The new frame length configured into the hardware
451 * for use. 0 if in infinite mode, or RAIL_SETFIXEDLENGTH_INVALID if the frame
452 * length has not yet been overridden by a valid value.
453 *
454 * Sets the fixed-length configuration for transmit and receive.
455 * Be careful when using this function in receive and transmit as this
456 * function changes the default frame configuration and remains in force until
457 * it is called again with an input value of RAIL_SETFIXEDLENGTH_INVALID. This
458 * function will override any fixed or variable length settings from a radio
459 * configuration.
460 */
461 uint16_t RAIL_SetFixedLength(RAIL_Handle_t railHandle, uint16_t length);
462
463 /**
464 * Configure the channels supported by this device.
465 *
466 * @param[in] railHandle A RAIL instance handle.
467 * @param[in] config A pointer to the channel configuration for your device.
468 * This pointer will be cached in the library so it must
469 * exist for the runtime of the application. Typically, this should be
470 * what is stored in Flash by the configuration tool.
471 * @param[in] cb Function called whenever a radio configuration change occurs.
472 * @return Returns the first available channel in the configuration.
473 *
474 * When configuring channels on EFR32, the radio tuner is reconfigured
475 * based on the frequency and channel spacing in the channel configuration.
476 *
477 * @note config can be NULL to simply register or unregister the cb callback
478 * function when using RAIL internal protocol-specific radio configuration
479 * APIs for BLE, IEEE 802.15.4, or Z-Wave, which lack callback specification.
480 * In this use case, 0 is returned.
481 */
482 uint16_t RAIL_ConfigChannels(RAIL_Handle_t railHandle,
483 const RAIL_ChannelConfig_t *config,
484 RAIL_RadioConfigChangedCallback_t cb);
485
486 /**
487 * Get verbose listing of channel metadata for the current channel configuration.
488 *
489 * @param[in] railHandle A RAIL instance handle.
490 * @param[out] channelMetadata Allocated array that will be populated with
491 * channel metadata.
492 * @param[in,out] length Pointer to the length of the channelMetadata.
493 * This value will be updated to the number of channels written to the array.
494 * @param[in] minChannel Minimum channel number about which to collect data.
495 * @param[in] maxChannel Maximum channel number about which to collect data.
496 * @return Status of the call. \ref RAIL_STATUS_INVALID_PARAMETER means that,
497 * based on the currently active radio configuration, there are more
498 * channels to write than there is space provided in the allocated
499 * channelMetadata. However, the channel metadata that was written is valid.
500 * \ref RAIL_STATUS_INVALID_STATE indicates that the channel configuration
501 * has not been configured. \ref RAIL_STATUS_NO_ERROR indicates complete
502 * success.
503 */
504 RAIL_Status_t RAIL_GetChannelMetadata(RAIL_Handle_t railHandle,
505 RAIL_ChannelMetadata_t *channelMetadata,
506 uint16_t *length,
507 uint16_t minChannel,
508 uint16_t maxChannel);
509
510 /**
511 * Check whether the channel exists in RAIL.
512 *
513 * @param[in] railHandle A RAIL instance handle.
514 * @param[in] channel A channel number to check.
515 * @return Returns RAIL_STATUS_NO_ERROR if channel exists
516 *
517 * Returns RAIL_STATUS_INVALID_PARAMETER if the given channel does not exist
518 * in the channel configuration currently used or RAIL_STATUS_NO_ERROR if the
519 * channel is valid.
520 */
521 RAIL_Status_t RAIL_IsValidChannel(RAIL_Handle_t railHandle,
522 uint16_t channel);
523
524 /**
525 * Cause radio settings associated with a particular channel to be applied to
526 * hardware.
527 *
528 * @param[in] railHandle A RAIL instance handle.
529 * @param[in] channel The channel to prepare for use.
530 * @return \ref RAIL_STATUS_NO_ERROR on success or
531 * \ref RAIL_STATUS_INVALID_PARAMETER if the given channel does not have an
532 * associated channel configuration entry.
533 *
534 * This function walks the channelConfigEntry list and applies the configuration
535 * associated with the specified channel. This function manually
536 * changes channels without starting a TX or RX operation.
537 *
538 * When successful, the radio is idled.
539 * When unsuccessful, the radio state will not be altered.
540 */
541 RAIL_Status_t RAIL_PrepareChannel(RAIL_Handle_t railHandle, uint16_t channel);
542
543 /**
544 * Return the current RAIL channel.
545 *
546 * @param[in] railHandle A RAIL instance handle.
547 * @param[out] channel The channel for which RAIL is currently configured.
548 * @return RAIL_STATUS_NO_ERROR on success or
549 * RAIL_STATUS_INVALID_CALL if the radio is not configured for any channel or
550 * RAIL_STATUS_INVALID_PARAMETER if channel parameter is NULL.
551 *
552 * This function returns the channel most recently specified in API calls that
553 * pass in a channel to tune to, namely \ref RAIL_PrepareChannel,
554 * \ref RAIL_StartTx, \ref RAIL_StartScheduledTx, \ref RAIL_StartCcaCsmaTx,
555 * \ref RAIL_StartCcaLbtTx, \ref RAIL_StartScheduledCcaCsmaTx,
556 * \ref RAIL_StartScheduledCcaLbtTx, \ref RAIL_StartRx, \ref RAIL_ScheduleRx,
557 * \ref RAIL_StartAverageRssi, \ref RAIL_StartTxStream, \ref RAIL_StartTxStreamAlt.
558 * It doesn't follow changes RAIL performs implicitly during channel hopping and
559 * mode switch.
560 */
561 RAIL_Status_t RAIL_GetChannel(RAIL_Handle_t railHandle, uint16_t *channel);
562
563 /**
564 * Return the current RAIL channel.
565 *
566 * @param[in] railHandle A RAIL instance handle.
567 * @param[out] channel The channel for which RAIL is currently configured.
568 * @return RAIL_STATUS_NO_ERROR on success or
569 * RAIL_STATUS_INVALID_CALL if the radio is not configured for any channel or
570 * RAIL_STATUS_INVALID_PARAMETER if channel parameter is NULL.
571 *
572 * This function returns the channel the radio is currently tuned to if the
573 * specified RAIL handle is active. It returns the channel it will be tuned to
574 * during the next protocol switch if the handle is inactive.
575 * The channel returned may be different than what \ref RAIL_GetChannel returns
576 * when channel hopping or mode switch are involved.
577 */
578 RAIL_Status_t RAIL_GetChannelAlt(RAIL_Handle_t railHandle, uint16_t *channel);
579
580 /**
581 * Return the symbol rate for the current PHY.
582 *
583 * @param[in] railHandle A RAIL instance handle.
584 * @return The symbol rate in symbols per second or 0.
585 *
586 * The symbol rate is the rate of symbol changes over the air. For non-DSSS
587 * PHYs, this is the same as the baudrate. For DSSS PHYs, it is the baudrate
588 * divided by the length of a chipping sequence. For more information,
589 * see the modem calculator documentation. If the rate cannot be
590 * calculated, this function returns 0.
591 */
592 uint32_t RAIL_GetSymbolRate(RAIL_Handle_t railHandle);
593
594 #ifndef DOXYGEN_SHOULD_SKIP_THIS
595 /**
596 * Calculate the symbol rate for the current PHY.
597 *
598 * @param[in] railHandle A RAIL instance handle.
599 * @return The symbol rate in symbols per second or 0.
600 *
601 * This function calculates the symbol rate when the radio configuration does
602 * not include that information. In general, this function should be
603 * implemented automatically in the radio configuration as a stub.
604 */
605 uint32_t RAILCb_CalcSymbolRate(RAIL_Handle_t railHandle);
606 #endif
607
608 /**
609 * Return the bit rate for the current PHY.
610 *
611 * @param[in] railHandle A RAIL instance handle.
612 * @return The bit rate in bits per second or 0.
613 *
614 * The bit rate is the effective over-the-air data rate. It does not account
615 * for extra spreading for forward error correction, and so on, but
616 * accounts for modulation schemes, DSSS, and other configurations. For more
617 * information, see the modem calculator documentation. If the rate cannot be
618 * calculated, this function returns 0.
619 */
620 uint32_t RAIL_GetBitRate(RAIL_Handle_t railHandle);
621
622 #ifndef DOXYGEN_SHOULD_SKIP_THIS
623 /**
624 * Calculate the bit rate for the current PHY.
625 *
626 * @param[in] railHandle A RAIL instance handle.
627 * @return The bit rate in bits per second or 0.
628 *
629 * This function calculates the bit rate when the radio configuration does
630 * not include that information. In general, this function should be
631 * implemented automatically in the radio configuration as a stub.
632 */
633 uint32_t RAILCb_CalcBitRate(RAIL_Handle_t railHandle);
634 #endif
635 /**
636 * Set the PA capacitor tune value for transmit and receive.
637 *
638 * @param[in] railHandle A RAIL instance handle.
639 * @param[in] txPaCtuneValue PA Ctune value for TX mode.
640 * @param[in] rxPaCtuneValue PA Ctune value for RX mode.
641 * @return Status code indicating success of the function call.
642 *
643 * Tunes the impedance of the transmit
644 * and receive modes by changing the amount of capacitance at
645 * the PA output.
646 * Changes made to the TX Power configuration, e.g., calling \ref RAIL_ConfigTxPower,
647 * will undo changes made to PA capacitor tune value for transmit and receive
648 * via \ref RAIL_SetPaCTune.
649 */
650 RAIL_Status_t RAIL_SetPaCTune(RAIL_Handle_t railHandle,
651 uint8_t txPaCtuneValue,
652 uint8_t rxPaCtuneValue);
653
654 /**
655 * Get the sync words and their length.
656 *
657 * @param[in] railHandle A RAIL instance handle.
658 * @param[out] syncWordConfig An application-provided non-NULL pointer to store
659 * \ref RAIL_SyncWordConfig_t sync word information.
660 * @return Status code indicating success of the function call.
661 **/
662 RAIL_Status_t RAIL_GetSyncWords(RAIL_Handle_t railHandle,
663 RAIL_SyncWordConfig_t *syncWordConfig);
664
665 /**
666 * Set the selected sync words and their length.
667 *
668 * @param[in] railHandle A RAIL instance handle.
669 * @param[in] syncWordConfig A non-NULL pointer to \ref RAIL_SyncWordConfig_t
670 * specifying the sync words and their length.
671 * The desired length should be between 2 and 32 bits inclusive, however it is
672 * recommended to not change the length below what the PHY syncWord length is
673 * configured to be. Changing the syncWord length, especially to that which is
674 * lower than the default length, may result in a decrease in packet reception
675 * rate or may not work at all.
676 * Other values will result in \ref RAIL_STATUS_INVALID_PARAMETER. The default
677 * syncWord continues to be valid.
678 * @return Status code indicating success of the function call.
679 * When the custom sync word(s) applied by this API are no longer needed, or to
680 * revert to default sync word, calling RAIL_ConfigChannels() will re-establish
681 * the sync words specified in the radio configuration.
682 *
683 * This function will return \ref RAIL_STATUS_INVALID_STATE if called when BLE
684 * has been enabled for this railHandle. When changing sync words in BLE mode,
685 * use \ref RAIL_BLE_ConfigChannelRadioParams instead.
686 **/
687 RAIL_Status_t RAIL_ConfigSyncWords(RAIL_Handle_t railHandle,
688 const RAIL_SyncWordConfig_t *syncWordConfig);
689
690 /** @} */ // end of group Radio_Configuration
691
692 /******************************************************************************
693 * Timing Information
694 *****************************************************************************/
695 /// @addtogroup System_Timing System Timing
696 /// @brief Functionality related to the RAIL timer and general system time.
697 ///
698 /// These functions can be used to get information about the current system time
699 /// or to manipulate the RAIL timer.
700 ///
701 /// The system time returned by RAIL_GetTime() is in the same timebase that is
702 /// used throughout RAIL. Any callbacks or structures that provide a timestamp,
703 /// such as \ref RAIL_RxPacketDetails_t::timeReceived, will use the same timebase
704 /// as will any APIs that accept an absolute time for scheduling their action.
705 /// Throughout the documentation, the timebase is referred to as the RAIL
706 /// timebase. The timebase is currently a value in microseconds from \ref
707 /// RAIL_Init() time, which means that it will wrap every 1.19 hours.
708 /// (`(2^32 - 1) / (3600 sec/hr * 1000000 us/sec)`).
709 ///
710 /// The provided timer is hardware-backed and interrupt-driven. It can be used
711 /// for timing any event in the system, but is especially helpful for
712 /// timing protocol-based state machines and other systems that interact with
713 /// the radio. To avoid processing the expiration in interrupt
714 /// context, leave the cb parameter passed to RAIL_SetTimer() as NULL and poll
715 /// for expiration with the RAIL_IsTimerExpired() function. See below for an
716 /// example of the interrupt driven method of interacting with the timer.
717 ///
718 /// @code{.c}
719 /// void timerCb(RAIL_Handle_t cbArg)
720 /// {
721 /// // Timer callback action
722 /// }
723 ///
724 /// void main(void)
725 /// {
726 /// // Initialize RAIL ...
727 ///
728 /// // Set up a timer for 1 ms from now
729 /// RAIL_SetTimer(railHandle, 1000, RAIL_TIME_RELATIVE, &timerCb);
730 ///
731 /// // Run main loop
732 /// while(1);
733 /// }
734 /// @endcode
735 ///
736 /// If multiple software timers are needed to be run off of the one available
737 /// hardware timer, enable a software multiplexing layer within RAIL
738 /// using the \ref RAIL_ConfigMultiTimer() function. This will allow you to
739 /// set up as many timers as you want using the RAIL_*MultiTimer() functions. See
740 /// the example below for using the multitimer functionality.
741 ///
742 /// @code{.c}
743 /// // Declare timer structures in global space or somewhere that will exist
744 /// // until the callback has fired
745 /// RAIL_MultiTimer_t tmr1, tmr2;
746 ///
747 /// void timerCb(RAIL_MultiTimer_t *tmr,
748 /// RAIL_Time_t expectedTimeOfEvent,
749 /// void *cbArg)
750 /// {
751 /// if (tmr == tmr1) {
752 /// // Timer 1 action
753 /// } else {
754 /// // Timer 2 action
755 /// }
756 /// }
757 ///
758 /// void main(void)
759 /// {
760 /// // Initialize RAIL ...
761 ///
762 /// RAIL_ConfigMultiTimer(true);
763 ///
764 /// // Set up one timer for 1 ms from now and one at time 2000000 in the RAIL
765 /// // timebase
766 /// RAIL_SetMultiTimer(&tmr1, 1000, RAIL_TIME_RELATIVE, &timerCb, NULL);
767 /// RAIL_SetMultiTimer(&tmr2, 2000000, RAIL_TIME_ABSOLUTE, &timerCb, NULL);
768 ///
769 /// // Run main loop
770 /// while(1);
771 /// }
772 /// @endcode
773 ///
774 /// @{
775
776 /**
777 * Get the current RAIL time.
778 *
779 * @return Returns the RAIL timebase in microseconds. Note that this wraps
780 * after about 1.19 hours since it's stored in a 32 bit value.
781 *
782 * Returns the current time in the RAIL timebase (microseconds). It can be
783 * used to compare with packet timestamps or to schedule transmits.
784 */
785 RAIL_Time_t RAIL_GetTime(void);
786
787 /**
788 * Set the current RAIL time.
789 *
790 * @warning Use this API only for testing purposes or in
791 * very limited circumstances during RAIL Timer Synchronization.
792 * Undefined behavior can result by calling it in multiprotocol or
793 * when the radio is not idle or timed events are active. Applications
794 * using \ref RAIL_GetTime() may not be designed for discontinuous
795 * changes to the RAIL time base.
796 *
797 * @param[in] time Set the RAIL timebase to this value in microseconds.
798 * @return Status code indicating the success of the function call.
799 *
800 * Sets the current time in the RAIL timebase in microseconds.
801 */
802 RAIL_Status_t RAIL_SetTime(RAIL_Time_t time);
803
804 /**
805 * Blocking delay routine for a specified number of microseconds.
806 *
807 * @param[in] microseconds Delay duration in microseconds.
808 * @return Status code indicating success of the function call.
809 *
810 * Use this RAIL API only for short blocking delays because it has less overhead
811 * than calling RAIL_GetTime() in a loop.
812 * @note
813 * Passing large delay values may give unpredictable results or trigger
814 * the Watchdog reset.
815 * \n Also, this function will start the clocks required for the RAIL timebase if they
816 * are not running, except between \ref RAIL_Sleep() and \ref RAIL_Wake()
817 * where the timer must remain stopped.
818 * \n Interrupts are not disabled during the delay, so the delay may be longer if an
819 * interrupt extends beyond the delay duration.
820 */
821 RAIL_Status_t RAIL_DelayUs(RAIL_Time_t microseconds);
822
823 /**
824 * Schedule a timer to expire using the RAIL timebase.
825 *
826 * @param[in] railHandle A RAIL instance handle.
827 * @param[in] time The timer's expiration time in the RAIL timebase.
828 * @param[in] mode Indicates whether the time argument is an absolute
829 * RAIL time or relative to the current RAIL time. Specifying mode
830 * \ref RAIL_TIME_DISABLED is the same as calling RAIL_CancelTimer().
831 * @param[in] cb The callback for RAIL to call when the timer expires.
832 * @return RAIL_STATUS_NO_ERROR on success and
833 * RAIL_STATUS_INVALID_PARAMETER if the timer can't be scheduled.
834 *
835 * Configures a timer to expire after a period in the RAIL timebase.
836 * This timer can be used to implement low-level protocol features.
837 *
838 * @warning Attempting to schedule the timer when it is
839 * still running from a previous request is bad practice, unless the cb
840 * callback is identical to that used in the previous request, in which case
841 * the timer is rescheduled to the new time. Note that if the original timer
842 * expires as it is being rescheduled, the callback may or may not occur. It
843 * is generally good practice to cancel a running timer before rescheduling
844 * it to minimize ambiguity.
845 */
846 RAIL_Status_t RAIL_SetTimer(RAIL_Handle_t railHandle,
847 RAIL_Time_t time,
848 RAIL_TimeMode_t mode,
849 RAIL_TimerCallback_t cb);
850
851 /**
852 * Return the absolute time that the RAIL timer was configured to expire.
853 *
854 * @param[in] railHandle A RAIL instance handle.
855 * @return The absolute time that this timer was set to expire.
856 *
857 * Provides the absolute time regardless of the \ref RAIL_TimeMode_t that
858 * was passed into \ref RAIL_SetTimer. Note that the time might be in the
859 * past if the timer has already expired. The return value is undefined if the
860 * timer was never set.
861 */
862 RAIL_Time_t RAIL_GetTimer(RAIL_Handle_t railHandle);
863
864 /**
865 * Stop the currently scheduled RAIL timer.
866 *
867 * @param[in] railHandle A RAIL instance handle.
868 * Cancels the timer. If this function is called before the timer expires,
869 * the cb callback specified in the earlier RAIL_SetTimer() call will never
870 * be called.
871 */
872 void RAIL_CancelTimer(RAIL_Handle_t railHandle);
873
874 /**
875 * Check whether the RAIL timer has expired.
876 *
877 * @param[in] railHandle A RAIL instance handle.
878 * @return True if the previously scheduled timer has expired and false
879 * otherwise.
880 *
881 * Polling with this function is an alternative to the callback.
882 */
883 bool RAIL_IsTimerExpired(RAIL_Handle_t railHandle);
884
885 /**
886 * Check whether the RAIL timer is currently running.
887 *
888 * @param[in] railHandle A RAIL instance handle.
889 * @return Returns true if the timer is running and false if
890 * the timer has expired or was never set.
891 */
892 bool RAIL_IsTimerRunning(RAIL_Handle_t railHandle);
893
894 /**
895 * Configure the RAIL software timer feature.
896 *
897 * @param[in] enable Enables/disables the RAIL multitimer.
898 * @return True if the multitimer was successfully enabled/disabled, false
899 * otherwise.
900 *
901 * Turning this on will add a software timer layer above the physical RAIL timer
902 * so that the user can have as many timers as desired. It is not necessary to
903 * call this function if the MultiTimer APIs are not used.
904 *
905 * @note This function must be called before calling \ref RAIL_SetMultiTimer.
906 * This function is a no-op on multiprotocol as this layer is already used
907 * under the hood.
908 * Do not call this function while the RAIL timer is running.
909 * Call \ref RAIL_IsTimerRunning before enabling/disabling the multitimer.
910 * If the multitimer is not needed, do not call this function to
911 * allow the multitimer code to be dead stripped. If the multitimer is
912 * enabled for use, the multitimer and timer APIs can both be used.
913 * However, no timer can be in use while this function is being called.
914 */
915 bool RAIL_ConfigMultiTimer(bool enable);
916
917 /**
918 * Start a multitimer instance.
919 *
920 * @note
921 * It is legal to start an already running timer. If this is done, the timer
922 * will first be stopped before the new configuration is applied.
923 * If expirationTime is 0, the callback is called
924 * immediately.
925 *
926 * @param[in,out] tmr A pointer to the timer instance to start.
927 * @param[in] expirationTime A time when the timer is set to expire.
928 * @param[in] expirationMode Select mode of expirationTime. See \ref
929 * RAIL_TimeMode_t.
930 * @param[in] callback A function to call on timer expiry. See \ref
931 * RAIL_MultiTimerCallback_t. NULL is a legal value.
932 * @param[in] cbArg An extra callback function parameter for the user application.
933 *
934 * @return
935 * \ref RAIL_STATUS_NO_ERROR on success.@n
936 * \ref RAIL_STATUS_INVALID_PARAMETER if tmr has an illegal value or if
937 * timeout is in the past.
938 */
939 RAIL_Status_t RAIL_SetMultiTimer(RAIL_MultiTimer_t *tmr,
940 RAIL_Time_t expirationTime,
941 RAIL_TimeMode_t expirationMode,
942 RAIL_MultiTimerCallback_t callback,
943 void *cbArg);
944
945 /**
946 * Stop the currently scheduled RAIL multitimer.
947 *
948 * @param[in,out] tmr A RAIL timer instance handle.
949 *
950 * @return
951 * true if the timer was successfully canceled.
952 * false if the timer was not running.
953 *
954 * Cancels the timer. If this function is called before the timer expires,
955 * the cb callback specified in the earlier RAIL_SetTimer() call will never
956 * be called.
957 */
958 bool RAIL_CancelMultiTimer(RAIL_MultiTimer_t *tmr);
959
960 /**
961 * Check if a given timer is running.
962 *
963 * @param[in] tmr A pointer to the timer structure to query.
964 *
965 * @return
966 * true if the timer is running.
967 * false if the timer is not running.
968 */
969 bool RAIL_IsMultiTimerRunning(RAIL_MultiTimer_t *tmr);
970
971 /**
972 * Check if a given timer has expired.
973 *
974 * @param[in] tmr A pointer to the timer structure to query.
975 *
976 * @return
977 * true if the timer is expired.
978 * false if the timer is running.
979 */
980 bool RAIL_IsMultiTimerExpired(RAIL_MultiTimer_t *tmr);
981
982 /**
983 * Get time left before a given timer instance expires.
984 *
985 * @param[in] tmr A pointer to the timer structure to query.
986 * @param[in] timeMode Indicates how the function provides the time
987 * remaining. By choosing \ref
988 * RAIL_TimeMode_t::RAIL_TIME_ABSOLUTE, the function returns the
989 * absolute expiration time, and by choosing \ref
990 * RAIL_TimeMode_t::RAIL_TIME_DELAY, the function returns the
991 * amount of time remaining before the timer's expiration.
992 *
993 * @return
994 * Time left expressed in RAIL's time units.
995 * 0 if the soft timer is not running or has already expired.
996 */
997 RAIL_Time_t RAIL_GetMultiTimer(RAIL_MultiTimer_t *tmr,
998 RAIL_TimeMode_t timeMode);
999
1000 /** @} */ // end of group System_Timing
1001
1002 /******************************************************************************
1003 * Sleep APIs
1004 *****************************************************************************/
1005 /// @addtogroup Sleep
1006 /// @brief These APIs help when putting the system to an EM2/EM3/EM4 sleep
1007 /// states where the high frequency clock is disabled.
1008 /// @{
1009 ///
1010 /// The RAIL library has its own timebase and the ability to schedule operations
1011 /// into the future. When going to any power mode that disables the HF clock
1012 /// used for the radio (EM2/EM3/EM4), it is important that this timebase is
1013 /// synchronized to a running LFCLK and the chip is set to wake up before the
1014 /// next scheduled event.
1015 /// If RAIL has not been configured to use the power manager,
1016 /// \ref RAIL_Sleep and \ref RAIL_Wake must be called for performing this
1017 /// synchronization.
1018 /// If RAIL has been configured to use the power manager,
1019 /// \ref RAIL_InitPowerManager, it will automatically perform timer
1020 /// synchronization based on the selected \ref RAIL_TimerSyncConfig_t. Calls to
1021 /// \ref RAIL_Sleep and \ref RAIL_Wake are unsupported in such a scenario.
1022 ///
1023 /// Following example code snippets demonstrate synchronizing the timebase
1024 /// with and without timer synchronization:
1025 ///
1026 /// <b>Sleep with timer synchronization:</b>
1027 ///
1028 /// When sleeping with timer synchronization, you must first get the required
1029 /// LFCLK up and running and leave it running across sleep so that the high
1030 /// frequency clock that drives the RAIL time base can be synchronized to it.
1031 /// The \ref RAIL_Sleep() API will also set up a wake event on the timer to wake
1032 /// up wakeupTime before the next timer event so that it can run successfully.
1033 /// See the \ref efr32_main sections on Low-Frequency Clocks and RAIL Timer
1034 /// Synchronization for more setup details.
1035 ///
1036 /// This is useful when maintaining packet timestamps
1037 /// across sleep or use the scheduled RX/TX APIs while sleeping in between. It
1038 /// does take more time and code to do the synchronization. If your
1039 /// application does not need this, it should be avoided.
1040 ///
1041 /// Example (without Power Manager):
1042 /// @code{.c}
1043 /// #include <rail.h>
1044 /// #include <rail_types.h>
1045 ///
1046 /// extern RAIL_Handle_t railHandle;
1047 /// // Wakeup time for your crystal/board/chip combination
1048 /// extern uint32_t wakeupTime;
1049 ///
1050 /// void main(void) {
1051 /// RAIL_Status_t status;
1052 /// bool shouldSleep = false;
1053 ///
1054 /// // This function depends on your board/chip but it must enable the LFCLK
1055 /// // you intend to use for RTCC sync before we configure sleep as that function
1056 /// // will attempt to auto detect the clock.
1057 /// BoardSetupLFCLK()
1058 ///
1059 /// // Configure sleep for timer synchronization
1060 /// status = RAIL_ConfigSleep(railHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
1061 /// assert(status == RAIL_STATUS_NO_ERROR);
1062 ///
1063 /// // Application main loop
1064 /// while(1) {
1065 /// // ... do normal app stuff and set shouldSleep to true when we want to
1066 /// // sleep
1067 /// if (shouldSleep) {
1068 /// bool sleepAllowed = false;
1069 ///
1070 /// // Go critical to assess sleep decisions
1071 /// CORE_ENTER_CRITICAL();
1072 /// if (RAIL_Sleep(wakeupTime, &sleepAllowed) != RAIL_STATUS_NO_ERROR) {
1073 /// printf("Error trying to go to sleep!");
1074 /// CORE_EXIT_CRITICAL();
1075 /// continue;
1076 /// }
1077 /// if (sleepAllowed) {
1078 /// // Go to sleep
1079 /// }
1080 /// // Wakeup and sync the RAIL timebase back up
1081 /// RAIL_Wake(0);
1082 /// CORE_EXIT_CRITICAL();
1083 /// }
1084 /// }
1085 /// }
1086 /// @endcode
1087 ///
1088 /// Example (with Power Manager):
1089 /// @code{.c}
1090 /// #include <rail.h>
1091 /// #include <rail_types.h>
1092 /// #include <sl_power_manager.h>
1093 ///
1094 /// extern RAIL_Handle_t railHandle;
1095 ///
1096 /// void main(void) {
1097 /// RAIL_Status_t status;
1098 /// bool shouldSleep = false;
1099 ///
1100 /// // This function depends on your board/chip but it must enable the LFCLK
1101 /// // you intend to use for RTCC sync before we configure sleep as that function
1102 /// // will attempt to auto detect the clock.
1103 /// BoardSetupLFCLK();
1104 /// // Configure sleep for timer synchronization
1105 /// status = RAIL_ConfigSleep(railHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
1106 /// assert(status == RAIL_STATUS_NO_ERROR);
1107 /// // Initialize application-level power manager service
1108 /// sl_power_manager_init();
1109 /// // Initialize RAIL library's use of the power manager
1110 /// RAIL_InitPowerManager();
1111 ///
1112 /// // Application main loop
1113 /// while(1) {
1114 /// // ... do normal app stuff and set shouldSleep to true when we want to
1115 /// // sleep
1116 /// if (shouldSleep) {
1117 /// // Let the CPU go to sleep if the system allows it.
1118 /// sl_power_manager_sleep();
1119 /// }
1120 /// }
1121 /// }
1122 /// @endcode
1123 ///
1124 /// RAIL APIs such as, \ref RAIL_StartScheduledTx, \ref RAIL_ScheduleRx,
1125 /// \ref RAIL_SetTimer, \ref RAIL_SetMultiTimer can be used to schedule periodic
1126 /// wakeups to perform a scheduled operation. The call to
1127 /// sl_power_manager_sleep() in the main loop ensures that the device sleeps
1128 /// until the scheduled operation is due.
1129 /// Upon completion, each instantaneous or scheduled RX/TX operation will
1130 /// indicate radio busy to the power manager to allow the application to
1131 /// service the RAIL event and perform subsequent operations before going to
1132 /// sleep. Therefore, it is important that the application idle the radio by either
1133 /// calling \ref RAIL_Idle or \ref RAIL_YieldRadio.
1134 /// If the radio transitions to RX after an RX or TX operation,
1135 /// always call \ref RAIL_Idle in order transition to a lower sleep state.
1136 /// If the radio transitions to idle after an RX or TX operation,
1137 /// \ref RAIL_YieldRadio should suffice in indicating to the power manager
1138 /// that the radio is no longer busy and the device can sleep.
1139 ///
1140 /// The following example shows scheduling periodic TX on getting a TX completion
1141 /// event:
1142 /// @code{.c}
1143 /// void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events) {
1144 /// // Omitting other event handlers
1145 /// if (events & RAIL_EVENTS_TX_COMPLETION) {
1146 /// // Schedule the next TX.
1147 /// RAIL_ScheduleTxConfig_t config = {
1148 /// .when = (RAIL_Time_t)parameters->startTime,
1149 /// .mode = (RAIL_TimeMode_t)parameters->startTimeMode
1150 /// };
1151 /// (void)RAIL_StartScheduledTx(radio.handle, channel, 0, &config, NULL);
1152 /// }
1153 /// }
1154 /// @endcode
1155 ///
1156 /// @note The above code assumes that RAIL automatic state transitions after TX
1157 /// are idle. Set \ref RAIL_SetTxTransitions to ensure the right state
1158 /// transitions. Radio must be idle for the device to enter EM2 or lower
1159 /// energy mode.
1160 ///
1161 /// @note When using the power manager, usage of \ref RAIL_YieldRadio in
1162 /// single protocol RAIL is similar to its usage in multiprotocol RAIL.
1163 /// See \ref rail_radio_scheduler_yield for more details.
1164 ///
1165 /// @note Back to back scheduled operations do not require an explicit call to
1166 /// \ref RAIL_YieldRadio if the radio transitions to idle.
1167 ///
1168 /// <b>Sleep without timer synchronization:</b>
1169 ///
1170 /// When sleeping without timer synchronization, you are free to enable only the
1171 /// LFCLKs and wake sources required by the application. RAIL will not attempt
1172 /// to configure any wake events and may miss anything that occurs over sleep.
1173 ///
1174 /// This is useful when your application does not care about
1175 /// packet timestamps or scheduling operations accurately over sleep.
1176 ///
1177 /// Example (without Power Manager):
1178 /// @code{.c}
1179 /// #include <rail.h>
1180 /// #include <rail_types.h>
1181 ///
1182 /// extern RAIL_Handle_t railHandle;
1183 ///
1184 /// void main(void) {
1185 /// RAIL_Status_t status;
1186 /// bool shouldSleep = false;
1187 ///
1188 /// // Configure sleep for timer synchronization
1189 /// status = RAIL_ConfigSleep(railHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED);
1190 /// assert(status == RAIL_STATUS_NO_ERROR);
1191 ///
1192 /// // Application main loop
1193 /// while(1) {
1194 /// // ... do normal app stuff and set shouldSleep to true when we want to
1195 /// // sleep
1196 /// if (shouldSleep) {
1197 /// bool sleepAllowed = false;
1198 /// uint32_t sleepTime = 0;
1199 ///
1200 /// // Go critical to assess sleep decisions
1201 /// CORE_ENTER_CRITICAL();
1202 /// if (RAIL_Sleep(0, &sleepAllowed) != RAIL_STATUS_NO_ERROR) {
1203 /// printf("Error trying to go to sleep!");
1204 /// CORE_EXIT_CRITICAL();
1205 /// continue;
1206 /// }
1207 /// if (sleepAllowed) {
1208 /// // Go to sleep and optionally update sleepTime to the correct value
1209 /// // in microseconds
1210 /// }
1211 /// // Wakeup and sync the RAIL timebase back up
1212 /// RAIL_Wake(sleepTime);
1213 /// CORE_EXIT_CRITICAL();
1214 /// }
1215 /// }
1216 /// }
1217 /// @endcode
1218 ///
1219 /// Example (with Power Manager):
1220 /// @code{.c}
1221 /// #include <rail.h>
1222 /// #include <rail_types.h>
1223 /// #include <sl_power_manager.h>
1224 ///
1225 /// extern RAIL_Handle_t railHandle;
1226 ///
1227 /// void main(void) {
1228 /// RAIL_Status_t status;
1229 /// bool shouldSleep = false;
1230 ///
1231 /// // This function depends on your board/chip but it must enable the LFCLK
1232 /// // you intend to use for RTCC sync before we configure sleep as that function
1233 /// // will attempt to auto detect the clock.
1234 /// BoardSetupLFCLK();
1235 /// // Configure sleep for timer synchronization
1236 /// status = RAIL_ConfigSleep(railHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED);
1237 /// assert(status == RAIL_STATUS_NO_ERROR);
1238 /// // Initialize application-level power manager service
1239 /// sl_power_manager_init();
1240 /// // Initialize RAIL library's use of the power manager
1241 /// RAIL_InitPowerManager();
1242 ///
1243 /// // Application main loop
1244 /// while(1) {
1245 /// // ... do normal app stuff and set shouldSleep to true when we want to
1246 /// // sleep
1247 /// if (shouldSleep) {
1248 /// // Let the CPU go to sleep if the system allows it.
1249 /// sl_power_manager_sleep();
1250 /// }
1251 /// }
1252 /// }
1253 /// @endcode
1254 /**
1255 * Configure RAIL timer synchronization. This function is optional to implement.
1256 *
1257 * @param[in,out] timerSyncConfig A pointer to the \ref RAIL_TimerSyncConfig_t
1258 * structure containing the configuration parameters for timer sync. The
1259 * \ref RAIL_TimerSyncConfig_t::sleep field is ignored in this call.
1260 *
1261 * This function is called during \ref RAIL_ConfigSleep to allow an application
1262 * to configure the PRS and RTCC channels used for timer sync to values other
1263 * than their defaults. The default channels are populated in timerSyncConfig and
1264 * can be overwritten by the application. If this function is not implemented by the
1265 * application, a default implementation from within the RAIL library will be used
1266 * that simply maintains the default channel values in timerSyncConfig.
1267 *
1268 * If an unsupported channel is selected by the application, \ref RAIL_ConfigSleep
1269 * will return \ref RAIL_STATUS_INVALID_PARAMETER.
1270 *
1271 * @code{.c}
1272 * void RAILCb_ConfigSleepTimerSync(RAIL_TimerSyncConfig_t *timerSyncConfig)
1273 * {
1274 * timerSyncConfig->prsChannel = MY_TIMERSYNC_PRS_CHANNEL;
1275 * timerSyncConfig->rtccChannel = MY_TIMERSYNC_RTCC_CHANNEL;
1276 * }
1277 * @endcode
1278 */
1279 void RAILCb_ConfigSleepTimerSync(RAIL_TimerSyncConfig_t *timerSyncConfig);
1280
1281 /**
1282 * Initialize RAIL timer synchronization.
1283 *
1284 * @param[in] railHandle A RAIL instance handle.
1285 * @param[in] sleepConfig A sleep configuration.
1286 *
1287 * @return Status code indicating success of the function call.
1288 */
1289 RAIL_Status_t RAIL_ConfigSleep(RAIL_Handle_t railHandle,
1290 RAIL_SleepConfig_t sleepConfig);
1291
1292 /**
1293 * Initialize RAIL timer synchronization.
1294 *
1295 * @param[in] railHandle A RAIL instance handle.
1296 * @param[in] syncConfig A pointer to the timer synchronization configuration.
1297 *
1298 * The default structure used to enable timer synchronization across sleep is
1299 * \ref RAIL_TIMER_SYNC_DEFAULT.
1300 *
1301 * @return Status code indicating success of the function call.
1302 */
1303 RAIL_Status_t RAIL_ConfigSleepAlt(RAIL_Handle_t railHandle,
1304 RAIL_TimerSyncConfig_t *syncConfig);
1305
1306 /**
1307 * Stop the RAIL timer and prepare RAIL for sleep.
1308 *
1309 * @param[in] wakeupProcessTime Time in microseconds that the application and
1310 * hardware need to recover from sleep state.
1311 * @param[out] deepSleepAllowed
1312 * true - system can go to deep sleep.
1313 * false - system should not go to deep sleep. Deep sleep should be blocked
1314 * in this case.
1315 *
1316 * @return Status code indicating success of the function call.
1317 *
1318 * @warning The active RAIL configuration must be idle to enable sleep.
1319 *
1320 * @note This API must not be called if RAIL Power Manager is initialized.
1321 */
1322 RAIL_Status_t RAIL_Sleep(uint16_t wakeupProcessTime, bool *deepSleepAllowed);
1323
1324 /**
1325 * Wake RAIL from sleep and restart the RAIL timer.
1326 *
1327 * @param[in] elapsedTime Add the sleep duration to the RAIL timer
1328 * before restarting the RAIL timer.
1329 *
1330 * @return Status code indicating success of the function call.
1331 *
1332 * If the timer sync was enabled by \ref RAIL_ConfigSleep, synchronize the RAIL
1333 * timer using an alternate timer. Otherwise, add elapsedTime to the RAIL
1334 * timer.
1335 *
1336 * @note This API must not be called if RAIL Power Manager is initialized.
1337 */
1338 RAIL_Status_t RAIL_Wake(RAIL_Time_t elapsedTime);
1339
1340 /**
1341 * Initialize RAIL Power Manager.
1342 *
1343 * @return Status code indicating success of the function call.
1344 *
1345 * @note Call this function only when the application is built
1346 * and initialized with Power Manager plugin.
1347 * RAIL will perform timer synchronization, upon transitioning from EM2 or lower
1348 * to EM1 or higher energy mode or vice-versa, in the Power Manager EM
1349 * transition callback. Since EM transition callbacks are not called in a
1350 * deterministic order, it is suggested to not call any RAIL time dependent APIs
1351 * in an EM transition callback.
1352 */
1353 RAIL_Status_t RAIL_InitPowerManager(void);
1354
1355 /**
1356 * Stop the RAIL Power Manager.
1357 *
1358 * @return Status code indicating success of the function call.
1359 *
1360 * @note The active RAIL configuration must be idle to disable radio
1361 * power manager and there should be no outstanding requirements by
1362 * radio power manager.
1363 */
1364 RAIL_Status_t RAIL_DeinitPowerManager(void);
1365
1366 /** @} */ // end of group Sleep
1367
1368 /******************************************************************************
1369 * Events
1370 *****************************************************************************/
1371 /**
1372 * @addtogroup Events
1373 * @brief APIs related to events
1374 * @{
1375 */
1376
1377 /**
1378 * Configure radio events.
1379 *
1380 * @param[in] railHandle A RAIL instance handle.
1381 * @param[in] mask A bitmask of events to configure.
1382 * @param[in] events A bitmask of events to trigger \ref RAIL_Config_t::eventsCallback
1383 * For a full list of available callbacks, see
1384 * RAIL_EVENT_* set of defines.
1385 * @return Status code indicating success of the function call.
1386 *
1387 * Sets up which radio interrupts generate a RAIL event. The full list of
1388 * options is in \ref RAIL_Events_t.
1389 */
1390 RAIL_Status_t RAIL_ConfigEvents(RAIL_Handle_t railHandle,
1391 RAIL_Events_t mask,
1392 RAIL_Events_t events);
1393
1394 /** @} */ // end of group Events
1395
1396 /******************************************************************************
1397 * Data Management
1398 *****************************************************************************/
1399 /// @addtogroup Data_Management Data Management
1400 /// @brief Data management functions
1401 ///
1402 /// These functions allow the application to choose how data is presented to
1403 /// the application. RAIL provides data in a packet-based method or in a
1404 /// FIFO-based method. As originally conceived,
1405 /// \ref RAIL_DataMethod_t::PACKET_MODE was designed for handling packets
1406 /// that fit within RAIL's FIFOs while \ref RAIL_DataMethod_t::FIFO_MODE
1407 /// was designed for handling packets larger than RAIL's FIFOs could hold.
1408 /// Conceptually it is still useful to think of these modes this way, but
1409 /// functionally their distinction has become blurred by improvements in
1410 /// RAIL's flexibility -- applications now have much more control over both
1411 /// receive and transmit FIFO sizes, and the FIFO-management and threshold
1412 /// APIs and related events are no longer restricted to \ref
1413 /// RAIL_DataMethod_t::FIFO_MODE operation but can be used in \ref
1414 /// RAIL_DataMethod_t::PACKET_MODE too.
1415 ///
1416 /// The application can configure RAIL data management through
1417 /// RAIL_ConfigData(). This function allows the application to specify the type
1418 /// of radio data (\ref RAIL_TxDataSource_t and \ref RAIL_RxDataSource_t) and
1419 /// the method of interacting with data (\ref RAIL_DataMethod_t). By default,
1420 /// RAIL configures TX and RX both with packet data source and \ref
1421 /// RAIL_DataMethod_t::PACKET_MODE.
1422 ///
1423 /// For transmit, \ref RAIL_DataMethod_t::PACKET_MODE and \ref
1424 /// RAIL_DataMethod_t::FIFO_MODE are functionally the same:
1425 /// - When not actively transmitting, load a packet's initial transmit
1426 /// data using RAIL_WriteTxFifo() with reset set to true. Alternatively
1427 /// this data copying can be avoided by changing the transmit FIFO to an
1428 /// already-loaded section of memory with \ref RAIL_SetTxFifo().
1429 /// - When actively transmitting, load remaining transmit data with
1430 /// RAIL_WriteTxFifo() with reset set to false.
1431 /// - If transmit packets exceed the FIFO size, set the transmit FIFO
1432 /// threshold through RAIL_SetTxFifoThreshold(). The \ref
1433 /// RAIL_Config_t::eventsCallback with \ref RAIL_EVENT_TX_FIFO_ALMOST_EMPTY
1434 /// will occur telling the application to load more TX packet data, if
1435 /// needed, to prevent a \ref RAIL_EVENT_TX_UNDERFLOW event from occurring.
1436 /// One can get how much space is available in the transmit FIFO for more
1437 /// transmit data through RAIL_GetTxFifoSpaceAvailable().
1438 /// - After transmit completes, the transmit FIFO can be manually reset
1439 /// with RAIL_ResetFifo(), but this should rarely be necessary.
1440 ///
1441 /// The transmit FIFO is specified by the application and its size is
1442 /// the value returned from the most recent call to RAIL_SetTxFifo().
1443 /// The transmit FIFO is edge-based in that it only provides the \ref
1444 /// RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event once when the threshold is crossed
1445 /// in the emptying direction.
1446 ///
1447 /// For receive, the distinction between \ref RAIL_DataMethod_t::PACKET_MODE
1448 /// and \ref RAIL_DataMethod_t::FIFO_MODE basically boils down to how
1449 /// unsuccessfully-received packets are handled. In \ref
1450 /// RAIL_DataMethod_t::PACKET_MODE, data from such packets is automatically
1451 /// rolled back as if the packet was never received, while in \ref
1452 /// RAIL_DataMethod_t::FIFO_MODE, rollback does not occur putting more onus
1453 /// on the application to deal with that data.
1454 ///
1455 /// In receive \ref RAIL_DataMethod_t::PACKET_MODE data management:
1456 /// - Packet lengths are determined from the Radio Configurator configuration
1457 /// and can be read out at the end using \ref RAIL_GetRxPacketInfo().
1458 /// - Received packet data is made available on successful packet completion
1459 /// via \ref RAIL_Config_t::eventsCallback with \ref
1460 /// RAIL_EVENT_RX_PACKET_RECEIVED which can then use RAIL_GetRxPacketInfo()
1461 /// and RAIL_GetRxPacketDetailsAlt() to access packet information and
1462 /// RAIL_PeekRxPacket() to access packet data.
1463 /// - Filtered, Aborted, or FrameError received packet data is automatically
1464 /// rolled back (dropped) without the application needing to worry about
1465 /// consuming it.
1466 /// The application can choose to not even be bothered with the events
1467 /// related to such packets: \ref RAIL_EVENT_RX_ADDRESS_FILTERED,
1468 /// \ref RAIL_EVENT_RX_PACKET_ABORTED, or \ref RAIL_EVENT_RX_FRAME_ERROR.
1469 ///
1470 /// In receive \ref RAIL_DataMethod_t::FIFO_MODE data management:
1471 /// - Packet Lengths are determined from the Radio Configurator configuration
1472 /// or by application knowledge of packet payload structure.
1473 /// - Received data can be retrieved prior to packet completion through
1474 /// RAIL_ReadRxFifo() and is never rolled back on Filtered, Aborted, or
1475 /// FrameError packets. The application should enable and handle these
1476 /// events so it can flush any packet data it's already retrieved.
1477 /// - After packet completion, remaining packet data for Filtered, Aborted,
1478 /// or FrameError packets remains in the FIFO and the appropriate event is
1479 /// triggered to the user. This data may be consumed in the callback unlike
1480 /// in packet mode where it is automatically rolled back. At the end of the
1481 /// callback all remaining data in the FIFO will be cleaned up as usual.
1482 /// Keep in mind that RAIL_GetRxPacketDetailsAlt() provides packet detailed
1483 /// information only for successfully received packets.
1484 ///
1485 /// Common receive data management features:
1486 /// - Set the receive FIFO threshold through RAIL_SetRxFifoThreshold(). The
1487 /// \ref RAIL_Config_t::eventsCallback with \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL
1488 /// will occur telling the application to consume some RX packet data to
1489 /// prevent a \ref RAIL_EVENT_RX_FIFO_OVERFLOW event from occurring.
1490 /// - Get receive FIFO count information through
1491 /// RAIL_GetRxPacketInfo(\ref RAIL_RX_PACKET_HANDLE_NEWEST)
1492 /// (or RAIL_GetRxFifoBytesAvailable()).
1493 /// - After receive completes and all its data has been consumed, the receive
1494 /// FIFO can be manually reset with RAIL_ResetFifo(), though this should
1495 /// rarely be necessary and should only be done with the radio idle.
1496 ///
1497 /// When trying to determine an appropriate threshold, the application needs
1498 /// to know the size of each FIFO. The default receive FIFO is internal to RAIL
1499 /// with a size of 512 bytes. This can be changed, however, using
1500 /// \ref RAIL_SetRxFifo() and the default may be removed entirely by calling
1501 /// this from the RAILCb_SetupRxFifo() callback. The receive FIFO event is
1502 /// level-based in that the \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL event will
1503 /// constantly pend if the threshold is exceeded. This normally means that
1504 /// inside this event's callback, the application should empty enough of the FIFO
1505 /// to go under the threshold. To defer reading the FIFO to main context, the
1506 /// application can disable or re-enable the receive FIFO threshold event using
1507 /// RAIL_ConfigEvents() with the mask \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL.
1508 ///
1509 /// The receive FIFO can store multiple packets and processing of a packet can
1510 /// be deferred from the RAIL event callback to main-loop processing
1511 /// by using RAIL_HoldRxPacket() in the event callback and
1512 /// RAIL_ReleaseRxPacket() in the main-loop.
1513 /// On some platforms, the receive FIFO is supplemented by an internal
1514 /// fixed-size packet metadata FIFO that limits the number of packets
1515 /// RAIL and applications can hold onto for deferred processing.
1516 /// See chip-specific documentation, such as \ref efr32_main, for more
1517 /// information. Note that when using multiprotocol the receive FIFO is reset
1518 /// prior to a protocol switch so held packets will be lost if not processed
1519 /// before then.
1520 ///
1521 /// While \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL occurs solely based on the
1522 /// state of the receive FIFO used for packet data, both
1523 /// \ref RAIL_EVENT_RX_FIFO_FULL and \ref RAIL_EVENT_RX_FIFO_OVERFLOW
1524 /// can occur coincident with packet completion when either that or the
1525 /// internal packet metadata FIFO fills or overflows.
1526 /// \ref RAIL_EVENT_RX_FIFO_FULL informs the application it should
1527 /// immediately process and free up the oldest packets/data to make room
1528 /// for new packets/data, reducing the possibility of packet/data loss
1529 /// and \ref RAIL_EVENT_RX_FIFO_OVERFLOW.
1530 ///
1531 /// Before a packet is fully received you can always use
1532 /// RAIL_PeekRxPacket() to look at the contents. In FIFO mode, you may also
1533 /// consume its data with \ref RAIL_ReadRxFifo(). Remember that none of these
1534 /// APIs will read across a packet boundary (even in FIFO mode) so you will
1535 /// need to handle each received packet individually.
1536 ///
1537 /// While RAIL defaults to \ref RAIL_DataMethod_t::PACKET_MODE, the
1538 /// application can explicitly initialize RAIL for \ref
1539 /// RAIL_DataMethod_t::PACKET_MODE in the following manner:
1540 /// @code{.c}
1541 /// extern RAIL_Handle_t railHandle;
1542 /// static const RAIL_DataConfig_t railDataConfig = {
1543 /// .txSource = TX_PACKET_DATA,
1544 /// .rxSource = RX_PACKET_DATA,
1545 /// .txMethod = PACKET_MODE,
1546 /// .rxMethod = PACKET_MODE,
1547 /// };
1548 ///
1549 /// status = RAIL_ConfigData(railHandle, &railDataConfig);
1550 ///
1551 /// // Events that can occur in Packet Mode:
1552 /// // RAIL_EVENT_TX_PACKET_SENT
1553 /// // RAIL_EVENT_RX_PACKET_RECEIVED
1554 /// // and optionally (packet data automatically dropped):
1555 /// // RAIL_EVENT_RX_ADDRESS_FILTERED
1556 /// // RAIL_EVENT_RX_PACKET_ABORTED
1557 /// // RAIL_EVENT_RX_FRAME_ERROR
1558 /// // and if enabled:
1559 /// // RAIL_EVENT_TX_UNDERFLOW
1560 /// // RAIL_EVENT_TXACK_UNDERFLOW
1561 /// // RAIL_EVENT_TX_FIFO_ALMOST_EMPTY
1562 /// // RAIL_EVENT_RX_FIFO_ALMOST_FULL
1563 /// @endcode
1564 ///
1565 /// Initializing RAIL for \ref RAIL_DataMethod_t::FIFO_MODE requires a few
1566 /// more function calls:
1567 /// @code{.c}
1568 /// extern RAIL_Handle_t railHandle;
1569 /// static const RAIL_DataConfig_t railDataConfig = {
1570 /// .txSource = TX_PACKET_DATA,
1571 /// .rxSource = RX_PACKET_DATA,
1572 /// .txMethod = FIFO_MODE,
1573 /// .rxMethod = FIFO_MODE,
1574 /// };
1575 ///
1576 /// status = RAIL_ConfigData(railHandle, &railDataConfig);
1577 ///
1578 /// // Gets the size of the FIFOs.
1579 /// // Assume that the transmit and receive FIFOs are the same size
1580 /// uint16_t fifoSize = RAIL_GetTxFifoSpaceAvailable(railHandle);
1581 ///
1582 /// // Sets the transmit and receive FIFO thresholds.
1583 /// // For this example, set the threshold in the middle of each FIFO.
1584 /// RAIL_SetRxFifoThreshold(railHandle, fifoSize / 2);
1585 /// RAIL_SetTxFifoThreshold(railHandle, fifoSize / 2);
1586 ///
1587 /// // Events that can occur in FIFO mode:
1588 /// // RAIL_EVENT_TX_FIFO_ALMOST_EMPTY
1589 /// // RAIL_EVENT_TX_UNDERFLOW
1590 /// // RAIL_EVENT_TXACK_UNDERFLOW
1591 /// // RAIL_EVENT_TX_PACKET_SENT
1592 /// // RAIL_EVENT_RX_FIFO_ALMOST_FULL
1593 /// // RAIL_EVENT_RX_FIFO_OVERFLOW
1594 /// // RAIL_EVENT_RX_ADDRESS_FILTERED
1595 /// // RAIL_EVENT_RX_PACKET_ABORTED
1596 /// // RAIL_EVENT_RX_FRAME_ERROR
1597 /// // RAIL_EVENT_RX_PACKET_RECEIVED
1598 /// @endcode
1599 ///
1600 /// On receive, an application can use a different \ref RAIL_RxDataSource_t that
1601 /// is only compatible with \ref RAIL_DataMethod_t::FIFO_MODE. All that differs
1602 /// from the FIFO mode example above is the RAIL_DataConfig_t::rxSource setting.
1603 /// IQ data samples are taken at the hardware's oversample rate and the amount
1604 /// of data can easily overwhelm the CPU processing time. The sample rate
1605 /// depends on the chosen PHY, as determined by the data rate and the decimation
1606 /// chain. It is <b>not</b> recommended to use the IQ data source with sample
1607 /// rates above 300 k samples/second because the CPU might not be able to keep up
1608 /// with the data stream. Depending on the application and the needed CPU
1609 /// bandwidth, slower data rates may be required. On EFR32xG22 and later
1610 /// platforms, it is recommended to reset the RX buffer before initiating a
1611 /// receive for all modes except \ref RAIL_RxDataSource_t::RX_PACKET_DATA since
1612 /// the RX buffer has to be 32-bit aligned. If the buffer is <b>not</b> reset
1613 /// but is 32-bit aligned, capture is performed on the remaining space available.
1614 /// If the buffer is <b>not</b> reset and is <b>not</b> 32-bit aligned, then
1615 /// RAIL_ConfigData() returns \ref RAIL_STATUS_INVALID_STATE.
1616 /// @code{.c}
1617 /// // Reset RX buffer (EFR32xG22 and later platforms)
1618 /// RAIL_ResetFifo(railHandle, false, true);
1619 ///
1620 /// // IQ data is provided into the receive FIFO.
1621 /// static const RAIL_DataConfig_t railDataConfig = {
1622 /// .txSource = TX_PACKET_DATA,
1623 /// .rxSource = RX_IQDATA_FILTLSB,
1624 /// .txMethod = FIFO_MODE,
1625 /// .rxMethod = FIFO_MODE,
1626 /// };
1627 ///
1628 /// // IQ data comes in the following format when reading out of the FIFO:
1629 /// //------------------------------------
1630 /// // I[LSB] | I[MSB] | Q[LSB] | Q[MSB] |
1631 /// //------------------------------------
1632 /// @endcode
1633 ///
1634 /// @{
1635
1636 /**
1637 * RAIL data management configuration
1638 *
1639 * @param[in] railHandle A RAIL instance handle.
1640 * @param[in] dataConfig RAIL data configuration structure.
1641 * @return Status code indicating success of the function call.
1642 *
1643 * This function configures how RAIL manages data. The application can
1644 * configure RAIL to receive data in a packet-based or FIFO-based manner.
1645 * \ref RAIL_DataMethod_t::FIFO_MODE is necessary to receive packets larger
1646 * than the radio's receive FIFO. It is also required for receive data
1647 * sources other than \ref RAIL_RxDataSource_t::RX_PACKET_DATA.
1648 *
1649 * Generally with \ref RAIL_DataMethod_t::FIFO_MODE, the application sets
1650 * appropriate FIFO thresholds via RAIL_SetTxFifoThreshold() and
1651 * RAIL_SetRxFifoThreshold() and then enables and handles the
1652 * \ref RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event callback (to feed more packet
1653 * data via RAIL_WriteTxFifo() before the FIFO underflows) and the \ref
1654 * RAIL_EVENT_RX_FIFO_ALMOST_FULL event callback (to consume packet data
1655 * via RAIL_ReadRxFifo() before the receive FIFO overflows).
1656 *
1657 * When configuring TX for \ref RAIL_DataMethod_t::FIFO_MODE, this
1658 * function resets the transmit FIFO. When configuring TX or RX for
1659 * \ref RAIL_DataMethod_t::PACKET_MODE, this function will reset
1660 * the corresponding FIFO thresholds such that they won't trigger the
1661 * \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL or \ref RAIL_EVENT_TX_FIFO_ALMOST_EMPTY
1662 * events.
1663 *
1664 * When \ref RAIL_DataConfig_t::rxMethod is set to \ref
1665 * RAIL_DataMethod_t::FIFO_MODE, the radio won't drop packet data of
1666 * aborted or CRC error packets, but will present it to the application
1667 * to deal with accordingly. On completion of erroneous packets, the
1668 * \ref RAIL_Config_t::eventsCallback with \ref RAIL_EVENT_RX_PACKET_ABORTED,
1669 * \ref RAIL_EVENT_RX_FRAME_ERROR, or \ref RAIL_EVENT_RX_ADDRESS_FILTERED will
1670 * tell the application it can drop any data it read via RAIL_ReadRxFifo() during reception.
1671 * For CRC error packets when the \ref RAIL_RX_OPTION_IGNORE_CRC_ERRORS
1672 * RX option is in effect, the application should check for that from the
1673 * \ref RAIL_RxPacketStatus_t obtained by calling RAIL_GetRxPacketInfo().
1674 * RAIL will automatically flush any remaining packet data after reporting
1675 * one of these packet completion events or the application can explicitly
1676 * flush it by calling RAIL_ReleaseRxPacket().
1677 *
1678 * When \ref RAIL_DataConfig_t::rxMethod is set to \ref
1679 * RAIL_DataMethod_t::PACKET_MODE, the radio will roll back (drop) all packet
1680 * data associated with aborted packets including those with CRC errors
1681 * (unless configured to ignore CRC errors via the
1682 * \ref RAIL_RX_OPTION_IGNORE_CRC_ERRORS RX option). The application will
1683 * never have to deal with packet data from these packets.
1684 * In either mode, the application can set RX options as needed.
1685 *
1686 * When \ref RAIL_DataConfig_t::rxSource is set to a value other than
1687 * \ref RX_PACKET_DATA and \ref RAIL_Config_t::eventsCallback
1688 * \ref RAIL_EVENT_RX_FIFO_OVERFLOW is enabled RX will be terminated
1689 * if a RX FIFO overflow occurs. If \ref RAIL_EVENT_RX_FIFO_OVERFLOW
1690 * is not enabled, data will be discarded until the overflow condition
1691 * is resolved. To continue capturing data RX must be restarted using
1692 * \ref RAIL_StartRx().
1693 *
1694 */
1695 RAIL_Status_t RAIL_ConfigData(RAIL_Handle_t railHandle,
1696 const RAIL_DataConfig_t *dataConfig);
1697
1698 /**
1699 * Write data to the transmit FIFO previously established by RAIL_SetTxFifo().
1700 *
1701 * @param[in] railHandle A RAIL instance handle.
1702 * @param[in] dataPtr An application-provided pointer to transmit data.
1703 * @param[in] writeLength A number of bytes to write to the transmit FIFO.
1704 * @param[in] reset If true, resets transmit FIFO before writing the data.
1705 * @return The number of bytes written to the transmit FIFO.
1706 *
1707 * This function reads data from the provided dataPtr and writes it to the transmit
1708 * FIFO that was previously established by RAIL_SetTxFifo().
1709 * If the requested writeLength exceeds the current number of bytes open
1710 * in the transmit FIFO, the function only writes until the transmit FIFO
1711 * is full. The function returns the number of bytes written to the transmit
1712 * FIFO or returns zero if railHandle is NULL or if the transmit FIFO is full.
1713 *
1714 * @note The protocol's packet configuration, as set up by the radio
1715 * configurator or via RAIL_SetFixedLength(), determines how many
1716 * bytes of data are consumed from the transmit FIFO for a successful transmit
1717 * operation, not the writeLength value passed in. If not enough data has
1718 * been put into the transmit FIFO, a \ref RAIL_EVENT_TX_UNDERFLOW event will
1719 * occur. If too much data is put into the transmit FIFO, the extra data will
1720 * either become the first bytes
1721 * sent in a subsequent packet, or will be thrown away if the FIFO gets
1722 * reset prior to the next transmit. In general, the proper number of
1723 * packet bytes to put into the transmit FIFO are all payload bytes except
1724 * for any CRC bytes, which the packet configuration causes to be sent
1725 * automatically.
1726 *
1727 * @note This function does not create a critical section but, depending on the
1728 * application, a critical section could be appropriate.
1729 */
1730 uint16_t RAIL_WriteTxFifo(RAIL_Handle_t railHandle,
1731 const uint8_t *dataPtr,
1732 uint16_t writeLength,
1733 bool reset);
1734
1735 /**
1736 * Set the address of the transmit FIFO, a circular buffer used for TX data.
1737 *
1738 * @param[in] railHandle A RAIL instance handle.
1739 * @param[in,out] addr A pointer to a read-write memory location in RAM
1740 * used as the transmit FIFO. This memory must persist until the next call to
1741 * this function.
1742 * @param[in] initLength A number of initial bytes already in the transmit FIFO.
1743 * @param[in] size A desired size of the transmit FIFO in bytes.
1744 * @return Returns the FIFO size in bytes, 0 if an error occurs.
1745 *
1746 * This function sets the memory location for the transmit FIFO. It
1747 * must be called at least once before any transmit operations occur.
1748 *
1749 * FIFO size can be determined by the return value of this function. The
1750 * chosen size is determined based on the available FIFO sizes supported by the
1751 * hardware. Similarly, some hardware has stricter FIFO alignment requirements;
1752 * 32-bit alignment provides the maximum portability across all RAIL platforms.
1753 * For more on supported FIFO sizes and alignments, see chip-specific
1754 * documentation, such as \ref efr32_main. The returned FIFO size will be the
1755 * closest allowed size less than or equal to the passed in size parameter,
1756 * unless the size parameter is smaller than the minimum FIFO size. If the
1757 * initLength parameter is larger than the returned size, the FIFO will be
1758 * filled up to its size.
1759 *
1760 * A user may write to the custom memory location directly before calling this
1761 * function, or use \ref RAIL_WriteTxFifo to write to the memory location after
1762 * calling this function. Users must specify the initLength for
1763 * previously-written memory to be set in the transmit FIFO.
1764 *
1765 * This function reserves the block of RAM starting at addr with a length of the
1766 * returned FIFO size, which is used internally as a circular buffer for the
1767 * transmit FIFO. It must be able to hold the entire FIFO size. The caller must
1768 * guarantee that the custom FIFO remains intact and unchanged (except via calls
1769 * to \ref RAIL_WriteTxFifo) until the next call to this function.
1770 *
1771 * @note The protocol's packet configuration, as set up by the radio
1772 * configurator or via RAIL_SetFixedLength(), determines how many
1773 * bytes of data are consumed from the transmit FIFO for a successful transmit
1774 * operation, not the initLength value passed in. If not enough data has
1775 * been put into the transmit FIFO, a \ref RAIL_EVENT_TX_UNDERFLOW event will
1776 * occur. If too much data is put into the transmit FIFO, the extra data
1777 * will either become the first bytes
1778 * sent in a subsequent packet, or will be thrown away if the FIFO gets
1779 * reset prior to the next transmit. In general, the proper number of
1780 * packet bytes to put into the transmit FIFO are all payload bytes except
1781 * for any CRC bytes which the packet configuration causes to be sent
1782 * automatically.
1783 */
1784 uint16_t RAIL_SetTxFifo(RAIL_Handle_t railHandle,
1785 uint8_t *addr,
1786 uint16_t initLength,
1787 uint16_t size);
1788
1789 /**
1790 * Set the address of the receive FIFO, a circular buffer used for RX data.
1791 *
1792 * @param[in] railHandle A RAIL instance handle.
1793 * @param[in,out] addr A pointer to a read-write memory location in RAM used as
1794 * the receive FIFO. This memory must persist until the next call to this
1795 * function.
1796 * @param[in,out] size A desired size of the receive FIFO in bytes. This will
1797 * be populated with the actual size during the function call.
1798 * @return Status code indicating success of the function call.
1799 *
1800 * This function sets the memory location for the receive FIFO. It
1801 * must be called at least once before any receive operations occur.
1802 *
1803 * @note After it is called, any prior receive FIFO is orphaned. To avoid
1804 * orphaning the default internal 512-byte receive FIFO so it does
1805 * not unnecessarily consume RAM resources in your application,
1806 * implement \ref RAILCb_SetupRxFifo() to call this function.
1807 *
1808 * FIFO size can be determined by the return value of this function. The
1809 * chosen size is determined based on the available FIFO sizes supported by the
1810 * hardware. Similarly, some hardware has stricter FIFO alignment requirements;
1811 * 32-bit alignment provides the maximum portability across all RAIL platforms.
1812 * For more on supported FIFO sizes and alignments, see chip-specific
1813 * documentation, such as \ref efr32_main. The returned FIFO size will be the
1814 * closest allowed size less than or equal to the passed in size parameter,
1815 * unless the size parameter is smaller than the minimum FIFO size.
1816 *
1817 * This function reserves the block of RAM starting at addr with a length
1818 * of size, which is used internally as a circular buffer for the receive FIFO.
1819 * It must be able to hold the entire FIFO size. The caller must guarantee that
1820 * the custom FIFO remains intact and unchanged (except via incoming packet data
1821 * being written) until the next call to this function.
1822 *
1823 * In multiprotocol, RAIL currently shares one receive FIFO across all
1824 * protocols. This function will return \ref RAIL_STATUS_INVALID_STATE if the
1825 * requested \ref RAIL_Handle_t is not active.
1826 */
1827 RAIL_Status_t RAIL_SetRxFifo(RAIL_Handle_t railHandle,
1828 uint8_t *addr,
1829 uint16_t *size);
1830
1831 /// Set up the receive FIFO to use. This function is optional to implement.
1832 ///
1833 /// @param[in] railHandle A RAIL instance handle.
1834 /// @return Status code indicating success of the function call.
1835 ///
1836 /// This function is called during the \ref RAIL_Init process to set up the FIFO
1837 /// to use for received packets. If not implemented by the application,
1838 /// a default implementation from within the RAIL library will be used to
1839 /// initialize an internal default 512-byte receive FIFO.
1840 ///
1841 /// If this function returns an error, the RAIL_Init process will fail.
1842 ///
1843 /// During this function, the application should generally call
1844 /// \ref RAIL_SetRxFifo. If that does not happen, the application needs to
1845 /// set up the receive FIFO via a call to \ref RAIL_SetRxFifo before attempting
1846 /// to receive any packets. An example implementation may look like the following:
1847 /// @code{.c}
1848 /// #define RX_FIFO_SIZE 1024
1849 /// static uint8_t rxFifo[RX_FIFO_SIZE];
1850 ///
1851 /// RAIL_Status_t RAILCb_SetupRxFifo(RAIL_Handle_t railHandle)
1852 /// {
1853 /// uint16_t rxFifoSize = RX_FIFO_SIZE;
1854 /// RAIL_Status_t status = RAIL_SetRxFifo(railHandle, &rxFifo[0], &rxFifoSize);
1855 /// if (rxFifoSize != RX_FIFO_SIZE) {
1856 /// // We set up an incorrect FIFO size
1857 /// return RAIL_STATUS_INVALID_PARAMETER;
1858 /// }
1859 /// if (status == RAIL_STATUS_INVALID_STATE) {
1860 /// // Allow failures due to multiprotocol
1861 /// return RAIL_STATUS_NO_ERROR;
1862 /// }
1863 /// return status;
1864 /// }
1865 /// @endcode
1866 RAIL_Status_t RAILCb_SetupRxFifo(RAIL_Handle_t railHandle);
1867
1868 /**
1869 * Read packet data from RAIL's internal receive FIFO.
1870 *
1871 * @param[in] railHandle A RAIL instance handle.
1872 * @param[out] dataPtr An application-provided pointer to store data.
1873 * If NULL, the data is thrown away rather than copied out.
1874 * @param[in] readLength A number of packet bytes to read from the FIFO.
1875 * @return The number of packet bytes read from the receive FIFO.
1876 *
1877 * This function reads packet data from the head of receive FIFO and
1878 * writes it to the provided dataPtr. It does not permit reading more
1879 * data than is available in the FIFO, nor does it permit reading more
1880 * data than remains in the oldest unreleased packet.
1881 *
1882 * Because this function does not have a critical section, use it
1883 * only in one context or make sure function calls are protected to prevent
1884 * buffer corruption.
1885 *
1886 * @warning This function is intended for use only with \ref
1887 * RAIL_DataMethod_t::FIFO_MODE and should never be called in \ref
1888 * RAIL_DataMethod_t::PACKET_MODE where it could lead to receive FIFO
1889 * corruption.
1890 *
1891 * @note When reading data from an arriving packet that is not yet complete,
1892 * keep in mind its data is highly suspect because it has not yet passed
1893 * any CRC integrity checking. Also note that the packet could be aborted,
1894 * canceled, or fail momentarily, invalidating its data in Packet mode.
1895 * Furthermore, there is a small chance towards the end of packet reception
1896 * that the receive FIFO could include not only packet data received so far,
1897 * but also some raw radio-appended info detail bytes that RAIL's
1898 * packet-completion processing will subsequently deal with. It's up to the
1899 * application to know its packet format well enough to avoid reading this
1900 * info because it will corrupt the packet's details and possibly corrupt the
1901 * receive FIFO.
1902 */
1903 uint16_t RAIL_ReadRxFifo(RAIL_Handle_t railHandle,
1904 uint8_t *dataPtr,
1905 uint16_t readLength);
1906
1907 /**
1908 * Configure the RAIL transmit FIFO almost empty threshold.
1909 *
1910 * @param[in] railHandle A RAIL instance handle.
1911 * @param[in] txThreshold The threshold below which the
1912 * \ref RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event will fire.
1913 * @return Configured transmit FIFO threshold value.
1914 *
1915 * This function configures the threshold for the transmit FIFO. When the
1916 * number of bytes in the transmit FIFO falls below the configured threshold,
1917 * \ref RAIL_Config_t::eventsCallback will fire with \ref
1918 * RAIL_EVENT_TX_FIFO_ALMOST_EMPTY set.
1919 * The txThreshold value should be smaller than or equal to the transmit
1920 * FIFO size; higher values will be pegged to the FIFO size.
1921 * A value of 0 or \ref RAIL_FIFO_THRESHOLD_DISABLED will disable the
1922 * threshold, returning \ref RAIL_FIFO_THRESHOLD_DISABLED.
1923 */
1924 uint16_t RAIL_SetTxFifoThreshold(RAIL_Handle_t railHandle,
1925 uint16_t txThreshold);
1926
1927 /**
1928 * Configure the RAIL receive FIFO almost full threshold.
1929 *
1930 * @param[in] railHandle A RAIL instance handle.
1931 * @param[in] rxThreshold The threshold above which the
1932 * \ref RAIL_EVENT_RX_FIFO_ALMOST_FULL event will fire.
1933 * @return Configured receive FIFO threshold value.
1934 *
1935 * This function configures the threshold for the receive FIFO. When the
1936 * number of bytes of packet data in the receive FIFO exceeds the configured
1937 * threshold, \ref RAIL_Config_t::eventsCallback will fire with \ref
1938 * RAIL_EVENT_RX_FIFO_ALMOST_FULL set.
1939 * The rxThreshold value should be smaller than the receive FIFO size;
1940 * anything else, including a
1941 * value of \ref RAIL_FIFO_THRESHOLD_DISABLED, will disable the threshold,
1942 * returning \ref RAIL_FIFO_THRESHOLD_DISABLED.
1943 */
1944 uint16_t RAIL_SetRxFifoThreshold(RAIL_Handle_t railHandle,
1945 uint16_t rxThreshold);
1946
1947 /**
1948 * Get the RAIL transmit FIFO almost empty threshold value.
1949 *
1950 * @param[in] railHandle A RAIL instance handle.
1951 * @return Configured TX Threshold value.
1952 *
1953 * Retrieves the configured TX threshold value.
1954 */
1955 uint16_t RAIL_GetTxFifoThreshold(RAIL_Handle_t railHandle);
1956
1957 /**
1958 * Get the RAIL receive FIFO almost full threshold value.
1959 *
1960 * @param[in] railHandle A RAIL instance handle.
1961 * @return Configured RX Threshold value.
1962 *
1963 * Retrieves the configured RX threshold value.
1964 */
1965 uint16_t RAIL_GetRxFifoThreshold(RAIL_Handle_t railHandle);
1966
1967 /**
1968 * Reset the RAIL transmit and/or receive FIFOs.
1969 *
1970 * @param[in] railHandle A RAIL instance handle.
1971 * @param[in] txFifo If true, reset the transmit FIFO.
1972 * @param[in] rxFifo If true, reset the receive FIFO.
1973 *
1974 * This function can reset each FIFO independently.
1975 * The application should not reset the receive FIFO while receiving a frame,
1976 * nor should it reset the transmit FIFO while transmitting a frame.
1977 */
1978 void RAIL_ResetFifo(RAIL_Handle_t railHandle, bool txFifo, bool rxFifo);
1979
1980 /**
1981 * Get the number of bytes used in the receive FIFO.
1982 * Only use this function in RX \ref RAIL_DataMethod_t::FIFO_MODE.
1983 * Apps should use RAIL_GetRxPacketInfo() instead.
1984 *
1985 * @param[in] railHandle A RAIL instance handle.
1986 * @return Number of bytes used in the receive FIFO.
1987 *
1988 * This function indicates how much packet-related data exists in the receive FIFO
1989 * that could be read.
1990 *
1991 * @note The number of bytes returned may not just reflect the current
1992 * packet's data but could also include raw appended info bytes added
1993 * after successful packet reception and bytes from subsequently received
1994 * packets. It is up to the app to never try to consume more than the
1995 * packet's actual data when using the value returned here in a subsequent
1996 * call to RAIL_ReadRxFifo(), otherwise the receive FIFO will be corrupted.
1997 */
1998 uint16_t RAIL_GetRxFifoBytesAvailable(RAIL_Handle_t railHandle);
1999
2000 /**
2001 * Get the number of bytes unused in the transmit FIFO.
2002 *
2003 * @param[in] railHandle A RAIL instance handle.
2004 * @return Number of bytes unused in the transmit FIFO.
2005 *
2006 * This function indicates how much space is available in the transmit FIFO for writing
2007 * additional packet data.
2008 */
2009 uint16_t RAIL_GetTxFifoSpaceAvailable(RAIL_Handle_t railHandle);
2010
2011 /** @} */ // end of group Data_Management
2012
2013 /******************************************************************************
2014 * State Transitions
2015 *****************************************************************************/
2016 /**
2017 * @addtogroup State_Transitions State Transitions
2018 * @{
2019 */
2020
2021 /**
2022 * Configure RAIL automatic state transitions after RX.
2023 *
2024 * @param[in] railHandle A RAIL instance handle.
2025 * @param[in] transitions The state transitions to apply after reception.
2026 * @return Status code indicating success of the function call.
2027 *
2028 * This function fails if unsupported transitions are passed in or if the
2029 * radio is currently in the RX state. Success can transition to TX, RX, or
2030 * IDLE, while error can transition to RX or IDLE. The timings of state
2031 * transitions from the RX state are not guaranteed when packets are longer
2032 * than 16 seconds on-air.
2033 */
2034 RAIL_Status_t RAIL_SetRxTransitions(RAIL_Handle_t railHandle,
2035 const RAIL_StateTransitions_t *transitions);
2036
2037 /**
2038 * Get the current RAIL automatic state transitions after RX.
2039 *
2040 * @param[in] railHandle A RAIL instance handle.
2041 * @param[out] transitions The state transitions that apply after receive.
2042 * @return Status code indicating a success of the function call.
2043 *
2044 * Retrieves the current state transitions after RX and stores them in the
2045 * transitions argument.
2046 */
2047 RAIL_Status_t RAIL_GetRxTransitions(RAIL_Handle_t railHandle,
2048 RAIL_StateTransitions_t *transitions);
2049
2050 /**
2051 * Configure RAIL automatic state transitions after TX.
2052 *
2053 * @param[in] railHandle A RAIL instance handle.
2054 * @param[in] transitions The state transitions to apply after transmission.
2055 * @return Status code indicating a success of the function call.
2056 *
2057 * This function fails if unsupported transitions are passed in or if the
2058 * radio is currently in the TX state. Success and error can each transition
2059 * to RX or IDLE. For the ability to run repeated transmits, see
2060 * \ref RAIL_SetNextTxRepeat.
2061 */
2062 RAIL_Status_t RAIL_SetTxTransitions(RAIL_Handle_t railHandle,
2063 const RAIL_StateTransitions_t *transitions);
2064
2065 /**
2066 * Get the current RAIL automatic state transitions after TX.
2067 *
2068 * @param[in] railHandle A RAIL instance handle.
2069 * @param[out] transitions The state transitions that apply after transmission.
2070 * @return Status code indicating a success of the function call.
2071 *
2072 * Retrieves the current state transitions after TX and stores them in the
2073 * transitions argument.
2074 */
2075 RAIL_Status_t RAIL_GetTxTransitions(RAIL_Handle_t railHandle,
2076 RAIL_StateTransitions_t *transitions);
2077
2078 /**
2079 * Set up automatic repeated transmits after the next transmit.
2080 *
2081 * @param[in] railHandle A RAIL instance handle.
2082 * @param[in] repeatConfig The configuration structure for repeated transmits.
2083 * @return Status code indicating a success of the function call.
2084 *
2085 * Repeated transmits will occur after an application-initiated transmit caused
2086 * by calling one of the \ref Packet_TX APIs. The repetition will only occur
2087 * after the first application-initiated transmit after this function is
2088 * called. Future repeated transmits must be requested by calling this function
2089 * again.
2090 *
2091 * Each repeated transmit that occurs will have full \ref PTI information, and
2092 * will receive events such as \ref RAIL_EVENT_TX_PACKET_SENT as normal.
2093 *
2094 * If a TX error occurs during the repetition, the process will abort and the
2095 * TX error transition from \ref RAIL_SetTxTransitions will be used. If the
2096 * repetition completes successfully, then the TX success transition from
2097 * \ref RAIL_SetTxTransitions will be used.
2098 *
2099 * Use \ref RAIL_GetTxPacketsRemaining() if need to know how many transmit
2100 * completion events are expected before the repeating sequence is done, or
2101 * how many were not performed due to a transmit error.
2102 *
2103 * Any call to \ref RAIL_Idle or \ref RAIL_StopTx will clear the pending
2104 * repeated transmits. The state will also be cleared by another call to this
2105 * function. To clear the repeated transmits before they've started without
2106 * stopping other radio actions, call this function with a \ref
2107 * RAIL_TxRepeatConfig_t::iterations count of 0. A DMP switch will clear this
2108 * state only if the initial transmit triggering the repeated transmits has
2109 * started.
2110 *
2111 * The application is responsible for populating the transmit data to be used
2112 * by the repeated transmits via \ref RAIL_SetTxFifo or \ref RAIL_WriteTxFifo.
2113 * Data will be transmitted from the Transmit FIFO. If the Transmit FIFO does
2114 * not have sufficient data to transmit, a TX error will be caused and a \ref
2115 * RAIL_EVENT_TX_UNDERFLOW will occur. In order to avoid an underflow, the
2116 * application should queue data to be transmitted as early as possible.
2117 * Consider using \ref RAIL_TX_OPTION_RESEND if the same packet data is to
2118 * be repeated: then the Transmit FIFO only needs to be set/written once.
2119 *
2120 * Do not call this function after starting a transmit operation or before
2121 * processing the final transmit completion event of a prior transmit.
2122 * This function will fail to configure the repetition if a transmit of any
2123 * kind is ongoing, including during the time between an initial transmit and
2124 * the end of a previously-configured repetition.
2125 *
2126 * @note This feature/API is not supported on the EFR32XG1 family of chips.
2127 * Use the compile time symbol \ref RAIL_SUPPORTS_TX_TO_TX or the runtime
2128 * call \ref RAIL_SupportsTxToTx() to check whether the platform supports
2129 * this feature.
2130 */
2131 RAIL_Status_t RAIL_SetNextTxRepeat(RAIL_Handle_t railHandle,
2132 const RAIL_TxRepeatConfig_t *repeatConfig);
2133
2134 /**
2135 * Get the number of transmits remaining in a repeat operation.
2136 * Must only be called from within event callback context when handling
2137 * one of the \ref RAIL_EVENTS_TX_COMPLETION events.
2138 *
2139 * @param[in] railHandle A RAIL instance handle.
2140 * @return transmits remaining as described below.
2141 *
2142 * If the TX completion event is \ref RAIL_EVENT_TX_PACKET_SENT the
2143 * returned value indicates how many more such events are expected
2144 * before the repeat transmit operation is done. Due to interrupt
2145 * latency and timing, this may be an overcount if greater than 0
2146 * but is guaranteed to be accurate when 0.
2147 *
2148 * If the TX completion event is an error, the returned value indicates
2149 * the number of requested transmits that were not performed. For
2150 * \ref RAIL_EVENT_TX_ABORTED and \ref RAIL_EVENT_TX_UNDERFLOW the
2151 * count does not include the failing transmit itself. For the other
2152 * errors where a transmit never started or was blocked, the count
2153 * would include the failing transmit, which may be one higher than
2154 * the configured \ref RAIL_TxRepeatConfig_t::iterations if it was
2155 * the original transmit that was blocked.
2156 *
2157 * If an infinite repeat was configured, this will return \ref
2158 * RAIL_TX_REPEAT_INFINITE_ITERATIONS.
2159 */
2160 uint16_t RAIL_GetTxPacketsRemaining(RAIL_Handle_t railHandle);
2161
2162 /**
2163 * Configure RAIL automatic state transition timing.
2164 *
2165 * @param[in] railHandle A RAIL instance handle.
2166 * @param[in,out] timings The timings used to configure the RAIL state
2167 * machine. This structure is overwritten with the actual times that were
2168 * set, if an input timing is invalid.
2169 * @return Status code indicating a success of the function call.
2170 *
2171 * The timings given are close to the actual transition time. However,
2172 * a still uncharacterized software overhead occurs. Also, timings are not
2173 * always adhered to when using an automatic transition after an error, due to
2174 * the cleanup required to recover from the error.
2175 */
2176 RAIL_Status_t RAIL_SetStateTiming(RAIL_Handle_t railHandle,
2177 RAIL_StateTiming_t *timings);
2178
2179 /**
2180 * Place the radio into an idle state.
2181 *
2182 * @param[in] railHandle A RAIL instance handle.
2183 * @param[in] mode The method for shutting down the radio.
2184 * @param[in] wait Whether this function should wait for the radio to reach
2185 * idle before returning.
2186 *
2187 * This function is used to remove the radio from TX and RX states. How these
2188 * states are left is defined by the mode parameter.
2189 *
2190 * In multiprotocol, this API will also cause the radio to be yielded so that
2191 * other tasks can be run. See \ref rail_radio_scheduler_yield for more details.
2192 */
2193 void RAIL_Idle(RAIL_Handle_t railHandle,
2194 RAIL_IdleMode_t mode,
2195 bool wait);
2196
2197 /**
2198 * Get the current radio state.
2199 *
2200 * @param[in] railHandle A RAIL instance handle.
2201 * @return An enumeration for the current radio state.
2202 *
2203 * Returns the state of the radio as a bitmask containing:
2204 * \ref RAIL_RF_STATE_IDLE, \ref RAIL_RF_STATE_RX, \ref RAIL_RF_STATE_TX,
2205 * and \ref RAIL_RF_STATE_ACTIVE. \ref RAIL_RF_STATE_IDLE, \ref
2206 * RAIL_RF_STATE_RX, and \ref RAIL_RF_STATE_TX bits are mutually exclusive.
2207 * The radio can transition through intermediate states,
2208 * which are not reported but are instead considered part of the state
2209 * most closely associated. For example, when the radio is warming up
2210 * or shutting down the transmitter or receiver, this function returns
2211 * \ref RAIL_RF_STATE_TX or \ref RAIL_RF_STATE_RX, respectively.
2212 * When transitioning directly from RX to TX or vice-versa, this function
2213 * returns the earlier state.
2214 *
2215 * @note For a more detailed radio state, see \ref RAIL_GetRadioStateDetail
2216 */
2217 RAIL_RadioState_t RAIL_GetRadioState(RAIL_Handle_t railHandle);
2218
2219 /**
2220 * Get the detailed current radio state.
2221 *
2222 * @param[in] railHandle A RAIL instance handle.
2223 * @return An enumeration for the current detailed radio state.
2224 *
2225 * Returns the state of the radio as a bitmask. The three core radio states
2226 * IDLE, RX, and TX are represented by mutually exclusive bits \ref
2227 * RAIL_RF_STATE_DETAIL_IDLE_STATE, \ref RAIL_RF_STATE_DETAIL_RX_STATE, and
2228 * \ref RAIL_RF_STATE_DETAIL_TX_STATE respectively. If the radio is
2229 * transitioning between these three states, the returned bitmask will have
2230 * \ref RAIL_RF_STATE_DETAIL_TRANSITION set along with a bit corresponding to
2231 * the destination core radio state. If, while in the receive state, the radio
2232 * is actively receiving a packet, \ref RAIL_RF_STATE_DETAIL_ACTIVE will be set;
2233 * otherwise, this bit will be clear. If frame detection is disabled, \ref
2234 * RAIL_RF_STATE_DETAIL_NO_FRAMES in the returned state bitmask will be set;
2235 * otherwise, this bit will be clear. If the radio is performing an LBT/CSMA
2236 * operation (e.g., a backoff period) \ref RAIL_RF_STATE_DETAIL_LBT in the
2237 * returned state bitmask will be set; otherwise, this bit will be clear.
2238 *
2239 * For the most part, the more detailed radio states returned by this API
2240 * correspond to radio states returned by \ref RAIL_GetRadioState as follows:
2241 *
2242 * \ref RAIL_RadioStateDetail_t \ref RAIL_RadioState_t
2243 * RAIL_RF_STATE_DETAIL_INACTIVE RAIL_RF_STATE_INACTIVE
2244 * RAIL_RF_STATE_DETAIL_IDLE_STATE
2245 * | RAIL_STATE_DETAIL_TRANSITION If RX overflow or leaving RX unforced:
2246 * RAIL_RF_STATE_RX
2247 * Else if leaving TX unforced:
2248 * RAIL_RF_STATE_TX
2249 * Else:
2250 * RAIL_RF_STATE_IDLE
2251 * RAIL_RF_STATE_DETAIL_IDLE_STATE RAIL_RF_STATE_IDLE
2252 * RAIL_RF_STATE_DETAIL_IDLE_STATE
2253 * | RAIL_STATE_DETAIL_LBT RAIL_RF_STATE_TX
2254 * RAIL_RF_STATE_DETAIL_RX_STATE
2255 * | RAIL_STATE_DETAIL_TRANSITION If leaving TX:
2256 * RAIL_RF_STATE_TX
2257 * Else:
2258 * RAIL_RF_STATE_RX
2259 * RAIL_RF_STATE_DETAIL_RX_STATE
2260 * | RAIL_RF_STATE_DETAIL_TRANSITION
2261 * | RAIL_RF_STATE_DETAIL_NO_FRAMES If leaving TX:
2262 * RAIL_RF_STATE_TX
2263 * Else:
2264 * RAIL_RF_STATE_RX
2265 * RAIL_RF_STATE_DETAIL_RX_STATE RAIL_RF_STATE_RX
2266 * RAIL_RF_STATE_DETAIL_RX_STATE
2267 * | RAIL_RF_STATE_DETAIL_NO_FRAMES RAIL_RF_STATE_RX
2268 * RAIL_RF_STATE_DETAIL_RX_STATE
2269 * | RAIL_RF_STATE_DETAIL_LBT RAIL_RF_STATE_RX
2270 * RAIL_RF_STATE_DETAIL_RX_STATE
2271 * | RAIL_RF_STATE_DETAIL_NO_FRAMES
2272 * | RAIL_RF_STATE_DETAIL_LBT RAIL_RF_STATE_RX
2273 * RAIL_RF_STATE_DETAIL_RX_STATE
2274 * | RAIL_RF_STATE_DETAIL_ACTIVE RAIL_RF_STATE_RX_ACTIVE
2275 * RAIL_RF_STATE_DETAIL_TX_STATE
2276 * | RAIL_RF_STATE_TRANSITION If leaving RX:
2277 * RAIL_RF_STATE_RX
2278 * Else:
2279 * RAIL_RF_STATE_TX
2280 * RAIL_RF_STATE_DETAIL_TX_STATE
2281 * | RAIL_RF_STATE_ACTIVE RAIL_RF_STATE_TX_ACTIVE
2282 */
2283 RAIL_RadioStateDetail_t RAIL_GetRadioStateDetail(RAIL_Handle_t railHandle);
2284
2285 /** @} */ // end of group State_Transitions
2286
2287 /******************************************************************************
2288 * Transmit
2289 *****************************************************************************/
2290 /**
2291 * @addtogroup Transmit
2292 * @brief APIs related to transmitting data packets
2293 * @{
2294 */
2295
2296 /// @addtogroup PA Power Amplifier (PA)
2297 /// @brief APIs for interacting with one of the on chip PAs.
2298 ///
2299 /// These APIs let you configure the on-chip PA to get the appropriate output
2300 /// power.
2301 ///
2302 /// These are the function types:
2303 /// 1) Configuration functions: These functions set and get configuration
2304 /// for the PA. In this case, "configuration" refers to a) indicating
2305 /// which PA to use, b) the voltage supplied by your board to the PA,
2306 /// and c) the ramp time over which to ramp the PA up to its full
2307 /// power.
2308 /// 2) Power-setting functions: These functions consume the actual
2309 /// values written to the PA registers and write them appropriately.
2310 /// These values are referred to as "(raw) power levels". The range of
2311 /// acceptable values for these functions depends on which PA is
2312 /// currently active. The higher the power level set, the higher
2313 /// the dBm power output by the chip. However, the mapping
2314 /// between dBm and these power levels can vary greatly between
2315 /// modules/boards.
2316 /// 3) Conversion functions: These functions convert
2317 /// between the "power levels" discussed previously and the
2318 /// dBm values output by the chip. Continue reading for more information
2319 /// about unit conversion.
2320 ///
2321 /// The accuracy of the chip output power is application-specific.
2322 /// For some protocols or channels, the protocol itself or
2323 /// legal limitations require applications to know exactly what power
2324 /// they're transmitting at, in dBm. Other applications do not have
2325 /// these restrictions, and users determine power level(s)
2326 /// that fit their criteria for the trade-off between radio range and
2327 /// power savings, regardless of what dBm power that maps to.
2328 ///
2329 /// \ref RAIL_ConvertRawToDbm and \ref RAIL_ConvertDbmToRaw,
2330 /// which convert between the dBm power and the raw power levels,
2331 /// provide a solution that fits all these applications.
2332 /// The levels of customizability are outlined below:
2333 /// 1) No customizability needed: for a given dBm value, the result
2334 /// of RAIL_ConvertDbmToRaw provides an appropriate
2335 /// raw power level that, when written to the registers via
2336 /// RAIL_SetPowerLevel, causes the chip to output at that
2337 /// dBm power. In this case, no action is needed by the user,
2338 /// the WEAK versions of the conversion functions can be used
2339 /// and the default include paths in pa_conversions_efr32.h can
2340 /// be used.
2341 /// 2) The mapping of power level to dBm is not ideal, but the
2342 /// level of precision is sufficient: In pa_conversions_efr32.c,
2343 /// the WEAK versions of the conversion functions work by using
2344 /// 8-segment piecewise linear curves to convert between dBm
2345 /// and power levels for PA's with hundreds of power levels
2346 /// and simple mapping tables for use with PA's with only a few
2347 /// levels. If this method is sufficiently precise, but the mapping
2348 /// between power levels and dBm is incorrect,
2349 /// copy pa_curves_efr32.h into a new file, updating the segments
2350 /// to form a better fit (_DCDC_CURVES or _VBAT_CURVES defines) and
2351 /// then add the RAIL_PA_CURVES define to your build with the path
2352 /// to the new file.
2353 /// 3) A different level of precision is needed and the fit is bad:
2354 /// If the piecewise-linear line segment fit is not appropriate for
2355 /// your solution, the functions in pa_conversions_efr32.c can be
2356 /// totally rewritten, as long as RAIL_ConvertDbmToRaw and
2357 /// RAIL_ConvertRawToDbm have the same signatures. It is completely
2358 /// acceptable to re-write these in a way that makes the
2359 /// pa_curves_efr32.h and pa_curve_types_efr32.h files referenced in
2360 /// pa_conversions_efr32.h unnecessary. Those files are needed solely
2361 /// for the provided conversion methods.
2362 /// 4) dBm values are not necessary: If the application does not require
2363 /// dBm values at all, overwrite
2364 /// RAIL_ConvertDbmToRaw and RAIL_ConvertRawToDbm with smaller functions
2365 /// (i.e., return 0 or whatever was input). These functions are called
2366 /// from within the RAIL library, so they can never be deadstripped,
2367 /// but making them as small as possible is the best way to reduce code
2368 /// size. From there, call RAIL_SetTxPower, without
2369 /// converting from a dBm value. To stop the library from coercing the
2370 /// power based on channels, overwrite RAIL_ConvertRawToDbm
2371 /// to always return 0 and overwrite RAIL_ConvertDbmToRaw to
2372 /// always return 255.
2373 ///
2374 /// The following is example code that shows how to initialize your PA
2375 /// @code{.c}
2376 ///
2377 /// #include "pa_conversions_efr32.h"
2378 ///
2379 /// // A helper macro to declare all the curve structures used by the provided
2380 /// // conversion functions.
2381 /// RAIL_DECLARE_TX_POWER_VBAT_CURVES(piecewiseSegments, curvesSg, curves24Hp, curves24Lp);
2382 ///
2383 /// // Puts the variables declared above into the appropriate structure.
2384 /// RAIL_TxPowerCurvesConfig_t txPowerCurvesConfig = { curves24Hp, curvesSg, curves24Lp, piecewiseSegments };
2385 ///
2386 /// // Saves those curves
2387 /// // to be referenced when the conversion functions are called.
2388 /// RAIL_InitTxPowerCurves(&txPowerCurvesConfig);
2389 ///
2390 /// // Declares the structure used to configure the PA.
2391 /// RAIL_TxPowerConfig_t txPowerConfig = { RAIL_TX_POWER_MODE_2P4_HP, 3300, 10 };
2392 ///
2393 /// // Initializes the PA. Here, it is assumed that 'railHandle' is a valid RAIL_Handle_t
2394 /// // that has already been initialized.
2395 /// RAIL_ConfigTxPower(railHandle, &txPowerConfig);
2396 ///
2397 /// // Picks a dBm power to use: 100 deci-dBm = 10 dBm. See docs on RAIL_TxPower_t.
2398 /// RAIL_TxPower_t power = 100;
2399 ///
2400 /// // Gets the config written by RAIL_ConfigTxPower to confirm what was actually set.
2401 /// RAIL_GetTxPowerConfig(railHandle, &txPowerConfig);
2402 ///
2403 /// // RAIL_ConvertDbmToRaw is the default weak version,
2404 /// // or the customer version, if overwritten.
2405 /// RAIL_TxPowerLevel_t powerLevel = RAIL_ConvertDbmToRaw(railHandle,
2406 /// txPowerConfig.mode,
2407 /// power);
2408 ///
2409 /// // Writes the result of the conversion to the PA power registers in terms
2410 /// // of raw power levels.
2411 /// RAIL_SetTxPower(railHandle, powerLevel);
2412 /// @endcode
2413 ///
2414 /// @note All lines following "RAIL_TxPower_t power = 100;" can be
2415 /// replaced with the provided utility function, \ref RAIL_SetTxPowerDbm.
2416 /// However, the full example here was provided for clarity. See the
2417 /// documentation on \ref RAIL_SetTxPowerDbm for more details.
2418 ///
2419 /// @{
2420
2421 /**
2422 * Initialize TX power settings.
2423 *
2424 * @param[in] railHandle A RAIL instance handle.
2425 * @param[in] config An instance which contains desired initial settings
2426 * for the TX amplifier.
2427 * @return RAIL_Status_t indicating success or an error.
2428 *
2429 * These settings include the selection between the multiple TX amplifiers,
2430 * voltage supplied to the TX power amplifier, and ramp times. This must
2431 * be called before any transmit occurs or \ref RAIL_SetTxPower is called.
2432 * While this function should always be called during initialization,
2433 * it can also be called any time if these settings need to change to adapt
2434 * to a different application/protocol. This API also resets TX power to
2435 * \ref RAIL_TX_POWER_LEVEL_INVALID, so \ref RAIL_SetTxPower must be called
2436 * afterwards.
2437 *
2438 * At times, certain combinations of configurations cannot be achieved.
2439 * This API attempts to get as close as possible to the requested settings. The
2440 * following "RAIL_Get..." API can be used to determine what values were set. A
2441 * change in \ref RAIL_TxPowerConfig_t::rampTime may affect the minimum timings
2442 * that can be achieved in \ref RAIL_StateTiming_t::idleToTx and
2443 * \ref RAIL_StateTiming_t::rxToTx. Call \ref RAIL_SetStateTiming() again to
2444 * check whether these times have changed.
2445 */
2446 RAIL_Status_t RAIL_ConfigTxPower(RAIL_Handle_t railHandle,
2447 const RAIL_TxPowerConfig_t *config);
2448
2449 /**
2450 * Get the TX power settings currently used in the amplifier.
2451 *
2452 * @param[in] railHandle A RAIL instance handle.
2453 * @param[out] config A pointer to memory allocated to hold the current TxPower
2454 * configuration structure. A NULL configuration will produce undefined
2455 * behavior.
2456 * @return RAIL status variable indicating whether or not the get was
2457 * successful.
2458 *
2459 * Note that this API does not return the current TX power, which is separately
2460 * managed by the \ref RAIL_GetTxPower / \ref RAIL_SetTxPower APIs. Use this API
2461 * to determine which values were set as a result of
2462 * \ref RAIL_ConfigTxPower.
2463 */
2464 RAIL_Status_t RAIL_GetTxPowerConfig(RAIL_Handle_t railHandle,
2465 RAIL_TxPowerConfig_t *config);
2466
2467 /**
2468 * Set the TX power in units of raw units (see \ref rail_chip_specific.h for
2469 * value ranges).
2470 *
2471 * @param[in] railHandle A RAIL instance handle.
2472 * @param[in] powerLevel Power in chip-specific \ref RAIL_TxPowerLevel_t units.
2473 * @return RAIL_Status_t indicating success or an error.
2474 *
2475 * To convert between decibels and the integer values that the
2476 * registers take, call \ref RAIL_ConvertDbmToRaw.
2477 * A weak version of this function, which works well with our boards is provided. However,
2478 * customers using a custom board need to characterize
2479 * chip operation on that board and override the function to convert
2480 * appropriately from the desired dB values to raw integer values.
2481 *
2482 * Depending on the configuration used in \ref RAIL_ConfigTxPower, not all
2483 * power levels are achievable. This API will get as close as possible to
2484 * the desired power without exceeding it, and calling \ref RAIL_GetTxPower is
2485 * the only way to know the exact value written.
2486 *
2487 * Calling this function before configuring the PA (i.e., before a successful
2488 * call to \ref RAIL_ConfigTxPower) will return an error.
2489 */
2490 RAIL_Status_t RAIL_SetTxPower(RAIL_Handle_t railHandle,
2491 RAIL_TxPowerLevel_t powerLevel);
2492
2493 /**
2494 * Return the current power setting of the PA.
2495 *
2496 * @param[in] railHandle A RAIL instance handle.
2497 * @return The chip-specific \ref RAIL_TxPowerLevel_t value of the current
2498 * transmit power.
2499 *
2500 * This API returns the raw value that was set by \ref RAIL_SetTxPower.
2501 * A weak version of \ref RAIL_ConvertRawToDbm that works
2502 * with our boards to convert the raw values into actual output dBm values is provided.
2503 * However, customers using a custom board need to
2504 * re-characterize the relationship between raw and decibel values and rewrite
2505 * the provided function.
2506 *
2507 * Calling this function before configuring the PA (i.e., before a successful
2508 * call to \ref RAIL_ConfigTxPower) will return an error
2509 * (RAIL_TX_POWER_LEVEL_INVALID).
2510 */
2511 RAIL_TxPowerLevel_t RAIL_GetTxPower(RAIL_Handle_t railHandle);
2512
2513 /**
2514 * Convert raw values written to registers to decibel value (in units of
2515 * deci-dBm).
2516 *
2517 * @param[in] railHandle A RAIL instance handle.
2518 * @param[in] mode PA mode for which to convert.
2519 * @param[in] powerLevel A raw amplifier register value to be converted to
2520 * deci-dBm.
2521 * @return raw amplifier values converted to units of deci-dBm.
2522 *
2523 * A weak version of this function is provided that is tuned
2524 * to provide accurate values for our boards. For a
2525 * custom board, the relationship between what is written to the TX amplifier
2526 * and the actual output power should be re-characterized and implemented in an
2527 * overriding version of \ref RAIL_ConvertRawToDbm. For minimum code size and
2528 * best speed, use only raw values with the TxPower API and override this
2529 * function with a smaller function. In the weak version provided with the RAIL
2530 * library, railHandle is only used to indicate to the user from where the
2531 * function was called, so it is OK to use either a real protocol handle, or one
2532 * of the chip-specific ones, such as \ref RAIL_EFR32_HANDLE.
2533 *
2534 * Although the definitions of this function may change, the signature
2535 * must be as declared here.
2536 */
2537 RAIL_TxPower_t RAIL_ConvertRawToDbm(RAIL_Handle_t railHandle,
2538 RAIL_TxPowerMode_t mode,
2539 RAIL_TxPowerLevel_t powerLevel);
2540
2541 /**
2542 * Convert the desired decibel value (in units of deci-dBm)
2543 * to raw integer values used by the TX amplifier registers.
2544 *
2545 * @param[in] railHandle A RAIL instance handle.
2546 * @param[in] mode PA mode for which to do the conversion.
2547 * @param[in] power Desired dBm values in units of deci-dBm.
2548 * @return deci-dBm value converted to a raw
2549 * integer value that can be used directly with \ref RAIL_SetTxPower.
2550 *
2551 * A weak version of this function is provided that is tuned
2552 * to provide accurate values for our boards. For a
2553 * custom board, the relationship between what is written to the TX amplifier
2554 * and the actual output power should be characterized and implemented in an
2555 * overriding version of \ref RAIL_ConvertDbmToRaw. For minimum code size and
2556 * best speed use only raw values with the TxPower API and override this
2557 * function with a smaller function. In the weak version provided with the RAIL
2558 * library, railHandle is only used to indicate to the user from where the
2559 * function was called, so it is OK to use either a real protocol handle, or one
2560 * of the chip-specific ones, such as \ref RAIL_EFR32_HANDLE.
2561 *
2562 * Although the definitions of this function may change, the signature
2563 * must be as declared here.
2564 *
2565 * @note This function is called from within the RAIL library for
2566 * comparison between channel limitations and current power. It will
2567 * throw an assert if you haven't called RAIL_InitTxPowerCurves
2568 * which initializes the mappings between raw power levels and
2569 * actual dBm powers. To avoid the assert, ensure that the
2570 * maxPower of all channel configuration entries is \ref RAIL_TX_POWER_MAX
2571 * or above, or override this function to always return 255.
2572 */
2573 RAIL_TxPowerLevel_t RAIL_ConvertDbmToRaw(RAIL_Handle_t railHandle,
2574 RAIL_TxPowerMode_t mode,
2575 RAIL_TxPower_t power);
2576
2577 struct RAIL_TxPowerCurvesConfigAlt;
2578 /// Verify the TX Power Curves on modules.
2579 ///
2580 /// @param[in] config TX Power Curves to use on this module.
2581 ///
2582 /// This function only needs to be called when using a module and has no
2583 /// effect otherwise. Transmit will not work before this function is called.
2584 void RAIL_VerifyTxPowerCurves(const struct RAIL_TxPowerCurvesConfigAlt *config);
2585
2586 /// Set the TX power in terms of deci-dBm instead of raw power level.
2587 ///
2588 /// @param[in] railHandle A RAIL instance handle.
2589 /// @param[in] power A desired deci-dBm power to be set.
2590 /// @return RAIL Status variable indicate whether setting the
2591 /// power was successful.
2592 ///
2593 /// This is a utility function for user convenience. Normally, to set TX
2594 /// power in dBm, do the following:
2595 ///
2596 /// @code{.c}
2597 /// RAIL_TxPower_t power = 100; // 100 deci-dBm, 10 dBm
2598 /// RAIL_TxPowerConfig_t txPowerConfig;
2599 /// RAIL_GetTxPowerConfig(railHandle, &txPowerConfig);
2600 /// // RAIL_ConvertDbmToRaw will be the weak version provided by Silicon Labs
2601 /// // by default, or the customer version, if overwritten.
2602 /// RAIL_TxPowerLevel_t powerLevel = RAIL_ConvertDbmToRaw(railHandle,
2603 /// txPowerConfig.mode,
2604 /// power);
2605 /// RAIL_SetTxPower(railHandle, powerLevel);
2606 /// @endcode
2607 ///
2608 /// This function wraps all those calls in a single function with power passed in
2609 /// as a parameter.
2610 ///
2611 RAIL_Status_t RAIL_SetTxPowerDbm(RAIL_Handle_t railHandle,
2612 RAIL_TxPower_t power);
2613
2614 /// Get the TX power in terms of deci-dBm instead of raw power level.
2615 ///
2616 /// @param[in] railHandle A RAIL instance handle.
2617 /// @return The current output power in deci-dBm.
2618 ///
2619 /// This is a utility function for user convenience. Normally, to get TX
2620 /// power in dBm, do the following:
2621 ///
2622 /// @code{.c}
2623 /// RAIL_TxPowerLevel_t powerLevel = RAIL_GetTxPower(railHandle);
2624 /// RAIL_TxPowerConfig_t txPowerConfig;
2625 /// RAIL_GetTxPowerConfig(railHandle, &txPowerConfig);
2626 /// // RAIL_ConvertRawToDbm will be the weak version provided by Silicon Labs
2627 /// // by default, or the customer version, if overwritten.
2628 /// RAIL_TxPower_t power = RAIL_ConvertRawToDbm(railHandle,
2629 /// txPowerConfig.mode,
2630 /// powerLevel);
2631 /// return power;
2632 /// @endcode
2633 ///
2634 /// This function wraps all those calls in a single function with power returned
2635 /// as the result.
2636 ///
2637 RAIL_TxPower_t RAIL_GetTxPowerDbm(RAIL_Handle_t railHandle);
2638
2639 /**
2640 * Get the TX PA power setting table and related values.
2641 *
2642 * @param[in] railHandle A RAIL instance handle.
2643 * @param[in] mode PA mode for which to get the powersetting table
2644 * @param[out] minPower A pointer to a \ref RAIL_TxPower_t
2645 * @param[out] maxPower A pointer to a \ref RAIL_TxPower_t
2646 * @param[out] step In deci-dBm increments. A pointer to a \ref RAIL_TxPowerLevel_t
2647 * @return Power setting table start address. When NULL is returned all out params
2648 * above won't be set.
2649 *
2650 * The number of entries in the table can be calculated based on the minPower, maxPower,
2651 * and step parameters. For example, for minPower = 115 (11.5 dBm), maxPower = 300 (30 dBm),
2652 * and step = 1, the number of entries in table would be 186
2653 */
2654 const RAIL_PaPowerSetting_t *RAIL_GetPowerSettingTable(RAIL_Handle_t railHandle, RAIL_TxPowerMode_t mode,
2655 RAIL_TxPower_t *minPower, RAIL_TxPower_t *maxPower,
2656 RAIL_TxPowerLevel_t *step);
2657
2658 /**
2659 * Set the TX PA power setting used to configure the PA hardware for the PA output
2660 * power determined by \ref RAIL_SetTxPowerDbm().
2661 *
2662 * @param[in] railHandle A RAIL instance handle.
2663 * @param[in] paPowerSetting The desired pa power setting.
2664 * @param[in] minPowerDbm The minimum power in dBm that the PA can output.
2665 * @param[in] maxPowerDbm The maximum power in dBm that the PA can output.
2666 * @param[in] currentPowerDbm The corresponding output power in dBm for this power setting.
2667 * @return RAIL Status variable indicate whether setting the
2668 * pa power setting was successful.
2669 */
2670 RAIL_Status_t RAIL_SetPaPowerSetting(RAIL_Handle_t railHandle,
2671 RAIL_PaPowerSetting_t paPowerSetting,
2672 RAIL_TxPower_t minPowerDbm,
2673 RAIL_TxPower_t maxPowerDbm,
2674 RAIL_TxPower_t currentPowerDbm);
2675
2676 /**
2677 * Get the TX pa power setting, which is used to configure power configurations
2678 * when the dBm to paPowerSetting mapping table mode is used.
2679 *
2680 * @param[in] railHandle A RAIL instance handle.
2681 * @return The current pa power setting.
2682 */
2683 RAIL_PaPowerSetting_t RAIL_GetPaPowerSetting(RAIL_Handle_t railHandle);
2684
2685 /**
2686 * Enable automatic switching between PAs internally to the RAIL library.
2687 * While PA Automode is enabled, the PA will be chosen and set automatically whenever
2688 * \ref RAIL_SetTxPowerDbm is called or whenever powers are coerced automatically,
2689 * internally to the RAIL library during a channel change. While PA Auto Mode
2690 * is enabled, users cannot call \ref RAIL_ConfigTxPower or
2691 * \ref RAIL_SetTxPower. When entering auto mode, \ref RAIL_SetTxPowerDbm must
2692 * be called to specify the desired power. When leaving auto mode,
2693 * \ref RAIL_ConfigTxPower as well as one of \ref RAIL_SetTxPower or
2694 * \ref RAIL_SetTxPowerDbm must be called to re-specify the desired PA and power
2695 * level combination.
2696 *
2697 * @note: Power conversion curves must be initialized before calling this function.
2698 * That is, \ref RAIL_ConvertDbmToRaw and \ref RAIL_ConvertRawToDbm most both be
2699 * able to operate properly to ensure that PA Auto Mode functions correctly.
2700 * See the PA Conversions plugin or AN1127 for more details.
2701 *
2702 * @param[in] railHandle A RAIL instance handle.
2703 * @param[in] enable Enable or disable PA Auto Mode.
2704 * @return Status parameter indicating success of function call.
2705 */
2706 RAIL_Status_t RAIL_EnablePaAutoMode(RAIL_Handle_t railHandle, bool enable);
2707
2708 /**
2709 * Query status of PA Auto Mode.
2710 *
2711 * @param[in] railHandle A RAIL instance handle on which to query PA Auto Mode status.
2712 * @return Indicator of whether Auto Mode is enabled (true) or not (false).
2713 */
2714 bool RAIL_IsPaAutoModeEnabled(RAIL_Handle_t railHandle);
2715
2716 /**
2717 * Callback that decides which PA and power level should be
2718 * used while in PA auto mode.
2719 *
2720 * @param[in] railHandle A RAIL instance handle.
2721 * @param[in,out] power Pointer to the dBm output power (in deci-dBm, 10*dBm)
2722 * being requested. The value this points to when the function returns
2723 * will be applied to the radio.
2724 * @param[out] mode Pointer to the \ref RAIL_TxPowerMode_t to be used to
2725 * achieve the requested power. The value this points to when the function
2726 * returns will be applied to the radio.
2727 * @param[in] chCfgEntry Pointer to a \ref RAIL_ChannelConfigEntry_t.
2728 * While switching channels, it will be the entry RAIL is switch *to*,
2729 * during a call to \ref RAIL_SetTxPowerDbm, it will be the entry
2730 * RAIL is *already on*. Can be NULL if a channel configuration
2731 * was not set or no valid channels are present.
2732 * @return Return status indicating result of function call. If this
2733 * is anything except \ref RAIL_STATUS_NO_ERROR, neither PA's nor their
2734 * powers will be configured automatically.
2735 *
2736 * Whatever values mode and powerLevel point to when this function return
2737 * will be applied to the PA hardware and used for transmits.
2738 * @note The mode and power level provided by this function depends on the
2739 * RAIL_PaAutoModeConfig provided for the chip. The RAIL_PaAutoModeConfig
2740 * definition for a chip should tend to all the bands supported by the chip and
2741 * cover the full range of power to find a valid entry for requested power
2742 * for a specific band.
2743 */
2744 RAIL_Status_t RAILCb_PaAutoModeDecision(RAIL_Handle_t railHandle,
2745 RAIL_TxPower_t *power,
2746 RAIL_TxPowerMode_t *mode,
2747 const RAIL_ChannelConfigEntry_t *chCfgEntry);
2748
2749 /** @} */ // end of group PA
2750
2751 /// @addtogroup Packet_TX Packet Transmit
2752 /// @brief APIs which initiate a packet transmission in RAIL
2753 ///
2754 /// When using any of these functions, the data to be transmitted must have been
2755 /// previously written to the Transmit FIFO via \ref RAIL_SetTxFifo() and/or
2756 /// \ref RAIL_WriteTxFifo().
2757 ///
2758 /// @{
2759
2760 /**
2761 * Start a transmit.
2762 *
2763 * @param[in] railHandle A RAIL instance handle.
2764 * @param[in] channel Define the channel to transmit on.
2765 * @param[in] options TX options to be applied to this transmit only.
2766 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2767 * this transmit appropriately. This is only used in multiprotocol version of
2768 * RAIL and may be set to NULL in all other versions.
2769 * @return Status code indicating success of the function call. If successfully
2770 * initiated, transmit completion or failure will be reported by a later
2771 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2772 *
2773 * The transmit process will begin immediately or as soon as a packet being
2774 * received has finished. The data to be transmitted must have been previously
2775 * established via \ref RAIL_SetTxFifo() and/or \ref RAIL_WriteTxFifo().
2776 *
2777 * Returns an error if a previous transmit is still in progress.
2778 * If changing channels, any ongoing packet reception is aborted.
2779 *
2780 * In multiprotocol, ensure that the radio is properly yielded after this
2781 * operation completes. See \ref rail_radio_scheduler_yield for more details.
2782 */
2783 RAIL_Status_t RAIL_StartTx(RAIL_Handle_t railHandle,
2784 uint16_t channel,
2785 RAIL_TxOptions_t options,
2786 const RAIL_SchedulerInfo_t *schedulerInfo);
2787
2788 /**
2789 * Schedule sending a packet.
2790 *
2791 * @param[in] railHandle A RAIL instance handle.
2792 * @param[in] channel Define the channel to transmit on.
2793 * @param[in] options TX options to be applied to this transmit only.
2794 * @param[in] config A pointer to the \ref RAIL_ScheduleTxConfig_t
2795 * structure containing when the transmit should occur.
2796 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2797 * this transmit appropriately. This is only used in multiprotocol version of
2798 * RAIL and may be set to NULL in all other versions.
2799 * @return Status code indicating success of the function call. If successfully
2800 * initiated, a transmit completion or failure will be reported by a later
2801 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2802 *
2803 * The transmit process will begin at the scheduled time. The data to be
2804 * transmitted must have been previously established via \ref RAIL_SetTxFifo()
2805 * and/or \ref RAIL_WriteTxFifo().
2806 * The time (in microseconds) and whether that time is absolute or
2807 * relative is specified using the \ref RAIL_ScheduleTxConfig_t structure.
2808 * What to do if a scheduled transmit fires in
2809 * the middle of receiving a packet is also specified in this structure.
2810 *
2811 * Returns an error if a previous transmit is still in progress.
2812 * If changing channels, the channel is changed immediately and
2813 * will abort any ongoing packet reception.
2814 *
2815 * In multiprotocol, ensure that the radio is properly yielded after this
2816 * operation completes. See \ref rail_radio_scheduler_yield for more details.
2817 */
2818 RAIL_Status_t RAIL_StartScheduledTx(RAIL_Handle_t railHandle,
2819 uint16_t channel,
2820 RAIL_TxOptions_t options,
2821 const RAIL_ScheduleTxConfig_t *config,
2822 const RAIL_SchedulerInfo_t *schedulerInfo);
2823
2824 /**
2825 * Start a transmit using CSMA.
2826 *
2827 * @param[in] railHandle A RAIL instance handle.
2828 * @param[in] channel Define the channel to transmit on.
2829 * @param[in] options TX options to be applied to this transmit only.
2830 * @param[in] csmaConfig A pointer to the RAIL_CsmaConfig_t structure
2831 * describing the CSMA parameters to use for this transmit.
2832 * \n In multiprotocol this must point to global or heap storage that remains
2833 * valid after the API returns until the transmit is actually started.
2834 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2835 * this transmit appropriately. This is only used in multiprotocol version of
2836 * RAIL and may be set to NULL in all other versions.
2837 * @return Status code indicating success of the function call. If successfully
2838 * initiated, a transmit completion or failure will be reported by a later
2839 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2840 *
2841 * Perform the Carrier Sense Multiple Access (CSMA) algorithm, and if
2842 * the channel is deemed clear (RSSI below the specified threshold), it will
2843 * commence transmission. The data to be transmitted must have been previously
2844 * established via \ref RAIL_SetTxFifo() and/or \ref RAIL_WriteTxFifo().
2845 * Packets can be received during CSMA backoff periods if receive is active
2846 * throughout the CSMA process. This will happen either by starting the CSMA
2847 * process while receive is already active, or if the csmaBackoff time in
2848 * the \ref RAIL_CsmaConfig_t is less than the idleToRx time (set by
2849 * RAIL_SetStateTiming()). If the csmaBackoff time is greater than the
2850 * idleToRx time, receive will only be active during CSMA's clear channel
2851 * assessments.
2852 *
2853 * If the CSMA algorithm deems the channel busy, the \ref RAIL_Config_t::eventsCallback
2854 * occurs with \ref RAIL_EVENT_TX_CHANNEL_BUSY, and the contents
2855 * of the transmit FIFO remain intact.
2856 *
2857 * Returns an error if a previous transmit is still in progress.
2858 * If changing channels, the channel is changed immediately and any ongoing
2859 * packet reception is aborted.
2860 *
2861 * Returns an error if a scheduled RX is still in progress.
2862 *
2863 * In multiprotocol, ensure that the radio is properly yielded after this
2864 * operation completes. See \ref rail_radio_scheduler_yield for more details.
2865 */
2866 RAIL_Status_t RAIL_StartCcaCsmaTx(RAIL_Handle_t railHandle,
2867 uint16_t channel,
2868 RAIL_TxOptions_t options,
2869 const RAIL_CsmaConfig_t *csmaConfig,
2870 const RAIL_SchedulerInfo_t *schedulerInfo);
2871
2872 /**
2873 * Start a transmit using LBT.
2874 *
2875 * @param[in] railHandle A RAIL instance handle.
2876 * @param[in] channel Define the channel to transmit on.
2877 * @param[in] options TX options to be applied to this transmit only.
2878 * @param[in] lbtConfig A pointer to the RAIL_LbtConfig_t structure
2879 * describing the LBT parameters to use for this transmit.
2880 * \n In multiprotocol this must point to global or heap storage that remains
2881 * valid after the API returns until the transmit is actually started.
2882 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2883 * this transmit appropriately. This is only used in multiprotocol version of
2884 * RAIL and may be set to NULL in all other versions.
2885 * @return Status code indicating success of the function call. If successfully
2886 * initiated, a transmit completion or failure will be reported by a later
2887 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2888 *
2889 * Performs the Listen Before Talk (LBT) algorithm, and if the channel
2890 * is deemed clear (RSSI below the specified threshold), it will commence
2891 * transmission. The data to be transmitted must have been previously established
2892 * via \ref RAIL_SetTxFifo() and/or \ref RAIL_WriteTxFifo().
2893 * Packets can be received during LBT backoff periods if receive is active
2894 * throughout the LBT process. This will happen either by starting the LBT
2895 * process while receive is already active, or if the lbtBackoff time in
2896 * the \ref RAIL_LbtConfig_t is less than the idleToRx time (set by
2897 * RAIL_SetStateTiming()). If the lbtBackoff time is greater than the
2898 * idleToRx time, receive will only be active during LBT's clear channel
2899 * assessments.
2900 *
2901 * If the LBT algorithm deems the channel busy, the \ref RAIL_Config_t::eventsCallback occurs with
2902 * \ref RAIL_EVENT_TX_CHANNEL_BUSY, and the contents
2903 * of the transmit FIFO remain intact.
2904 *
2905 * Returns an error if a previous transmit is still in progress.
2906 * If changing channels, the channel is changed immediately and any ongoing
2907 * packet reception is aborted.
2908 *
2909 * Returns an error if a scheduled RX is still in progress.
2910 *
2911 * In multiprotocol, ensure that the radio is properly yielded after this
2912 * operation completes. See \ref rail_radio_scheduler_yield for more details.
2913 */
2914 RAIL_Status_t RAIL_StartCcaLbtTx(RAIL_Handle_t railHandle,
2915 uint16_t channel,
2916 RAIL_TxOptions_t options,
2917 const RAIL_LbtConfig_t *lbtConfig,
2918 const RAIL_SchedulerInfo_t *schedulerInfo);
2919
2920 /**
2921 * Schedule a transmit using CSMA.
2922 *
2923 * @param[in] railHandle A RAIL instance handle.
2924 * @param[in] channel Define the channel to transmit on.
2925 * @param[in] options TX options to be applied to this transmit only.
2926 * @param[in] scheduleTxConfig A pointer to the \ref RAIL_ScheduleTxConfig_t
2927 * structure describing the CSMA parameters to use for this transmit.
2928 * @param[in] csmaConfig A pointer to the \ref RAIL_CsmaConfig_t structure
2929 * describing the CSMA parameters to use for this transmit.
2930 * \n In multiprotocol this must point to global or heap storage that remains
2931 * valid after the API returns until the transmit is actually started.
2932 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2933 * this transmit appropriately. This is only used in multiprotocol version of
2934 * RAIL and may be set to NULL in all other versions.
2935 * @return Status code indicating success of the function call. If successfully
2936 * initiated, a transmit completion or failure will be reported by a later
2937 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2938 *
2939 * Internally, the RAIL library needs a PRS channel for this feature.
2940 * It will allocate an available PRS channel to use and hold onto that
2941 * channel for future use. If no PRS channel is available, the function
2942 * returns with \ref RAIL_STATUS_INVALID_CALL.
2943 *
2944 * Perform the Carrier Sense Multiple Access (CSMA) algorithm at the scheduled time,
2945 * and if the channel is deemed clear (RSSI below the specified threshold), it will
2946 * commence transmission. The data to be transmitted must have been previously
2947 * established via \ref RAIL_SetTxFifo() and/or \ref RAIL_WriteTxFifo().
2948 * Packets can be received during CSMA backoff periods if receive is active
2949 * throughout the CSMA process. This will happen either by starting the CSMA
2950 * process while receive is already active, or if the csmaBackoff time in
2951 * the \ref RAIL_CsmaConfig_t is less than the idleToRx time (set by
2952 * RAIL_SetStateTiming()). If the csmaBackoff time is greater than the
2953 * idleToRx time, receive will only be active during CSMA's clear channel
2954 * assessments.
2955 *
2956 * If the CSMA algorithm deems the channel busy, the \ref RAIL_Config_t::eventsCallback
2957 * occurs with \ref RAIL_EVENT_TX_CHANNEL_BUSY, and the contents
2958 * of the transmit FIFO remain intact.
2959 *
2960 * Returns an error if a previous transmit is still in progress.
2961 * If changing channels, the channel is changed immediately and any ongoing
2962 * packet reception is aborted.
2963 *
2964 * In multiprotocol, ensure that the radio is properly yielded after this
2965 * operation completes. See \ref rail_radio_scheduler_yield for more details.
2966 */
2967 RAIL_Status_t RAIL_StartScheduledCcaCsmaTx(RAIL_Handle_t railHandle,
2968 uint16_t channel,
2969 RAIL_TxOptions_t options,
2970 const RAIL_ScheduleTxConfig_t *scheduleTxConfig,
2971 const RAIL_CsmaConfig_t *csmaConfig,
2972 const RAIL_SchedulerInfo_t *schedulerInfo);
2973
2974 /**
2975 * Schedule a transmit using LBT.
2976 *
2977 * @param[in] railHandle A RAIL instance handle.
2978 * @param[in] channel Define the channel to transmit on.
2979 * @param[in] options TX options to be applied to this transmit only.
2980 * @param[in] scheduleTxConfig A pointer to the \ref RAIL_ScheduleTxConfig_t
2981 * structure describing the CSMA parameters to use for this transmit.
2982 * @param[in] lbtConfig A pointer to the \ref RAIL_LbtConfig_t structure
2983 * describing the LBT parameters to use for this transmit.
2984 * \n In multiprotocol this must point to global or heap storage that remains
2985 * valid after the API returns until the transmit is actually started.
2986 * @param[in] schedulerInfo Information to allow the radio scheduler to place
2987 * this transmit appropriately. This is only used in multiprotocol version of
2988 * RAIL and may be set to NULL in all other versions.
2989 * @return Status code indicating success of the function call. If successfully
2990 * initiated, a transmit completion or failure will be reported by a later
2991 * \ref RAIL_Config_t::eventsCallback with the appropriate \ref RAIL_Events_t.
2992 *
2993 * Internally, the RAIL library needs a PRS channel for this feature.
2994 * It will allocate an available PRS channel to use and hold onto that
2995 * channel for future use. If no PRS channel is available, the function
2996 * returns with \ref RAIL_STATUS_INVALID_CALL.
2997 *
2998 * Performs the Listen Before Talk (LBT) algorithm at the scheduled time,
2999 * and if the channel is deemed clear (RSSI below the specified threshold), it will
3000 * commence transmission. The data to be transmitted must have been previously
3001 * established via \ref RAIL_SetTxFifo() and/or \ref RAIL_WriteTxFifo().
3002 * Packets can be received during LBT backoff periods if receive is active
3003 * throughout the LBT process. This will happen either by starting the LBT
3004 * process while receive is already active, or if the lbtBackoff time in
3005 * the \ref RAIL_LbtConfig_t is less than the idleToRx time (set by
3006 * RAIL_SetStateTiming()). If the lbtBackoff time is greater than the
3007 * idleToRx time, receive will only be active during LBT's clear channel
3008 * assessments.
3009 *
3010 * If the LBT algorithm deems the channel busy, the \ref RAIL_Config_t::eventsCallback
3011 * occurs with \ref RAIL_EVENT_TX_CHANNEL_BUSY, and the contents of the transmit
3012 * FIFO remain intact.
3013 *
3014 * Returns an error if a previous transmit is still in progress.
3015 * If changing channels, the channel is changed immediately and any ongoing
3016 * packet reception is aborted.
3017 *
3018 * In multiprotocol, ensure that the radio is properly yielded after this
3019 * operation completes. See \ref rail_radio_scheduler_yield for more details.
3020 */
3021 RAIL_Status_t RAIL_StartScheduledCcaLbtTx(RAIL_Handle_t railHandle,
3022 uint16_t channel,
3023 RAIL_TxOptions_t options,
3024 const RAIL_ScheduleTxConfig_t *scheduleTxConfig,
3025 const RAIL_LbtConfig_t *lbtConfig,
3026 const RAIL_SchedulerInfo_t *schedulerInfo);
3027
3028 /** @} */ // end of group Packet_TX
3029
3030 /**
3031 * Stop an active or pending transmit.
3032 *
3033 * @param[in] railHandle A RAIL instance handle.
3034 * @param[in] mode Configure the types of transmits to stop.
3035 * @return \ref RAIL_STATUS_NO_ERROR if the transmit was successfully
3036 * canceled.
3037 * Returns \ref RAIL_STATUS_INVALID_STATE if the requested
3038 * transmit mode cannot be stopped.
3039 *
3040 * @note This function will stop an auto-ACK in active transmit.
3041 */
3042 RAIL_Status_t RAIL_StopTx(RAIL_Handle_t railHandle, RAIL_StopMode_t mode);
3043
3044 /**
3045 * Set the CCA threshold in dBm.
3046 *
3047 * @param[in] railHandle A RAIL instance handle.
3048 * @param[in] ccaThresholdDbm The CCA threshold in dBm.
3049 * @return Status code indicating success of the function call.
3050 *
3051 * Unlike RAIL_StartCcaCsmaTx() or RAIL_StartCcaLbtTx(), which can cause a
3052 * transmit, this function only modifies the CCA threshold. A possible
3053 * use case for this function involves setting the CCA threshold to invalid RSSI
3054 * of -128 which blocks transmission by preventing clear channel assessments
3055 * from succeeding.
3056 */
3057 RAIL_Status_t RAIL_SetCcaThreshold(RAIL_Handle_t railHandle,
3058 int8_t ccaThresholdDbm);
3059
3060 /**
3061 * Get detailed information about the last packet transmitted.
3062 *
3063 * @param[in] railHandle A RAIL instance handle.
3064 * @param[in,out] pPacketDetails An application-provided pointer to store
3065 * RAIL_TxPacketDetails_t corresponding to the transmit event.
3066 * The isAck and timeSent fields totalPacketBytes and timePosition
3067 * must be initialized prior to each call:
3068 * - isAck true to obtain details about the most recent ACK transmit,
3069 * false to obtain details about the most recent app-initiated transmit.
3070 * - totalPacketBytes with the total number of bytes of the transmitted
3071 * packet for RAIL to use when calculating the specified timestamp.
3072 * This should account for all bytes sent over the air after the
3073 * Preamble and Sync word(s), including CRC bytes.
3074 * - timePosition with a \ref RAIL_PacketTimePosition_t value specifying
3075 * the packet position to put in the timeSent field on return.
3076 * This field will also be updated with the actual position corresponding
3077 * to the timeSent value filled in.
3078 * @return \ref RAIL_STATUS_NO_ERROR if pPacketDetails was filled in,
3079 * or an appropriate error code otherwise.
3080 *
3081 * @note Consider using \ref RAIL_GetTxPacketDetailsAlt2 for smaller code size.
3082 *
3083 * This function can only be called from callback context for either
3084 * \ref RAIL_EVENT_TX_PACKET_SENT or \ref RAIL_EVENT_TXACK_PACKET_SENT
3085 * events.
3086 */
3087 RAIL_Status_t RAIL_GetTxPacketDetails(RAIL_Handle_t railHandle,
3088 RAIL_TxPacketDetails_t *pPacketDetails);
3089
3090 /**
3091 * Get detailed information about the last packet transmitted.
3092 *
3093 * @param[in] railHandle A RAIL instance handle.
3094 * @param[in] isAck True to obtain details about the most recent ACK transmit.
3095 * False to obtain details about the most recent app-initiated transmit.
3096 * @param[out] pPacketTime An application-provided non-NULL pointer to store a
3097 * RAIL_Time_t corresponding to the transmit event. This will be populated
3098 * with a timestamp corresponding to an arbitrary location in the packet. Call
3099 * \ref RAIL_GetTxTimePreambleStart, \ref RAIL_GetTxTimeSyncWordEnd, or
3100 * \ref RAIL_GetTxTimeFrameEnd to adjust the timestamp for different locations
3101 * in the packet.
3102 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was filled in,
3103 * or an appropriate error code otherwise.
3104 *
3105 * @note Consider using \ref RAIL_GetTxPacketDetailsAlt2 to pass in
3106 * a \ref RAIL_PacketTimeStamp_t structure instead of a \ref RAIL_Time_t
3107 * structure, particularly when \ref RAIL_PacketTimePosition_t information
3108 * is needed or useful.
3109 *
3110 * This function can only be called from callback context for either
3111 * \ref RAIL_EVENT_TX_PACKET_SENT or \ref RAIL_EVENT_TXACK_PACKET_SENT
3112 * events.
3113 */
3114 RAIL_Status_t RAIL_GetTxPacketDetailsAlt(RAIL_Handle_t railHandle,
3115 bool isAck,
3116 RAIL_Time_t *pPacketTime);
3117
3118 /**
3119 * Get detailed information about the last packet transmitted.
3120 *
3121 * @param[in] railHandle A RAIL instance handle.
3122 * @param[in, out] pPacketDetails An application-provided pointer to store
3123 * RAIL_TxPacketDetails_t corresponding to the transmit event.
3124 * The isAck must be initialized prior to each call:
3125 * - isAck true to obtain details about the most recent ACK transmit,
3126 * false to obtain details about the most recent app-initiated transmit.
3127 * The timeSent field packetTime will be populated with a timestamp corresponding
3128 * to a default location in the packet. The timeSent field timePosition will
3129 * be populated with a \ref RAIL_PacketTimePosition_t value specifying that
3130 * default packet location. Call \ref RAIL_GetTxTimePreambleStartAlt,
3131 * \ref RAIL_GetTxTimeSyncWordEndAlt, or \ref RAIL_GetTxTimeFrameEndAlt to
3132 * adjust the timestamp for different locations in the packet.
3133 * @return \ref RAIL_STATUS_NO_ERROR if pPacketDetails was filled in,
3134 * or an appropriate error code otherwise.
3135 *
3136 * This function can only be called from callback context for either
3137 * \ref RAIL_EVENT_TX_PACKET_SENT or \ref RAIL_EVENT_TXACK_PACKET_SENT
3138 * events.
3139 */
3140 RAIL_Status_t RAIL_GetTxPacketDetailsAlt2(RAIL_Handle_t railHandle,
3141 RAIL_TxPacketDetails_t *pPacketDetails);
3142
3143 /**
3144 * Adjust a RAIL TX completion timestamp to refer to the start of the
3145 * preamble. Also used to retrieve the \ref RAIL_EVENT_TX_STARTED
3146 * timestamp.
3147 *
3148 * @param[in] railHandle A RAIL instance handle.
3149 * @param[in] totalPacketBytes The total number of bytes of the transmitted
3150 * packet for RAIL to use when adjusting the provided timestamp. This
3151 * should account for all bytes transmitted over the air after the Preamble
3152 * and Sync word(s), including CRC bytes. Pass \ref RAIL_TX_STARTED_BYTES
3153 * to retrieve the start-of-normal-TX timestamp (see below).
3154 * @param[in, out] pPacketTime This points to the \ref RAIL_Time_t returned
3155 * from a previous call to \ref RAIL_GetTxPacketDetailsAlt for this same
3156 * packet. That time will be updated with the time that the preamble for
3157 * this packet started on air.
3158 * Must be non-NULL.
3159 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully
3160 * determined or an appropriate error code otherwise.
3161 *
3162 * When used for timestamp adjustment, call this function in the
3163 * same transmit-complete event-handling context as
3164 * \ref RAIL_GetTxPacketDetailsAlt() is called.
3165 *
3166 * This function may be called when handling the \ref RAIL_EVENT_TX_STARTED
3167 * event to retrieve that event's start-of-normal-TX timestamp. (ACK
3168 * transmits currently have no equivalent event or associated timestamp.)
3169 * In this case, totalPacketBytes must be \ref RAIL_TX_STARTED_BYTES, and
3170 * pPacketTime is an output-only parameter filled in with that time (so no
3171 * need to initialize it beforehand by calling \ref
3172 * RAIL_GetTxPacketDetailsAlt()).
3173 *
3174 */
3175 RAIL_Status_t RAIL_GetTxTimePreambleStart(RAIL_Handle_t railHandle,
3176 uint16_t totalPacketBytes,
3177 RAIL_Time_t *pPacketTime);
3178
3179 /**
3180 * Adjust a RAIL TX completion timestamp to refer to the start of the
3181 * preamble. Also used to retrieve the \ref RAIL_EVENT_TX_STARTED
3182 * timestamp.
3183 *
3184 * @param[in] railHandle A RAIL instance handle.
3185 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3186 * a previous call to \ref RAIL_GetTxPacketDetailsAlt2 for this same packet.
3187 * The application must update the timeSent field totalPacketBytes to be
3188 * the total number of bytes of the sent packet for RAIL to use when
3189 * calculating the specified timestamp. This should account for all bytes
3190 * transmitted over the air after the Preamble and Sync word(s), including CRC
3191 * bytes. Pass \ref RAIL_TX_STARTED_BYTES to retrieve the start-of-normal-TX
3192 * timestamp (see below). After this function, the timeSent field packetTime
3193 * will be updated with the time that the preamble for this packet started on air.
3194 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3195 * calculated, or an appropriate error code otherwise.
3196 *
3197 * When used for timestamp adjustment, call this function in the
3198 * same transmit-complete event-handling context as
3199 * \ref RAIL_GetTxPacketDetailsAlt2() is called.
3200 *
3201 * This function may be called when handling the \ref RAIL_EVENT_TX_STARTED
3202 * event to retrieve that event's start-of-normal-TX timestamp. (ACK
3203 * transmits currently have no equivalent event or associated timestamp.)
3204 * In this case, the timeSent field totalPacketBytes must be
3205 * \ref RAIL_TX_STARTED_BYTES, and the timeSent field packetTime is an
3206 * output-only parameter filled in with that time (so no need to initialize
3207 * it beforehand by calling \ref RAIL_GetTxPacketDetailsAlt2()).
3208 *
3209 */
3210 RAIL_Status_t RAIL_GetTxTimePreambleStartAlt(RAIL_Handle_t railHandle,
3211 RAIL_TxPacketDetails_t *pPacketDetails);
3212
3213 /**
3214 * Adjust a RAIL TX timestamp to refer to the end of the sync word.
3215 *
3216 * @param[in] railHandle A RAIL instance handle.
3217 * @param[in] totalPacketBytes The total number of bytes of the transmitted
3218 * packet for RAIL to use when calculating the specified timestamp. This
3219 * should account for all bytes transmitted over the air after the Preamble
3220 * and Sync word(s), including CRC bytes.
3221 * @param[in, out] pPacketTime The time that was returned in a
3222 * \ref RAIL_Time_t from a previous call to \ref RAIL_GetTxPacketDetailsAlt
3223 * for this same packet. After this function, the time at that location will
3224 * be updated with the time that the sync word for this packet finished on
3225 * air. Must be non-NULL.
3226 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully calculated,
3227 * or an appropriate error code otherwise.
3228 *
3229 * Call the timestamp adjustment function in the same
3230 * transmit-complete event-handling context as
3231 * \ref RAIL_GetTxPacketDetailsAlt() is called.
3232 */
3233 RAIL_Status_t RAIL_GetTxTimeSyncWordEnd(RAIL_Handle_t railHandle,
3234 uint16_t totalPacketBytes,
3235 RAIL_Time_t *pPacketTime);
3236
3237 /**
3238 * Adjust a RAIL TX timestamp to refer to the end of the sync word.
3239 *
3240 * @param[in] railHandle A RAIL instance handle.
3241 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3242 * a previous call to \ref RAIL_GetTxPacketDetailsAlt2 for this same packet.
3243 * The application must update the timeSent field totalPacketBytes to be
3244 * the total number of bytes of the sent packet for RAIL to use when
3245 * calculating the specified timestamp. This should account for all bytes
3246 * transmitted over the air after the Preamble and Sync word(s), including CRC
3247 * bytes. Pass \ref RAIL_TX_STARTED_BYTES to retrieve the start-of-normal-TX
3248 * timestamp (see below). After this function, the timeSent field packetTime
3249 * will be updated with the time that the sync word for this packet finished on
3250 * air. Must be non-NULL.
3251 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3252 * calculated, or an appropriate error code otherwise.
3253 *
3254 * Call the timestamp adjustment function in the same
3255 * transmit-complete event-handling context as
3256 * \ref RAIL_GetTxPacketDetailsAlt2() is called.
3257 */
3258 RAIL_Status_t RAIL_GetTxTimeSyncWordEndAlt(RAIL_Handle_t railHandle,
3259 RAIL_TxPacketDetails_t *pPacketDetails);
3260
3261 /**
3262 * Adjust a RAIL TX timestamp to refer to the end of frame.
3263 *
3264 * @param[in] railHandle A RAIL instance handle.
3265 * @param[in] totalPacketBytes The total number of bytes of the transmitted
3266 * packet for RAIL to use when calculating the specified timestamp. This
3267 * should account for all bytes transmitted over the air after the Preamble
3268 * and Sync word(s), including CRC bytes.
3269 * @param[in, out] pPacketTime The time that was returned in a
3270 * \ref RAIL_Time_t from a previous call to \ref RAIL_GetTxPacketDetailsAlt
3271 * for this same packet. After this function, the time at that location will
3272 * be updated with the time that this packet finished on air. Must be
3273 * non-NULL.
3274 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully calculated,
3275 * or an appropriate error code otherwise.
3276 *
3277 * Call the timestamp adjustment function in the same
3278 * transmit-complete event-handling context as
3279 * \ref RAIL_GetTxPacketDetailsAlt() is called.
3280 */
3281 RAIL_Status_t RAIL_GetTxTimeFrameEnd(RAIL_Handle_t railHandle,
3282 uint16_t totalPacketBytes,
3283 RAIL_Time_t *pPacketTime);
3284
3285 /**
3286 * Adjust a RAIL TX timestamp to refer to the end of frame.
3287 *
3288 * @param[in] railHandle A RAIL instance handle.
3289
3290 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3291 * a previous call to \ref RAIL_GetTxPacketDetailsAlt2 for this same packet.
3292 * The application must update the timeSent field totalPacketBytes to be
3293 * the total number of bytes of the sent packet for RAIL to use when
3294 * calculating the specified timestamp. This should account for all bytes
3295 * transmitted over the air after the Preamble and Sync word(s), including CRC
3296 * bytes. Pass \ref RAIL_TX_STARTED_BYTES to retrieve the start-of-normal-TX
3297 * timestamp (see below). After this function, the timeSent field packetTime
3298 * will be updated with the time that this packet finished on air. Must be
3299 * non-NULL.
3300 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3301 * calculated, or an appropriate error code otherwise.
3302 *
3303 * Call the timestamp adjustment function in the same
3304 * transmit-complete event-handling context as
3305 * \ref RAIL_GetTxPacketDetailsAlt2() is called.
3306 */
3307 RAIL_Status_t RAIL_GetTxTimeFrameEndAlt(RAIL_Handle_t railHandle,
3308 RAIL_TxPacketDetails_t *pPacketDetails);
3309
3310 /**
3311 * Prevent the radio from starting a transmit.
3312 *
3313 * @param[in] railHandle A RAIL instance handle.
3314 * @param[in] enable Enable/Disable TX hold off.
3315 *
3316 * Enable TX hold off to prevent the radio from starting any transmits.
3317 * Disable TX hold off to allow the radio to transmit again.
3318 * Attempting to transmit with the TX hold off enabled will result in
3319 * \ref RAIL_EVENT_TX_BLOCKED and/or \ref RAIL_EVENT_TXACK_BLOCKED
3320 * events.
3321 *
3322 * @note This function does not affect a transmit that has already started.
3323 * To stop an already-started transmission, use RAIL_Idle() with
3324 * \ref RAIL_IDLE_ABORT.
3325 */
3326 void RAIL_EnableTxHoldOff(RAIL_Handle_t railHandle, bool enable);
3327
3328 /**
3329 * Check whether or not TX hold off is enabled.
3330 *
3331 * @param[in] railHandle A RAIL instance handle.
3332 * @return Returns true if TX hold off is enabled, false otherwise.
3333 *
3334 * TX hold off can be enabled/disabled using \ref RAIL_EnableTxHoldOff.
3335 * Attempting to transmit with the TX hold off enabled will block the
3336 * transmission and result in \ref RAIL_EVENT_TX_BLOCKED
3337 * and/or \ref RAIL_EVENT_TXACK_BLOCKED events.
3338 */
3339 bool RAIL_IsTxHoldOffEnabled(RAIL_Handle_t railHandle);
3340
3341 /**
3342 * Set an alternate transmitter preamble length.
3343 *
3344 * @param[in] railHandle A RAIL instance handle.
3345 * @param[in] length The desired preamble length, in bits.
3346 * @return Status code indicating success of the function call.
3347 *
3348 * @note Attempting to set a preamble length of 0xFFFF bits will result in
3349 * \ref RAIL_STATUS_INVALID_PARAMETER.
3350 **/
3351 RAIL_Status_t RAIL_SetTxAltPreambleLength(RAIL_Handle_t railHandle, uint16_t length);
3352
3353 /** @} */ // end of group Transmit
3354
3355 /******************************************************************************
3356 * Receive
3357 *****************************************************************************/
3358 /**
3359 * @addtogroup Receive
3360 * @brief APIs related to packet receive
3361 * @{
3362 */
3363
3364 /**
3365 * Configure receive options.
3366 *
3367 * @param[in] railHandle A RAIL instance handle.
3368 * @param[in] mask A bitmask containing which options should be modified.
3369 * @param[in] options A bitmask containing desired configuration settings.
3370 * Bit positions for each option are found in the \ref RAIL_RxOptions_t.
3371 * @return Status code indicating success of the function call.
3372 *
3373 * Configure the radio receive flow based on the list of available options.
3374 * Only the options indicated by the mask parameter will be affected. Pass
3375 * \ref RAIL_RX_OPTIONS_ALL to set all parameters.
3376 * The previous settings may affect the current frame if a packet is
3377 * received during this configuration.
3378 *
3379 * @note: On chips where \ref RAIL_IEEE802154_SUPPORTS_RX_CHANNEL_SWITCHING
3380 * is true, enabling \ref RAIL_RX_OPTION_CHANNEL_SWITCHING without configuring
3381 * RX channel switching, via \ref RAIL_IEEE802154_ConfigRxChannelSwitching,
3382 * will return \ref RAIL_STATUS_INVALID_PARAMETER for only this option.
3383 * Any other RX options (except antenna selection) would still take effect.
3384 */
3385 RAIL_Status_t RAIL_ConfigRxOptions(RAIL_Handle_t railHandle,
3386 RAIL_RxOptions_t mask,
3387 RAIL_RxOptions_t options);
3388
3389 /**
3390 * Include the code necessary for frame type based length decoding.
3391 *
3392 * @param[in] railHandle A RAIL instance handle.
3393 *
3394 * This function must be called before \ref RAIL_ConfigChannels to allow configurations
3395 * using a frame type based length setup. In RAIL 2.x, it is called by default
3396 * in the \ref RAILCb_ConfigFrameTypeLength API which can be overridden to save
3397 * code space. In future versions, the user may be required to call this API
3398 * explicitly.
3399 */
3400 void RAIL_IncludeFrameTypeLength(RAIL_Handle_t railHandle);
3401
3402 /**
3403 * Handle frame type length.
3404 *
3405 * @param[in] railHandle A RAIL instance handle.
3406 * @param[in] frameType A frame type configuration structure.
3407 *
3408 * This function is implemented in the radio configuration.
3409 * Currently, the frame type passed in only handles packet length decoding. If
3410 * NULL is passed into this function, it clears any currently configured
3411 * frame type settings. This will either be implemented as an empty function in
3412 * the radio configuration if it is not needed, to assist in dead code
3413 * elimination.
3414 */
3415 void RAILCb_ConfigFrameTypeLength(RAIL_Handle_t railHandle,
3416 const RAIL_FrameType_t *frameType);
3417
3418 /**
3419 * Start the receiver on a specific channel.
3420 *
3421 * @param[in] railHandle A RAIL instance handle.
3422 * @param[in] channel The channel to listen on.
3423 * @param[in] schedulerInfo Information to allow the radio scheduler to place
3424 * this receive appropriately. This is only used in multiprotocol version of
3425 * RAIL and may be set to NULL in all other versions.
3426 * @return Status code indicating success of the function call.
3427 *
3428 * This is a non-blocking function. Whenever a packet is received, \ref RAIL_Config_t::eventsCallback
3429 * will fire with \ref RAIL_EVENT_RX_PACKET_RECEIVED set. If you call
3430 * this while not idle but with a different channel, any ongoing
3431 * receive or transmit operation will be aborted.
3432 */
3433 RAIL_Status_t RAIL_StartRx(RAIL_Handle_t railHandle,
3434 uint16_t channel,
3435 const RAIL_SchedulerInfo_t *schedulerInfo);
3436
3437 /**
3438 * Schedule a receive window for some future time.
3439 *
3440 * @param[in] railHandle A RAIL instance handle.
3441 * @param[in] channel A channel to listen on.
3442 * @param[in] cfg The configuration structure to define the receive window.
3443 * @param[in] schedulerInfo Information to allow the radio scheduler to place
3444 * this receive appropriately. This is only used in multiprotocol version of
3445 * RAIL and may be set to NULL in all other versions.
3446 * @return Status code indicating success of the function call.
3447 *
3448 * This API immediately changes the channel and schedules receive to start
3449 * at the specified time and end at the given end time. If you do not specify
3450 * an end time, you may call this API later with an end time as long as you set
3451 * the start time to disabled. You can also terminate the receive
3452 * operation immediately using the RAIL_Idle() function. Note that relative
3453 * end times are always relative to the start unless no start time is
3454 * specified. If changing channels, the channel is changed immediately and
3455 * will abort any ongoing packet transmission or reception.
3456 *
3457 * Returns an error if a CSMA or LBT transmit is still in progress.
3458 *
3459 * In multiprotocol, ensure that you properly yield the radio after this
3460 * call. See \ref rail_radio_scheduler_yield for more details.
3461 */
3462 RAIL_Status_t RAIL_ScheduleRx(RAIL_Handle_t railHandle,
3463 uint16_t channel,
3464 const RAIL_ScheduleRxConfig_t *cfg,
3465 const RAIL_SchedulerInfo_t *schedulerInfo);
3466
3467 /******************************************************************************
3468 * Packet Information (RX)
3469 *****************************************************************************/
3470 /// @addtogroup Packet_Information Packet Information
3471 /// @brief APIs to get information about received packets.
3472 ///
3473 /// After receiving a packet, RAIL will trigger a
3474 /// \ref RAIL_EVENT_RX_PACKET_RECEIVED event. At that point, there is a variety
3475 /// of information available to the application about the received packet. The
3476 /// following example code assumes that the
3477 /// \ref RAIL_RX_OPTION_REMOVE_APPENDED_INFO is not used, and the application
3478 /// wants as much data about the packet as possible.
3479 ///
3480 /// @code{.c}
3481 /// // Get all information about a received packet.
3482 /// RAIL_Status_t status;
3483 /// RAIL_RxPacketInfo_t rxInfo;
3484 /// RAIL_RxPacketDetails_t rxDetails;
3485 /// RAIL_RxPacketHandle_t rxHandle
3486 /// = RAIL_GetRxPacketInfo(railHandle, RAIL_RX_PACKET_HANDLE_NEWEST, &rxInfo);
3487 /// assert(rxHandle != RAIL_RX_PACKET_HANDLE_INVALID);
3488 /// status = RAIL_GetRxPacketDetailsAlt(railHandle, rxHandle, &rxDetails);
3489 /// assert(status == RAIL_STATUS_NO_ERROR);
3490 /// if (rxDetails.timeReceived.timePosition == RAIL_PACKET_TIME_INVALID) {
3491 /// return; // No timestamp available for this packet
3492 /// }
3493 /// // CRC_BYTES only needs to be added when not using RAIL_RX_OPTION_STORE_CRC
3494 /// rxDetails.timeReceived.totalPacketBytes = rxInfo.packetBytes + CRC_BYTES;
3495 /// // Choose the function which gives the desired timestamp
3496 /// status = RAIL_GetRxTimeFrameEndAlt(railHandle, &rxDetails);
3497 /// assert(status == RAIL_STATUS_NO_ERROR);
3498 /// // Now all fields of rxInfo and rxDetails have been populated correctly
3499 /// @endcode
3500 ///
3501 /// @{
3502
3503 /**
3504 * Get basic information about a pending or received packet.
3505 *
3506 * @param[in] railHandle A RAIL instance handle.
3507 * @param[in] packetHandle A packet handle for the unreleased packet as
3508 * returned from a previous call, or sentinel values
3509 * \ref RAIL_RX_PACKET_HANDLE_OLDEST,
3510 * \ref RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE or
3511 * \ref RAIL_RX_PACKET_HANDLE_NEWEST.
3512 * @param[out] pPacketInfo An application-provided pointer to store
3513 * \ref RAIL_RxPacketInfo_t for the requested packet. Must be non-NULL.
3514 * @return The packet handle for the requested packet:
3515 * if packetHandle was one of the sentinel values, returns the actual
3516 * packet handle for that packet, otherwise returns packetHandle.
3517 * It may return \ref RAIL_RX_PACKET_HANDLE_INVALID to indicate an error.
3518 *
3519 * This function can be used in any RX mode. It does not free up any
3520 * internal resources. If used in RX \ref RAIL_DataMethod_t::FIFO_MODE, the
3521 * value in \ref RAIL_RxPacketInfo_t::packetBytes will only return the data
3522 * remaining in the FIFO. Any data read via earlier calls to
3523 * \ref RAIL_ReadRxFifo() is not included.
3524 *
3525 * @note When getting information about an arriving packet that is not yet complete,
3526 * (i.e., pPacketInfo->packetStatus == \ref RAIL_RX_PACKET_RECEIVING), keep
3527 * in mind its data is highly suspect because it has not yet passed any CRC
3528 * integrity checking. Also note that the packet could be aborted, canceled, or
3529 * fail momentarily, invalidating its data in Packet mode. Furthermore, there
3530 * is a small chance towards the end of packet reception that the filled-in
3531 * RAIL_RxPacketInfo_t could include not only packet data received so far,
3532 * but also some raw radio-appended info detail bytes that RAIL's
3533 * packet-completion processing will subsequently deal with. It's up to the
3534 * application to know its packet format well enough to avoid confusing such
3535 * info as packet data.
3536 */
3537 RAIL_RxPacketHandle_t RAIL_GetRxPacketInfo(RAIL_Handle_t railHandle,
3538 RAIL_RxPacketHandle_t packetHandle,
3539 RAIL_RxPacketInfo_t *pPacketInfo);
3540
3541 /**
3542 * Get information about the live incoming packet (if any).
3543 * Differs from \ref RAIL_GetRxPacketInfo() by only returning information
3544 * about a packet actively being received, something which even the
3545 * \ref RAIL_RX_PACKET_HANDLE_NEWEST may not represent if there are
3546 * completed but unprocessed packets in the receive FIFO.
3547 *
3548 * @param[in] railHandle A RAIL instance handle.
3549 * @param[out] pPacketInfo Application provided pointer to store
3550 * RAIL_RxPacketInfo_t for the incoming packet.
3551 *
3552 * This function can only be called from callback context, e.g.,
3553 * when handling \ref RAIL_EVENT_RX_FILTER_PASSED or
3554 * \ref RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND.
3555 * It must not be used with receive \ref RAIL_DataMethod_t::FIFO_MODE
3556 * if any portion of an incoming packet has already been extracted from
3557 * the receive FIFO.
3558 *
3559 * @note The incomplete data of an arriving packet is highly suspect because
3560 * it has not yet passed any CRC integrity checking. Also note that the
3561 * packet could be aborted, canceled, or fail momentarily, invalidating
3562 * its data in Packet mode. Furthermore, there is a small chance towards
3563 * the end of packet reception that the filled-in RAIL_RxPacketInfo_t
3564 * could include not only packet data received so far, but also some raw
3565 * radio-appended info detail bytes that RAIL's packet-completion
3566 * processing will subsequently deal with. It's up to the application to
3567 * know its packet format well enough to avoid confusing such info as
3568 * packet data.
3569 */
3570 void RAIL_GetRxIncomingPacketInfo(RAIL_Handle_t railHandle,
3571 RAIL_RxPacketInfo_t *pPacketInfo);
3572
3573 /**
3574 * Copy a full packet to a user-specified contiguous buffer.
3575 *
3576 * @param[out] pDest An application-provided pointer to a buffer of at
3577 * least pPacketInfo->packetBytes in size to store the packet data
3578 * contiguously. This buffer must never overlay RAIL's receive FIFO buffer.
3579 * Exactly pPacketInfo->packetBytes of packet data will be written into it.
3580 * @param[in] pPacketInfo
3581 * \ref RAIL_RxPacketInfo_t for the requested packet.
3582 *
3583 * @note This is a convenience helper function, which
3584 * is intended to be expedient. As a result, it does not
3585 * check the validity of its arguments,
3586 * so don't pass either as NULL, and don't
3587 * pass a pDest pointer to a buffer that's too small for the packet's data.
3588 * @note If only a portion of the packet is needed, use RAIL_PeekRxPacket()
3589 * instead.
3590 */
3591 static inline
RAIL_CopyRxPacket(uint8_t * pDest,const RAIL_RxPacketInfo_t * pPacketInfo)3592 void RAIL_CopyRxPacket(uint8_t *pDest,
3593 const RAIL_RxPacketInfo_t *pPacketInfo)
3594 {
3595 (void)memcpy(pDest, pPacketInfo->firstPortionData, pPacketInfo->firstPortionBytes);
3596 if (pPacketInfo->lastPortionData != NULL) {
3597 uint16_t size = pPacketInfo->packetBytes - pPacketInfo->firstPortionBytes;
3598 (void)memcpy(pDest + pPacketInfo->firstPortionBytes,
3599 pPacketInfo->lastPortionData, size);
3600 }
3601 }
3602
3603 /**
3604 * Get detailed information about a received packet.
3605 * This function can be used in any RX mode; it does not free up any
3606 * internal resources.
3607 *
3608 * @param[in] railHandle A RAIL instance handle.
3609 * @param[in] packetHandle A packet handle for the unreleased packet as
3610 * returned from a previous call to RAIL_GetRxPacketInfo() or
3611 * RAIL_HoldRxPacket(), or sentinel values \ref RAIL_RX_PACKET_HANDLE_OLDEST,
3612 * \ref RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE
3613 * or \ref RAIL_RX_PACKET_HANDLE_NEWEST.
3614 * @param[in,out] pPacketDetails An application-provided non-NULL pointer to
3615 * store \ref RAIL_RxPacketDetails_t for the requested packet.
3616 * For \ref RAIL_RxPacketStatus_t RAIL_RX_PACKET_READY_ packets,
3617 * the timeReceived fields totalPacketBytes and timePosition must be
3618 * initialized prior to each call:
3619 * - totalPacketBytes with the total number of bytes of the received
3620 * packet for RAIL to use when calculating the specified timestamp.
3621 * This should account for all bytes received over the air after the
3622 * Preamble and Sync word(s), including CRC bytes.
3623 * - timePosition with a \ref RAIL_PacketTimePosition_t value specifying
3624 * the packet position to put in the timeReceived field on return.
3625 * This field will also be updated with the actual position corresponding
3626 * to the timeReceived value filled in.
3627 * @return \ref RAIL_STATUS_NO_ERROR if pPacketDetails was filled in,
3628 * or an appropriate error code otherwise.
3629 *
3630 * @note Certain details are always available, while others are only available
3631 * if the \ref RAIL_RxOptions_t \ref RAIL_RX_OPTION_REMOVE_APPENDED_INFO
3632 * option is not in effect and the received packet's
3633 * \ref RAIL_RxPacketStatus_t is among the RAIL_RX_PACKET_READY_ set.
3634 * See \ref RAIL_RxPacketDetails_t for clarification.
3635 *
3636 * @note Consider using \ref RAIL_GetRxPacketDetailsAlt for smaller code size.
3637 */
3638 RAIL_Status_t RAIL_GetRxPacketDetails(RAIL_Handle_t railHandle,
3639 RAIL_RxPacketHandle_t packetHandle,
3640 RAIL_RxPacketDetails_t *pPacketDetails);
3641
3642 /**
3643 * Get detailed information about a received packet.
3644 * This function can be used in any RX mode. It does not free up any
3645 * internal resources.
3646 *
3647 * @param[in] railHandle A RAIL instance handle.
3648 * @param[in] packetHandle A packet handle for the unreleased packet as
3649 * returned from a previous call to RAIL_GetRxPacketInfo() or
3650 * RAIL_HoldRxPacket(), or sentinel values \ref RAIL_RX_PACKET_HANDLE_OLDEST
3651 * \ref RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE or
3652 * \ref RAIL_RX_PACKET_HANDLE_NEWEST.
3653 * @param[out] pPacketDetails An application-provided non-NULL pointer to
3654 * store \ref RAIL_RxPacketDetails_t for the requested packet.
3655 * For \ref RAIL_RxPacketStatus_t RAIL_RX_PACKET_READY_ packets,
3656 * the timeReceived field packetTime will be populated with a timestamp
3657 * corresponding to a default location in the packet. The timeReceived field
3658 * timePosition will be populated with a \ref RAIL_PacketTimePosition_t value
3659 * specifying that default packet location. Call
3660 * \ref RAIL_GetRxTimePreambleStart, \ref RAIL_GetRxTimeSyncWordEnd, or
3661 * \ref RAIL_GetRxTimeFrameEnd to adjust that timestamp for different
3662 * locations in the packet.
3663 * @return \ref RAIL_STATUS_NO_ERROR if pPacketDetails was filled in,
3664 * or an appropriate error code otherwise.
3665 *
3666 * This alternative API allows for smaller code size by deadstripping the
3667 * timestamp adjustment algorithms which are not in use.
3668 *
3669 * @note Certain details are always available, while others are only available
3670 * if the \ref RAIL_RxOptions_t \ref RAIL_RX_OPTION_REMOVE_APPENDED_INFO
3671 * option is not in effect and the received packet's
3672 * \ref RAIL_RxPacketStatus_t is among the RAIL_RX_PACKET_READY_ set.
3673 * See \ref RAIL_RxPacketDetails_t for clarification.
3674 */
3675 RAIL_Status_t RAIL_GetRxPacketDetailsAlt(RAIL_Handle_t railHandle,
3676 RAIL_RxPacketHandle_t packetHandle,
3677 RAIL_RxPacketDetails_t *pPacketDetails);
3678
3679 /**
3680 * Adjust a RAIL RX timestamp to refer to the start of the preamble.
3681 *
3682 * @param[in] railHandle A RAIL instance handle.
3683 * @param[in] totalPacketBytes The total number of bytes of the received packet
3684 * for RAIL to use when calculating the specified timestamp. This should
3685 * account for all bytes received over the air after the Preamble and Sync
3686 * word(s), including CRC bytes.
3687 * @param[in, out] pPacketTime The time that was returned in the
3688 * \ref RAIL_PacketTimeStamp_t::packetTime field of
3689 * \ref RAIL_RxPacketDetails_t::timeReceived from a previous call to
3690 * \ref RAIL_GetRxPacketDetailsAlt for this same packet. After this
3691 * function, the time at that location will be updated with the time that the
3692 * preamble for this packet started on air. Must be non-NULL.
3693 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully calculated,
3694 * or an appropriate error code otherwise.
3695 *
3696 * Call this API while the given railHandle is active, or it will
3697 * return an error code of \ref RAIL_STATUS_INVALID_STATE. Note that this API
3698 * may return incorrect timestamps when sub-phys are in use. Prefer
3699 * \ref RAIL_GetRxTimePreambleStartAlt in those situations. See
3700 * \ref RAIL_RxPacketDetails_t::subPhyId for more details.
3701 */
3702 RAIL_Status_t RAIL_GetRxTimePreambleStart(RAIL_Handle_t railHandle,
3703 uint16_t totalPacketBytes,
3704 RAIL_Time_t *pPacketTime);
3705
3706 /**
3707 * Adjust a RAIL RX timestamp to refer to the start of the preamble.
3708 *
3709 * @param[in] railHandle A RAIL instance handle.
3710 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3711 * a previous call to \ref RAIL_GetRxPacketDetailsAlt for this same packet.
3712 * The application must update the timeReceived field totalPacketBytes to be
3713 * the total number of bytes of the received packet for RAIL to use when
3714 * calculating the specified timestamp. This should account for all bytes
3715 * received over the air after the Preamble and Sync word(s), including CRC
3716 * bytes. After this function, the timeReceived field packetTime will be
3717 * updated with the time that the preamble for this packet started on air.
3718 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3719 * calculated, or an appropriate error code otherwise.
3720 *
3721 * Call this API while the given railHandle is active, or it will
3722 * return an error code of \ref RAIL_STATUS_INVALID_STATE.
3723 */
3724 RAIL_Status_t RAIL_GetRxTimePreambleStartAlt(RAIL_Handle_t railHandle,
3725 RAIL_RxPacketDetails_t *pPacketDetails);
3726
3727 /**
3728 * Adjust a RAIL RX timestamp to refer to the end of the sync word.
3729 *
3730 * @param[in] railHandle A RAIL instance handle.
3731 * @param[in] totalPacketBytes The total number of bytes of the received packet
3732 * for RAIL to use when calculating the specified timestamp. This should
3733 * account for all bytes received over the air after the Preamble and Sync
3734 * word(s), including CRC bytes.
3735 * @param[in, out] pPacketTime The time that was returned in the
3736 * \ref RAIL_PacketTimeStamp_t::packetTime field of
3737 * \ref RAIL_RxPacketDetails_t::timeReceived from a previous call to
3738 * \ref RAIL_GetRxPacketDetailsAlt for this same packet. After this
3739 * function, the time at that location will be updated with the time that the
3740 * sync word for this packet finished on air. Must be non-NULL.
3741 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully calculated,
3742 * or an appropriate error code otherwise.
3743 *
3744 * Call this API while the given railHandle is active, or it will
3745 * return an error code of \ref RAIL_STATUS_INVALID_STATE. Note that this API
3746 * may return incorrect timestamps when sub-phys are in use. Prefer
3747 * \ref RAIL_GetRxTimePreambleStartAlt in those situations. See
3748 * \ref RAIL_RxPacketDetails_t::subPhyId for more details.
3749 */
3750 RAIL_Status_t RAIL_GetRxTimeSyncWordEnd(RAIL_Handle_t railHandle,
3751 uint16_t totalPacketBytes,
3752 RAIL_Time_t *pPacketTime);
3753
3754 /**
3755 * Adjust a RAIL RX timestamp to refer to the end of the sync word.
3756 *
3757 * @param[in] railHandle A RAIL instance handle.
3758 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3759 * a previous call to \ref RAIL_GetRxPacketDetailsAlt for this same packet.
3760 * The application must update the timeReceived field totalPacketBytes to be
3761 * the total number of bytes of the received packet for RAIL to use when
3762 * calculating the specified timestamp. This should account for all bytes
3763 * received over the air after the Preamble and Sync word(s), including CRC
3764 * bytes. After this function, the timeReceived field packetTime will be
3765 * updated with the time that the sync word for this packet finished on air.
3766 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3767 * calculated, or an appropriate error code otherwise.
3768 *
3769 * Call this API while the given railHandle is active, or it will
3770 * return an error code of \ref RAIL_STATUS_INVALID_STATE.
3771 */
3772 RAIL_Status_t RAIL_GetRxTimeSyncWordEndAlt(RAIL_Handle_t railHandle,
3773 RAIL_RxPacketDetails_t *pPacketDetails);
3774
3775 /**
3776 * Adjust a RAIL RX timestamp to refer to the end of frame.
3777 *
3778 * @param[in] railHandle A RAIL instance handle.
3779 * @param[in] totalPacketBytes The total number of bytes of the received packet
3780 * for RAIL to use when calculating the specified timestamp. This should
3781 * account for all bytes received over the air after the Preamble and Sync
3782 * word(s), including CRC bytes.
3783 * @param[in, out] pPacketTime The time that was returned in the
3784 * \ref RAIL_PacketTimeStamp_t::packetTime field of
3785 * \ref RAIL_RxPacketDetails_t::timeReceived from a previous call to
3786 * \ref RAIL_GetRxPacketDetailsAlt for this same packet. After this
3787 * function, the time at that location will be updated with the time that this
3788 * packet finished on air. Must be non-NULL.
3789 * @return \ref RAIL_STATUS_NO_ERROR if pPacketTime was successfully calculated,
3790 * or an appropriate error code otherwise.
3791 *
3792 * Call this API while the given railHandle is active, or it will
3793 * return an error code of \ref RAIL_STATUS_INVALID_STATE. Note that this API
3794 * may return incorrect timestamps when sub-phys are in use. Prefer
3795 * \ref RAIL_GetRxTimePreambleStartAlt in those situations. See
3796 * \ref RAIL_RxPacketDetails_t::subPhyId for more details.
3797 */
3798 RAIL_Status_t RAIL_GetRxTimeFrameEnd(RAIL_Handle_t railHandle,
3799 uint16_t totalPacketBytes,
3800 RAIL_Time_t *pPacketTime);
3801
3802 /**
3803 * Adjust a RAIL RX timestamp to refer to the end of frame.
3804 *
3805 * @param[in] railHandle A RAIL instance handle.
3806 * @param[in, out] pPacketDetails The non-NULL details that were returned from
3807 * a previous call to \ref RAIL_GetRxPacketDetailsAlt for this same packet.
3808 * The application must update the timeReceived field totalPacketBytes to be
3809 * the total number of bytes of the received packet for RAIL to use when
3810 * calculating the specified timestamp. This should account for all bytes
3811 * received over the air after the Preamble and Sync word(s), including CRC
3812 * bytes. After this function, the timeReceived field packetTime will be
3813 * updated with the time that the packet finished on air.
3814 * @return \ref RAIL_STATUS_NO_ERROR if the packet time was successfully
3815 * calculated, or an appropriate error code otherwise.
3816 *
3817 * Call this API while the given railHandle is active, or it will
3818 * return an error code of \ref RAIL_STATUS_INVALID_STATE.
3819 */
3820 RAIL_Status_t RAIL_GetRxTimeFrameEndAlt(RAIL_Handle_t railHandle,
3821 RAIL_RxPacketDetails_t *pPacketDetails);
3822
3823 /** @} */ // end of group Packet_Information
3824
3825 /**
3826 * Place a temporary hold on this packet's data and information resources
3827 * within RAIL.
3828 * This function can only be called from within RAIL callback context.
3829 * It can be used in any RX mode.
3830 *
3831 * Normally, when RAIL issues its callback indicating a packet is ready
3832 * or aborted, it expects the application's callback to retrieve and
3833 * copy (or discard) the packet's information and data, and will free up
3834 * its internal packet data after the callback returns. This function
3835 * tells RAIL to hold onto those resources after the callback returns in
3836 * case the application wants to defer processing the packet to a later
3837 * time, e.g., outside of callback context.
3838 *
3839 * @param[in] railHandle A RAIL instance handle.
3840 * @return The packet handle for the packet associated with the callback,
3841 * \ref RAIL_RX_PACKET_HANDLE_INVALID if no such packet yet exists or
3842 * railHandle is not active.
3843 *
3844 * @note When using multiprotocol the receive FIFO is reset during protocol
3845 * switches so any packets held with \ref RAIL_HoldRxPacket() will be lost. It
3846 * is best to avoid using this in DMP or to at least reset any internal held
3847 * packet information when the \ref RAIL_EVENT_CONFIG_UNSCHEDULED occurs.
3848 */
3849 RAIL_RxPacketHandle_t RAIL_HoldRxPacket(RAIL_Handle_t railHandle);
3850
3851 /**
3852 * Copy 'len' bytes of packet data starting from 'offset' from the
3853 * receive FIFO. Those bytes remain valid for re-peeking.
3854 *
3855 * @param[in] railHandle A RAIL instance handle.
3856 * @param[in] packetHandle A packet handle as returned from a previous
3857 * RAIL_GetRxPacketInfo() or RAIL_HoldRxPacket() call, or
3858 * sentinel values \ref RAIL_RX_PACKET_HANDLE_OLDEST,
3859 * \ref RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE
3860 * or \ref RAIL_RX_PACKET_HANDLE_NEWEST.
3861 * @param[out] pDst A pointer to the location where the received bytes will
3862 * be copied. If NULL, no copying occurs.
3863 * @param[in] len A number of packet data bytes to copy.
3864 * @param[in] offset A byte offset within remaining packet data from which
3865 * to copy.
3866 * @return Number of packet bytes copied.
3867 *
3868 * @note Peek does not permit peeking beyond the requested packet's
3869 * available packet data (though there is a small chance it might
3870 * for a \ref RAIL_RX_PACKET_HANDLE_NEWEST packet at the very end of
3871 * still being received). Nor can one peek into already-consumed data read
3872 * by RAIL_ReadRxFifo(). len and offset are relative to the remaining data
3873 * available in the packet, if any was already consumed by RAIL_ReadRxFifo().
3874 */
3875 uint16_t RAIL_PeekRxPacket(RAIL_Handle_t railHandle,
3876 RAIL_RxPacketHandle_t packetHandle,
3877 uint8_t *pDst,
3878 uint16_t len,
3879 uint16_t offset);
3880
3881 /**
3882 * Release RAIL's internal resources for the packet.
3883 * This function must be called for any packet previously held via
3884 * RAIL_HoldRxPacket(). It may optionally be called within a
3885 * callback context to release RAIL resources sooner than at
3886 * callback completion time when not holding the packet.
3887 * This function can be used in any RX mode.
3888 *
3889 * @param[in] railHandle A RAIL instance handle.
3890 * @param[in] packetHandle A packet handle as returned from a previous
3891 * RAIL_HoldRxPacket() call, or sentinel values
3892 * \ref RAIL_RX_PACKET_HANDLE_OLDEST,
3893 * \ref RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE
3894 * or \ref RAIL_RX_PACKET_HANDLE_NEWEST.
3895 * The latter might be used within RAIL callback context to explicitly
3896 * release the packet associated with the callback early, before it's
3897 * released automatically by RAIL on callback return (unless explicitly
3898 * held).
3899 * @return \ref RAIL_STATUS_NO_ERROR if the held packet was released
3900 * or an appropriate error code otherwise.
3901 */
3902 RAIL_Status_t RAIL_ReleaseRxPacket(RAIL_Handle_t railHandle,
3903 RAIL_RxPacketHandle_t packetHandle);
3904
3905 /**
3906 * Return the current raw RSSI.
3907 *
3908 * @param[in] railHandle A RAIL instance handle.
3909 * @param[in] wait if false returns instant RSSI with no checks.
3910 * @return \ref RAIL_RSSI_INVALID if the receiver is disabled and an RSSI
3911 * value can't be obtained. Otherwise, return the RSSI in quarter dBm, dbm*4.
3912 *
3913 * Gets the current RSSI value. This value represents the current energy of the
3914 * channel. It can change rapidly and will be low if no RF energy is
3915 * in the current channel. The function from the value reported to dBm is an
3916 * offset dependent on the PHY and the PCB layout. Characterize the
3917 * RSSI received on your hardware and apply an offset in the application to
3918 * account for board and PHY parameters. When 'wait' is false, the radio needs
3919 * to be currently in RX and have been in there for a sufficient amount of time
3920 * for a fresh RSSI value to be read and returned. Otherwise, the RSSI is
3921 * considered stale and \ref RAIL_RSSI_INVALID is returned instead. When 'wait'
3922 * is true, if the radio is transitioning to or already in RX, this function
3923 * will wait for a valid RSSI to be read and return it. Otherwise, if the radio
3924 * is in or transitions to IDLE or TX, \ref RAIL_RSSI_INVALID will be returned.
3925 * On low datarate PHYs, this function can take a significantly longer time when
3926 * wait is true.
3927 *
3928 * In multiprotocol, this function returns \ref RAIL_RSSI_INVALID
3929 * immediately if railHandle is not the current active \ref RAIL_Handle_t.
3930 * Additionally, 'wait' should never be set 'true' in multiprotocol
3931 * as the wait time is not consistent, so scheduling a scheduler
3932 * slot cannot be done accurately. Rather if waiting for a valid RSSI is
3933 * desired, use \ref RAIL_GetRssiAlt instead to apply a bounded time period.
3934 *
3935 * @note If RX Antenna Diversity is enabled via \ref RAIL_ConfigRxOptions(),
3936 * pass true for the wait parameter otherwise it's very likely
3937 * \ref RAIL_RSSI_INVALID will be returned.
3938 *
3939 * @note If RX channel hopping is turned on, do not use this API.
3940 * Instead, see RAIL_GetChannelHoppingRssi().
3941 *
3942 * @note When 'wait' is false, this API is equivalent to \ref RAIL_GetRssiAlt
3943 * with 'waitTimeout' set to \ref RAIL_GET_RSSI_NO_WAIT. When 'wait' is
3944 * true, this API is equivalent to \ref RAIL_GetRssiAlt with 'waitTimeout'
3945 * set to \ref RAIL_GET_RSSI_WAIT_WITHOUT_TIMEOUT. Consider using
3946 * \ref RAIL_GetRssiAlt if a bounded maximum wait timeout is desired.
3947 */
3948 int16_t RAIL_GetRssi(RAIL_Handle_t railHandle, bool wait);
3949
3950 /**
3951 * Return the current raw RSSI within a definitive time period.
3952 *
3953 * @param[in] railHandle A RAIL instance handle.
3954 * @param[in] waitTimeout Sets the maximum time to wait for a valid RSSI.
3955 * If equal to \ref RAIL_GET_RSSI_NO_WAIT returns instant RSSI with no checks.
3956 * If equal to \ref RAIL_GET_RSSI_WAIT_WITHOUT_TIMEOUT waits for a valid RSSI
3957 * with no maximum timeout.
3958 * @return \ref RAIL_RSSI_INVALID if the receiver is disabled and an RSSI
3959 * value can't be obtained. Otherwise, return the RSSI in quarter dBm, dbm*4.
3960 *
3961 * Gets the current RSSI value. This value represents the current energy of the
3962 * channel. It can change rapidly, and will be low if no RF energy is
3963 * in the current channel. The function from the value reported to dBm is an
3964 * offset dependent on the PHY and the PCB layout. Characterize the
3965 * RSSI received on your hardware and apply an offset in the application to
3966 * account for board and PHY parameters. If a value of \ref RAIL_GET_RSSI_NO_WAIT
3967 * is given for waitTimeout, the radio needs to be currently in RX and have been
3968 * in there for a sufficient amount of time for a fresh RSSI value to be read and
3969 * returned. Otherwise the RSSI is considered stale and \ref RAIL_RSSI_INVALID is
3970 * returned instead. For non-zero values of waitTimeout, if the radio is
3971 * transitioning to or already in RX, this function will wait a maximum time equal
3972 * to waitTimeout (or indefinitely if waitTimeout is set to
3973 * \ref RAIL_GET_RSSI_WAIT_WITHOUT_TIMEOUT) for a valid RSSI to be read and return
3974 * it. Otherwise, if the waitTimeout is reached, or the radio is in or transitions
3975 * to IDLE or TX, \ref RAIL_RSSI_INVALID will be returned. On low datarate PHYs,
3976 * this function can take a significantly longer time when waitTimeout is non-zero.
3977 *
3978 * In multiprotocol, this function returns \ref RAIL_RSSI_INVALID
3979 * immediately if railHandle is not the current active \ref RAIL_Handle_t.
3980 * Additionally, 'waitTimeout' should never be set to a value other than
3981 * \ref RAIL_GET_RSSI_NO_WAIT in multiprotocol as the integration between this
3982 * feature and the radio scheduler has not been implemented.
3983 *
3984 * @note If RX Antenna Diversity is enabled via \ref RAIL_ConfigRxOptions(),
3985 * pass true for the wait parameter otherwise it's very likely
3986 * \ref RAIL_RSSI_INVALID will be returned.
3987 *
3988 * @note If RX Antenna Diversity is enabled via \ref RAIL_ConfigRxOptions(),
3989 * the RSSI value returned could come from either antenna and vary between antennas.
3990 *
3991 * @note If RX channel hopping is turned on, do not use this API.
3992 * Instead, see RAIL_GetChannelHoppingRssi().
3993 */
3994 int16_t RAIL_GetRssiAlt(RAIL_Handle_t railHandle, RAIL_Time_t waitTimeout);
3995
3996 /**
3997 * Start the RSSI averaging over a specified time in us.
3998 *
3999 * @param[in] railHandle A RAIL instance handle.
4000 * @param[in] channel The physical channel to set.
4001 * @param[in] averagingTimeUs Averaging time in microseconds.
4002 * @param[in] schedulerInfo Information to allow the radio scheduler to place
4003 * this operation appropriately. This is only used in multiprotocol version of
4004 * RAIL and may be set to NULL in all other versions.
4005 * @return Status code indicating success of the function call.
4006 *
4007 * Starts a non-blocking hardware-based RSSI averaging mechanism. Only a single
4008 * instance of RSSI averaging can be run at any time and the radio must be idle
4009 * to start.
4010 *
4011 * In multiprotocol, this is a scheduled event. It will start when railHandle
4012 * becomes active. railHandle needs to stay active until the averaging
4013 * completes. If the averaging is interrupted, calls to
4014 * \ref RAIL_GetAverageRssi will return \ref RAIL_RSSI_INVALID.
4015 *
4016 * Also in multiprotocol, the user is required to call \ref RAIL_YieldRadio
4017 * after this event completes (i.e., when \ref RAIL_EVENT_RSSI_AVERAGE_DONE
4018 * occurs).
4019 *
4020 * @note If the radio is idled while RSSI averaging is still in effect, a
4021 * \ref RAIL_EVENT_RSSI_AVERAGE_DONE event may not occur and
4022 * \ref RAIL_IsAverageRssiReady may never return true.
4023 */
4024 RAIL_Status_t RAIL_StartAverageRssi(RAIL_Handle_t railHandle,
4025 uint16_t channel,
4026 RAIL_Time_t averagingTimeUs,
4027 const RAIL_SchedulerInfo_t *schedulerInfo);
4028
4029 /**
4030 * Query whether the RSSI averaging is done.
4031 *
4032 * @param[in] railHandle A RAIL instance handle.
4033 * @return Returns true if done and false otherwise.
4034 *
4035 * This function can be used to poll for completion of the RSSI averaging
4036 * to avoid relying on an interrupt-based callback.
4037 *
4038 * @note If the radio is idled while RSSI averaging is still in effect,
4039 * this function may never return true.
4040 */
4041 bool RAIL_IsAverageRssiReady(RAIL_Handle_t railHandle);
4042
4043 /**
4044 * Get the RSSI averaged over a specified time in us.
4045 *
4046 * @param[in] railHandle A RAIL instance handle.
4047 * @return Return \ref RAIL_RSSI_INVALID if the receiver is disabled
4048 * an RSSI value can't be obtained. Otherwise, return the RSSI in
4049 * quarter dBm,dbm*4.
4050 *
4051 * Gets the hardware RSSI average after issuing RAIL_StartAverageRssi.
4052 * Use after \ref RAIL_StartAverageRssi.
4053 */
4054 int16_t RAIL_GetAverageRssi(RAIL_Handle_t railHandle);
4055
4056 /**
4057 * Set the RSSI offset.
4058 *
4059 * @param[in] railHandle a RAIL instance handle.
4060 * @param[in] rssiOffset desired offset to be added to the RSSI measurements.
4061 * @return Status code indicating success of the function call.
4062 * \ref RAIL_STATUS_INVALID_CALL if called with chip-specific handle, such
4063 * as \ref RAIL_EFR32_HANDLE, after RAIL initialization.
4064 * \ref RAIL_STATUS_INVALID_PARAMETER if the RSSI offset is deemed large
4065 * enough to cause the RSSI readings to underflow or overflow.
4066 *
4067 * Adds an offset to the RSSI in dBm. This offset affects all functionality that
4068 * depends on RSSI values, such as CCA functions. Do not modify the offset
4069 * dynamically during packet reception. This function
4070 * can only be called while the radio is off, or in the case of multiprotocol,
4071 * on an inactive protocol.
4072 *
4073 * @note: If RAIL has not been initialized, a chip-specific handle,
4074 * such as \ref RAIL_EFR32_HANDLE, can be used to set a chip level RSSI offset.
4075 *
4076 * @note: Setting a large rssiOffset may still cause the RSSI readings to
4077 * underflow. If that happens, the RSSI value returned by
4078 * \ref RAIL_GetRssi, \ref RAIL_GetAverageRssi,
4079 * \ref RAIL_GetChannelHoppingRssi etc. will be \ref RAIL_RSSI_LOWEST
4080 *
4081 * @note: During \ref Rx_Channel_Hopping this API will not update the
4082 * RSSI offset immediately if channel hopping has already been configured.
4083 * A subsequent call to \ref RAIL_ZWAVE_ConfigRxChannelHopping or
4084 * \ref RAIL_ConfigRxChannelHopping is required for the new RSSI offset to
4085 * take effect.
4086 */
4087 RAIL_Status_t RAIL_SetRssiOffset(RAIL_Handle_t railHandle, int8_t rssiOffset);
4088
4089 /**
4090 * Get the RSSI offset.
4091 *
4092 * @param[in] railHandle a RAIL instance handle.
4093 * @return rssiOffset in dBm corresponding to the current handle.
4094 *
4095 * @note: A chip-specific handle, such as \ref RAIL_EFR32_HANDLE, can be used to
4096 * get the chip level RSSI offset otherwise this will return the RSSI offset
4097 * value associated with the RAIL instance handle, exclusive of any chip level
4098 * RSSI offset correction, if any.
4099 */
4100 int8_t RAIL_GetRssiOffset(RAIL_Handle_t railHandle);
4101
4102 /**
4103 * Set the RSSI detection threshold(in dBm) to trigger
4104 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD.
4105 *
4106 * @param[in] railHandle a RAIL instance handle.
4107 * @param[in] rssiThresholdDbm desired RSSI threshold(in dBm) over which the event
4108 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD is triggered.
4109 * @return Status code indicating success of the function call.
4110 * Returns \ref RAIL_STATUS_INVALID_STATE in multiprotocol,
4111 * if the requested \ref RAIL_Handle_t is not active.
4112 * Returns \ref RAIL_STATUS_INVALID_CALL if called on parts on which this function
4113 * is not supported.
4114 *
4115 * When in receive, RSSI is sampled and if it exceeds the threshold,
4116 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD is triggered.
4117 *
4118 * @note:
4119 * If the radio is idled or this function is called with rssiThresholdDbm as
4120 * \ref RAIL_RSSI_INVALID_DBM while RSSI detect is still in effect, a
4121 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD may not occur and the detection is disabled.
4122 * If the RSSI is already above threshold when this function is called then
4123 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD will occur.
4124 * Once the RSSI goes over the configured threshold and
4125 * \ref RAIL_EVENT_DETECT_RSSI_THRESHOLD occurs, this function needs to be
4126 * called again to reactivate the RSSI threshold detection.
4127 * This function is only available on series-2 Sub-GHz parts EFR32XG23 and EFR32XG25.
4128 */
4129 RAIL_Status_t RAIL_SetRssiDetectThreshold(RAIL_Handle_t railHandle,
4130 int8_t rssiThresholdDbm);
4131
4132 /**
4133 * Get the RSSI detection threshold(in dBm).
4134 *
4135 * @param[in] railHandle a RAIL instance handle.
4136 * @return rssiThreshold (in dBm) corresponding to the current handle.
4137 * @note:
4138 * The function returns \ref RAIL_RSSI_INVALID_DBM when
4139 * \ref RAIL_SetRssiDetectThreshold is not supported or disabled.
4140 * In multiprotocol, the function returns \ref RAIL_RSSI_INVALID_DBM if railHandle
4141 * is not active.
4142 * This function is only available on series-2 Sub-GHz parts EFR32XG23 and EFR32XG25.
4143 */
4144 int8_t RAIL_GetRssiDetectThreshold(RAIL_Handle_t railHandle);
4145
4146 /**
4147 * Set up a callback function capable of converting a RX packet's LQI value
4148 * before being consumed by application code.
4149 *
4150 * @param[in] railHandle A RAIL instance handle.
4151 * @param[in] cb A callback of type \ref RAIL_ConvertLqiCallback_t that is
4152 * called before the RX packet LQI value is loaded into the \ref
4153 * RAIL_RxPacketDetails_t structure for application consumption.
4154 * @return Status code indicating success of the function call.
4155 */
4156 RAIL_Status_t RAIL_ConvertLqi(RAIL_Handle_t railHandle,
4157 RAIL_ConvertLqiCallback_t cb);
4158
4159 /******************************************************************************
4160 * Address Filtering (RX)
4161 *****************************************************************************/
4162 /**
4163 * @addtogroup Address_Filtering Address Filtering
4164 * @brief Configuration APIs for receive packet address filtering.
4165 *
4166 * The address filtering code examines the packet as follows.
4167 *
4168 * | `Bytes: 0 - 255` | `0 - 8` | `0 - 255` | `0 - 8` | `Variable` |
4169 * |:----------------:|---------:|----------:|---------:|:----------:|
4170 * | `Data0` | `Field0` | `Data1` | `Field1` | `Data2` |
4171 *
4172 * In the above structure, anything listed as DataN is an optional section of
4173 * bytes that RAIL will not process for address filtering. The FieldN segments
4174 * reference specific sections in the packet that will each be interpreted
4175 * as an address during address filtering. The application may submit up to
4176 * four addresses to attempt to match each field segment and each address may
4177 * have a size of up to 8 bytes. To set up address filtering, first configure
4178 * the locations and length of the addresses in the packet. Next, configure
4179 * which combinations of matches in Field0 and Field1 should constitute an
4180 * address match. Last, enter addresses into tables for each field and
4181 * enable them. The first two of these are part of the \ref RAIL_AddrConfig_t
4182 * structure while the second part is configured at runtime using the
4183 * RAIL_SetAddressFilterAddress() API. A brief description of each
4184 * configuration is listed below.
4185 *
4186 * The offsets and sizes of the fields
4187 * are assumed fixed for the RAIL address filter. To set them, specify
4188 * arrays for these values in the sizes and offsets entries in the
4189 * \ref RAIL_AddrConfig_t structure. A size of zero indicates that a field is
4190 * disabled. The start offset for a field is relative to the previous start
4191 * offset and, if you're using FrameType decoding, the first start offset is
4192 * relative to the end of the byte containing the frame type.
4193 *
4194 * Configuring which combinations of Field0 and Field1 constitute a match is
4195 * the most complex portion of the address filter. The easiest way to think
4196 * about this is with a truth table. If you consider each of the four possible
4197 * address entries in a field, you can have a match on any one of those or a
4198 * match for none of them. This is shown in the 5x5 truth table below where
4199 * Field0 matches are the rows and Field1 matches are the columns.
4200 *
4201 * | | No Match | Address 0 | Address 1 | Address 2 | Address 3 |
4202 * |----------------|----------|-----------|-----------|-----------|-----------|
4203 * | __No Match__ | bit0 | bit1 | bit2 | bit3 | bit4 |
4204 * | __Address 0__ | bit5 | bit6 | bit7 | bit8 | bit9 |
4205 * | __Address 1__ | bit10 | bit11 | bit12 | bit13 | bit14 |
4206 * | __Address 2__ | bit15 | bit16 | bit17 | bit18 | bit19 |
4207 * | __Address 3__ | bit20 | bit21 | bit22 | bit23 | bit24 |
4208 *
4209 * Because this is only 25 bits, it can be represented in one 32-bit integer
4210 * where 1 indicates a filter pass and 0 indicates a filter fail. This is the
4211 * matchTable parameter in the configuration structure and is used during
4212 * filtering. For common simple configurations, two defines are provided with
4213 * the truth tables as shown below. The first is \ref
4214 * ADDRCONFIG_MATCH_TABLE_SINGLE_FIELD, which can be used if only using
4215 * one address field (either field). If using two fields and want to
4216 * force in the same address entry in each field, use the second define: \ref
4217 * ADDRCONFIG_MATCH_TABLE_DOUBLE_FIELD. For more complex systems,
4218 * create a valid custom table.
4219 *
4220 * @note Address filtering does not function reliably with PHYs that use a data
4221 * rate greater than 500 kbps. If this is a requirement, filtering must
4222 * currently be done by the application.
4223 *
4224 * @{
4225 */
4226
4227 /**
4228 * Configure address filtering.
4229 *
4230 * @param[in] railHandle A RAIL instance handle.
4231 * @param[in] addrConfig The configuration structure, which defines how
4232 * addresses are set up in your packets.
4233 * @return Status code indicating success of the function call.
4234 *
4235 * You must call this function to set up address filtering. You may call it
4236 * multiple times but all previous information is wiped out each time you call
4237 * and any configured addresses must be reset.
4238 */
4239 RAIL_Status_t RAIL_ConfigAddressFilter(RAIL_Handle_t railHandle,
4240 const RAIL_AddrConfig_t *addrConfig);
4241
4242 /**
4243 * Enable address filtering.
4244 *
4245 * @param[in] railHandle A RAIL instance handle.
4246 * @param[in] enable An argument to indicate whether or not to enable address
4247 * filtering.
4248 * @return True if address filtering was enabled to start with and false
4249 * otherwise.
4250 *
4251 * Only allow packets through that pass the current address filtering
4252 * configuration. This does not reset or change the configuration so you can
4253 * set that up before turning on this feature.
4254 */
4255 bool RAIL_EnableAddressFilter(RAIL_Handle_t railHandle, bool enable);
4256
4257 /**
4258 * Return whether address filtering is currently enabled.
4259 *
4260 * @param[in] railHandle A RAIL instance handle.
4261 * @return True if address filtering is enabled and false otherwise.
4262 */
4263 bool RAIL_IsAddressFilterEnabled(RAIL_Handle_t railHandle);
4264
4265 /**
4266 * Reset the address filtering configuration.
4267 *
4268 * @param[in] railHandle A RAIL instance handle.
4269 *
4270 * Resets all structures related to address filtering. This does not disable
4271 * address filtering. It leaves the radio in a state where no packets
4272 * pass filtering.
4273 */
4274 void RAIL_ResetAddressFilter(RAIL_Handle_t railHandle);
4275
4276 /**
4277 * Set an address for filtering in hardware.
4278 *
4279 * @param[in] railHandle A RAIL instance handle.
4280 * @param[in] field Indicates an address field for this address.
4281 * @param[in] index Indicates a match entry for this address for a
4282 * given field.
4283 * @param[in] value A pointer to the address data. This must be at least as
4284 * long as the size specified in RAIL_ConfigAddressFilter(). The first byte,
4285 * value[0], will be compared to the first byte received over the air for this
4286 * address field.
4287 * @param[in] enable A boolean to indicate whether this address should be
4288 * enabled immediately.
4289 * @return Status code indicating success of the function call.
4290 *
4291 * This function loads the given address into hardware for filtering and
4292 * starts filtering if you set the enable parameter to true. Otherwise,
4293 * call RAIL_EnableAddressFilterAddress() to turn it on later.
4294 */
4295 RAIL_Status_t RAIL_SetAddressFilterAddress(RAIL_Handle_t railHandle,
4296 uint8_t field,
4297 uint8_t index,
4298 const uint8_t *value,
4299 bool enable);
4300
4301 /**
4302 * Set an address bit mask for filtering in hardware.
4303 *
4304 * @param[in] railHandle A RAIL instance handle.
4305 * @param[in] field Indicates an address field for this address bit mask.
4306 * @param[in] bitMask A pointer to the address bitmask. This must be at least
4307 * as long as the size specified in RAIL_ConfigAddressFilter(). The first
4308 * byte, bitMask[0], will be applied to the first byte received over the air
4309 * for this address field. Bits set to 1 in the bit mask indicate which bit
4310 * positions in the incoming packet to compare against the stored addresses
4311 * during address filtering. Bits set to 0 indicate which bit positions to
4312 * ignore in the incoming packet during address filtering. This bit mask is
4313 * applied to all address entries.
4314 * @return Status code indicating success of the function call.
4315 *
4316 * This function loads the given address bit mask into hardware for use when
4317 * address filtering is enabled. All bits in the stored address bit mask are
4318 * set to 1 during hardware initialization and when either \ref
4319 * RAIL_ConfigAddressFilter() or \ref RAIL_ResetAddressFilter() are called.
4320 *
4321 * @note This feature/API is not supported on the EFR32XG1 family of chips
4322 * or the EFR32XG21. Use the compile time symbol \ref
4323 * RAIL_SUPPORTS_ADDR_FILTER_ADDRESS_BIT_MASK or the runtime call \ref
4324 * RAIL_SupportsAddrFilterAddressBitMask() to check whether the platform
4325 * supports this feature.
4326 */
4327 RAIL_Status_t RAIL_SetAddressFilterAddressMask(RAIL_Handle_t railHandle,
4328 uint8_t field,
4329 const uint8_t *bitMask);
4330
4331 /**
4332 * Enable address filtering for the specified address.
4333 *
4334 * @param[in] railHandle A RAIL instance handle.
4335 * @param[in] enable An argument to indicate whether or not to enable address
4336 * filtering.
4337 * @param[in] field Indicates an address for the address.
4338 * @param[in] index Indicates a match entry in the given field you want to enable.
4339 * @return Status code indicating success of the function call.
4340 */
4341 RAIL_Status_t RAIL_EnableAddressFilterAddress(RAIL_Handle_t railHandle,
4342 bool enable,
4343 uint8_t field,
4344 uint8_t index);
4345
4346 /** @} */ // end of group Address_Filtering
4347
4348 /** @} */ // end of group Receive
4349
4350 /******************************************************************************
4351 * Auto-ACKing
4352 *****************************************************************************/
4353 /// @addtogroup Auto_Ack Auto-ACK
4354 /// @brief APIs for configuring auto-ACK functionality
4355 ///
4356 /// These APIs configure the radio for automatic acknowledgment
4357 /// features. Auto-ACK inherently changes how the underlying state machine
4358 /// behaves so users should not modify RAIL_SetRxTransitions() and
4359 /// RAIL_SetTxTransitions() while using auto-ACK features.
4360 ///
4361 /// @code{.c}
4362 /// // Go to RX after ACK operation.
4363 /// RAIL_AutoAckConfig_t autoAckConfig = {
4364 /// .enable = true,
4365 /// .ackTimeout = 1000,
4366 /// // "error" param ignored
4367 /// .rxTransitions = { RAIL_RF_STATE_RX, RAIL_RF_STATE_RX},
4368 /// // "error" param ignored
4369 /// .txTransitions = { RAIL_RF_STATE_RX, RAIL_RF_STATE_RX}
4370 /// };
4371 ///
4372 /// RAIL_Status_t status = RAIL_ConfigAutoAck(railHandle, &autoAckConfig);
4373 ///
4374 /// uint8_t ackData[] = {0x05, 0x02, 0x10, 0x00};
4375 ///
4376 /// RAIL_Status_t status = RAIL_WriteAutoAckFifo(railHandle,
4377 /// ackData,
4378 /// sizeof(ackData));
4379 /// @endcode
4380 ///
4381 /// The acknowledgment transmits based on the frame format configured via
4382 /// the Radio Configurator. For example, if the frame format is using a variable
4383 /// length scheme, the ACK will be sent according to that scheme. If a 10-byte
4384 /// packet is loaded into the ACK, but the variable length field of the ACK
4385 /// payload specifies a length of 5, only 5 bytes will transmit for the ACK.
4386 /// The converse is also true, if the frame length is configured to be a fixed
4387 /// 10-byte packet but only 5 bytes are loaded into the ACK buffer, a TX
4388 /// underflow occurs during the ACK transmit.
4389 ///
4390 /// Unlike in non-auto-ACK mode, auto-ACK mode will always return to a single
4391 /// state after all ACK sequences complete, regardless of whether
4392 /// the ACK was successfully received/sent or not. See the documentation
4393 /// of \ref RAIL_ConfigAutoAck() for configuration information. To
4394 /// suspend automatic acknowledgment of a series of packets after transmit
4395 /// or receive call RAIL_PauseTxAutoAck() or RAIL_PauseRxAutoAck() respectively
4396 /// with the pause parameter set to true. When auto-ACKing is paused, after
4397 /// receiving or transmitting a packet (regardless of success), the radio
4398 /// transitions to the same state it would use while ACKing. To return to
4399 /// normal state transition logic outside of ACKing, call \ref
4400 /// RAIL_ConfigAutoAck() with the \ref RAIL_AutoAckConfig_t::enable field false
4401 /// and specify the desired transitions in the \ref
4402 /// RAIL_AutoAckConfig_t::rxTransitions and RAIL_AutoAckConfig_t::txTransitions
4403 /// fields. To get out of a paused state and resume auto-ACKing, call
4404 /// RAIL_PauseTxAutoAck() and/or RAIL_PauseRxAutoAck() with the pause parameter
4405 /// set to false.
4406 ///
4407 /// Applications can cancel the transmission of an ACK with
4408 /// RAIL_CancelAutoAck(). Conversely, applications can control if a transmit
4409 /// operation should wait for an ACK after transmitting by using
4410 /// the \ref RAIL_TX_OPTION_WAIT_FOR_ACK option.
4411 ///
4412 /// When \ref Antenna_Control is used for multiple antennas, ACKs are
4413 /// transmitted on the antenna that was selected to receive the packet
4414 /// being acknowledged. When receiving an ACK, the
4415 /// \ref RAIL_RxOptions_t antenna options are used just like for any other
4416 /// receive.
4417 ///
4418 /// If the ACK payload is dynamic, the application must call
4419 /// RAIL_WriteAutoAckFifo() with the appropriate ACK payload after the
4420 /// application processes the receive. RAIL can auto-ACK from the normal
4421 /// transmit buffer if RAIL_UseTxFifoForAutoAck() is called before the radio
4422 /// transmits the ACK. Ensure the transmit buffer contains data loaded by
4423 /// RAIL_WriteTxFifo().
4424 ///
4425 /// Standard-based protocols that contain auto-ACK functionality are normally
4426 /// configured in the protocol-specific configuration function. For example,
4427 /// RAIL_IEEE802154_Init() provides auto-ACK configuration parameters in \ref
4428 /// RAIL_IEEE802154_Config_t and should only be configured through that
4429 /// function. It is not advisable to call both RAIL_IEEE802154_Init() and \ref
4430 /// RAIL_ConfigAutoAck(). However, ACK modification functions are still valid to
4431 /// use with protocol-specific ACKs. To cancel an IEEE 802.15.4 ACK transmit,
4432 /// use RAIL_CancelAutoAck().
4433 ///
4434 /// @{
4435
4436 /// Configure and enable automatic acknowledgment.
4437 ///
4438 /// @param[in] railHandle A RAIL instance handle.
4439 /// @param[in] config Auto-ACK configuration structure.
4440 /// @return Status code indicating success of the function call.
4441 ///
4442 /// Configures the RAIL state machine to for hardware-accelerated automatic
4443 /// acknowledgment. ACK timing parameters are defined in the configuration
4444 /// structure.
4445 ///
4446 /// While auto-ACKing is enabled, do not call the following RAIL functions:
4447 /// - RAIL_SetRxTransitions()
4448 /// - RAIL_SetTxTransitions()
4449 ///
4450 /// Note that if you are enabling auto-ACK (i.e., "enable" field is true)
4451 /// the "error" fields of rxTransitions and txTransitions are ignored.
4452 /// After all ACK sequences, (success or fail) the state machine will return
4453 /// the radio to the "success" state, which can be either
4454 /// \ref RAIL_RF_STATE_RX or \ref RAIL_RF_STATE_IDLE (returning to
4455 /// \ref RAIL_RF_STATE_TX is not supported).
4456 /// If you need information about the
4457 /// actual success of the ACK sequence, use RAIL events such as
4458 /// \ref RAIL_EVENT_TXACK_PACKET_SENT to make sure an ACK was sent, or
4459 /// \ref RAIL_EVENT_RX_ACK_TIMEOUT to make sure that an ACK was received
4460 /// within the specified timeout.
4461 ///
4462 /// To set a certain turnaround time (i.e., txToRx and rxToTx
4463 /// in \ref RAIL_StateTiming_t), make txToRx lower than
4464 /// desired to ensure you get to RX in time to receive the ACK.
4465 /// Silicon Labs recommends setting 10 us lower than desired:
4466 ///
4467 /// @code{.c}
4468 /// void setAutoAckStateTimings()
4469 /// {
4470 /// RAIL_StateTiming_t timings;
4471 ///
4472 /// // User is already in auto-ACK and wants a turnaround of 192 us.
4473 /// timings.rxToTx = 192;
4474 /// timings.txToRx = 192 - 10;
4475 ///
4476 /// // Set other fields of timings...
4477 /// timings.idleToRx = 100;
4478 /// timings.idleToTx = 100;
4479 /// timings.rxSearchTimeout = 0;
4480 /// timings.txToRxSearchTimeout = 0;
4481 ///
4482 /// RAIL_SetStateTiming(railHandle, &timings);
4483 /// }
4484 /// @endcode
4485 ///
4486 /// As opposed to an explicit "Disable" API, set the "enable"
4487 /// field of the RAIL_AutoAckConfig_t to false. Then, auto-ACK will be
4488 /// disabled and state transitions will be returned to the values set
4489 /// in \ref RAIL_AutoAckConfig_t. When disabling, the "ackTimeout" field
4490 /// isn't used.
4491 ///
4492 /// @note Auto-ACKing may not be enabled while RX Channel Hopping is enabled,
4493 /// or when BLE is enabled.
4494 ///
4495 RAIL_Status_t RAIL_ConfigAutoAck(RAIL_Handle_t railHandle,
4496 const RAIL_AutoAckConfig_t *config);
4497
4498 /**
4499 * Return the enable status of the auto-ACK feature.
4500 *
4501 * @param[in] railHandle A RAIL instance handle.
4502 * @return true if auto-ACK is enabled, false if disabled.
4503 */
4504 bool RAIL_IsAutoAckEnabled(RAIL_Handle_t railHandle);
4505
4506 /**
4507 * Load the auto-ACK buffer with ACK data.
4508 *
4509 * @param[in] railHandle A RAIL instance handle.
4510 * @param[in] ackData A pointer to ACK data to transmit.
4511 * @param[in] ackDataLen The number of bytes in ACK data.
4512 * @return Status code indicating success of the function call.
4513 *
4514 * If the ACK buffer is available for updates, load the ACK buffer with data.
4515 */
4516 RAIL_Status_t RAIL_WriteAutoAckFifo(RAIL_Handle_t railHandle,
4517 const uint8_t *ackData,
4518 uint8_t ackDataLen);
4519
4520 /**
4521 * Pause/resume RX auto-ACK functionality.
4522 *
4523 * @param[in] railHandle A RAIL instance handle.
4524 * @param[in] pause Pause or resume RX auto-ACKing.
4525 *
4526 * When RX auto-ACKing is paused, the radio transitions to default
4527 * state after receiving a packet and does not transmit an ACK.
4528 * When RX auto-ACK is resumed, the radio resumes automatically ACKing
4529 * every successfully received packet.
4530 */
4531 void RAIL_PauseRxAutoAck(RAIL_Handle_t railHandle,
4532 bool pause);
4533
4534 /**
4535 * Return whether the RX auto-ACK is paused.
4536 *
4537 * @param[in] railHandle A RAIL instance handle.
4538 * @return true if RX auto-ACK is paused, false if not paused.
4539 */
4540 bool RAIL_IsRxAutoAckPaused(RAIL_Handle_t railHandle);
4541
4542 /**
4543 * Pause/resume TX auto-ACK functionality.
4544 *
4545 * @param[in] railHandle A RAIL instance handle.
4546 * @param[in] pause Pause or resume TX auto-ACKing.
4547 *
4548 * When TX auto-ACKing is paused, the radio transitions to a default
4549 * state after transmitting a packet and does not wait for an ACK. When TX
4550 * auto-ACK is resumed, the radio resumes automatically waiting for
4551 * an ACK after a successful transmit.
4552 */
4553 void RAIL_PauseTxAutoAck(RAIL_Handle_t railHandle, bool pause);
4554
4555 /**
4556 * Return whether the TX auto-ACK is paused.
4557 *
4558 * @param[in] railHandle A RAIL instance handle.
4559 * @return true if TX auto-ACK is paused, false if not paused.
4560 */
4561 bool RAIL_IsTxAutoAckPaused(RAIL_Handle_t railHandle);
4562
4563 /**
4564 * Modify the upcoming ACK to use the Transmit FIFO.
4565 *
4566 * @param[in] railHandle A RAIL instance handle.
4567 * @return Status code indicating success of the function call. The call will
4568 * fail if it is too late to modify the outgoing ACK.
4569 *
4570 * This function allows the application to use the normal Transmit FIFO as
4571 * the data source for the upcoming ACK. The ACK modification to use the
4572 * Transmit FIFO only applies to one ACK transmission.
4573 *
4574 * This function only returns true if the following conditions are met:
4575 * - Radio has not already decided to use the ACK buffer AND
4576 * - Radio is either looking for sync, receiving the packet after sync, or in
4577 * the Rx2Tx turnaround before the ACK is sent.
4578 *
4579 * @note The Transmit FIFO must not be used for AutoACK when IEEE 802.15.4,
4580 * Z-Wave, or BLE protocols are active.
4581 */
4582 RAIL_Status_t RAIL_UseTxFifoForAutoAck(RAIL_Handle_t railHandle);
4583
4584 /**
4585 * Cancel the upcoming ACK.
4586 *
4587 * @param[in] railHandle A RAIL instance handle.
4588 * @return Status code indicating success of the function call. This call will
4589 * fail if it is too late to modify the outgoing ACK.
4590 *
4591 * This function allows the application to cancel the upcoming automatic
4592 * acknowledgment.
4593 *
4594 * This function only returns true if the following conditions are met:
4595 * - Radio has not already decided to transmit the ACK AND
4596 * - Radio is either looking for sync, receiving the packet after sync or in
4597 * the Rx2Tx turnaround before the ACK is sent.
4598 */
4599 RAIL_Status_t RAIL_CancelAutoAck(RAIL_Handle_t railHandle);
4600
4601 /**
4602 * Return whether the radio is currently waiting for an ACK.
4603 *
4604 * @param[in] railHandle A RAIL instance handle.
4605 * @return True if radio is waiting for ACK, false if radio is not waiting for
4606 * an ACK.
4607 *
4608 * This function allows the application to query whether the radio is currently
4609 * waiting for an ACK after a transmit operation.
4610 */
4611 bool RAIL_IsAutoAckWaitingForAck(RAIL_Handle_t railHandle);
4612
4613 /** @} */ // end of group Auto_Ack
4614
4615 /******************************************************************************
4616 * Calibration
4617 *****************************************************************************/
4618 /// @addtogroup Calibration
4619 /// @brief APIs for calibrating the radio
4620 /// @{
4621 ///
4622 /// These APIs calibrate the radio. The RAIL library
4623 /// determines which calibrations are necessary. Calibrations can
4624 /// be enabled/disabled with the RAIL_CalMask_t parameter.
4625 ///
4626 /// Some calibrations produce values that can be saved and reapplied to
4627 /// avoid repeating the calibration process.
4628 ///
4629 /// Calibrations can either be run with \ref RAIL_Calibrate, or with the
4630 /// individual chip-specific calibration routines. An example for running code
4631 /// with \ref RAIL_Calibrate looks like the following:
4632 ///
4633 /// @code{.c}
4634 /// static RAIL_CalValues_t calValues = RAIL_CALVALUES_UNINIT;
4635 ///
4636 /// void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events) {
4637 /// // Omitting other event handlers
4638 /// if (events & RAIL_EVENT_CAL_NEEDED) {
4639 /// // Run all pending calibrations, and save the results
4640 /// RAIL_Calibrate(railHandle, &calValues, RAIL_CAL_ALL_PENDING);
4641 /// }
4642 /// }
4643 /// @endcode
4644 ///
4645 /// Alternatively, if the image rejection calibration for your chip can be
4646 /// determined ahead of time, such as by running the calibration on a separate
4647 /// firmware image on each chip, the following calibration process will
4648 /// result in smaller code.
4649 ///
4650 /// @code{.c}
4651 /// static uint32_t imageRejection = IRCAL_VALUE;
4652 ///
4653 /// void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events) {
4654 /// // Omitting other event handlers
4655 /// if (events & RAIL_EVENT_CAL_NEEDED) {
4656 /// RAIL_CalMask_t pendingCals = RAIL_GetPendingCal(railHandle);
4657 /// // Disable the radio if we have to do an offline calibration
4658 /// if (pendingCals & RAIL_CAL_TEMP_VC0) {
4659 /// RAIL_CalibrateTemp(railHandle);
4660 /// }
4661 /// if (pendingCals & RAIL_CAL_ONETIME_IRCAL) {
4662 /// RAIL_ApplyIrCalibration(railHandle, imageRejection);
4663 /// }
4664 /// }
4665 /// }
4666 /// @endcode
4667
4668 /**
4669 * Initialize RAIL calibration.
4670 *
4671 * @param[in] railHandle A RAIL instance handle.
4672 * @param[in] calEnable A bitmask that indicates which calibrations
4673 * to enable for a callback notification.
4674 * The exact meaning of these bits is chip-specific.
4675 * @return Status code indicating success of the function call.
4676 *
4677 * Calibration initialization provides the calibration settings that
4678 * correspond to the current radio configuration.
4679 */
4680 RAIL_Status_t RAIL_ConfigCal(RAIL_Handle_t railHandle,
4681 RAIL_CalMask_t calEnable);
4682
4683 /**
4684 * Start the calibration process.
4685 *
4686 * @param[in] railHandle A RAIL instance handle.
4687 * @param[in,out] calValues A structure of calibration values to apply.
4688 * If a valid calibration structure is provided and the structure
4689 * contains valid calibration values, those values will be applied to the
4690 * hardware and the RAIL library will cache those values for use again later.
4691 * If a valid calibration structure is provided and the structure
4692 * contains a calibration value of \ref RAIL_CAL_INVALID_VALUE for the
4693 * desired calibration, the desired calibration will run, the calibration
4694 * values structure will be updated with a valid calibration value, and the
4695 * RAIL library will cache that value for use again later.
4696 * If a NULL pointer is provided, the desired calibration will run
4697 * and the RAIL library will cache that value for use again later. However,
4698 * the valid calibration value will not be returned to the application.
4699 * @param[in] calForce A mask to force specific calibration(s) to execute.
4700 * To run all pending calibrations, use the value \ref RAIL_CAL_ALL_PENDING.
4701 * Only the calibrations specified will run, even if not enabled during
4702 * initialization.
4703 * @return Status code indicating success of the function call.
4704 *
4705 * If calibrations were performed previously and the application saves the
4706 * calibration values (i.e., call this function with a calibration values
4707 * structure containing calibration values of \ref RAIL_CAL_INVALID_VALUE
4708 * before a reset), the application can later bypass the time it would normally
4709 * take to recalibrate hardware by reusing previous calibration values (i.e.,
4710 * call this function with a calibration values structure containing valid
4711 * calibration values after a reset).
4712 *
4713 * If multiple protocols are used, this function will make the given railHandle
4714 * active, if not already, and perform calibration. If called during a protocol
4715 * switch, to perform an IR calibration for the first time, it will
4716 * return \ref RAIL_STATUS_INVALID_STATE, in which case the application must
4717 * defer calibration until after the protocol switch is complete. Silicon Labs
4718 * recommends calling this function from the application main loop.
4719 *
4720 * @note Instead of this function, consider using the individual chip-specific
4721 * functions. Using the individual functions will allow for better
4722 * dead-stripping if not all calibrations are run.
4723 * @note Some calibrations should only be executed when the radio is IDLE. See
4724 * chip-specific documentation for more details.
4725 */
4726 RAIL_Status_t RAIL_Calibrate(RAIL_Handle_t railHandle,
4727 RAIL_CalValues_t *calValues,
4728 RAIL_CalMask_t calForce);
4729
4730 /**
4731 * Return the current set of pending calibrations.
4732 *
4733 * @param[in] railHandle A RAIL instance handle.
4734 * @return A mask of all pending calibrations that the user has been asked to
4735 * perform.
4736 *
4737 * This function returns a full set of pending calibrations. The only way
4738 * to clear pending calibrations is to perform them using the \ref
4739 * RAIL_Calibrate() API with the appropriate list of calibrations.
4740 */
4741 RAIL_CalMask_t RAIL_GetPendingCal(RAIL_Handle_t railHandle);
4742
4743 /**
4744 * Enable/disable the PA calibration.
4745 *
4746 * @param[in] enable Enables/disables the PA calibration.
4747 *
4748 * Enabling will ensure that the PA power remains constant chip-to-chip.
4749 * By default, this feature is disabled after reset.
4750 *
4751 * @note Call this function before \ref RAIL_ConfigTxPower() if this
4752 * feature is desired.
4753 */
4754 void RAIL_EnablePaCal(bool enable);
4755
4756 /** @} */ // end of group Calibration
4757
4758 /******************************************************************************
4759 * RF Sense Structures
4760 *****************************************************************************/
4761 /**
4762 * @addtogroup Rf_Sense RF Sense
4763 * @{
4764 */
4765
4766 /**
4767 * Start/stop the RF Sense functionality in Energy Detection Mode for use
4768 * during low-energy sleep modes.
4769 *
4770 * @param[in] railHandle A RAIL instance handle.
4771 * @param[in] band The frequency band(s) on which to sense the RF energy.
4772 * To stop RF Sense, specify \ref RAIL_RFSENSE_OFF.
4773 * @param[in] senseTime The time (in microseconds) the RF energy must be
4774 * continually detected to be considered "sensed".
4775 * @param[in] cb \ref RAIL_RfSense_CallbackPtr_t is called when the RF is
4776 * sensed. Set null if polling via \ref RAIL_IsRfSensed().
4777 * @return The actual senseTime used, which may be different than
4778 * requested due to limitations of the hardware. If 0, RF sense was
4779 * disabled or could not be enabled (no callback will be issued).
4780 *
4781 * The EFR32 has the ability to sense the presence of RF Energy above -20 dBm
4782 * within either or both the 2.4 GHz and Sub-GHz bands and trigger an event
4783 * if that energy is continuously present for certain durations of time.
4784 *
4785 * @note After RF energy has been sensed, the RF Sense is automatically
4786 * disabled and \ref RAIL_StartRfSense() must be called again to reactivate it.
4787 * If RF energy has not been sensed and to manually disable RF Sense,
4788 * \ref RAIL_StartRfSense() must be called with band specified as
4789 * \ref RAIL_RFSENSE_OFF or with senseTime set to 0 microseconds.
4790 *
4791 * @note Packet reception is not guaranteed to work correctly once RF Sense is
4792 * enabled, both in single protocol and multiprotocol RAIL.
4793 * To be safe, an application should turn this on only after idling
4794 * the radio to stop receive and turn it off before attempting to restart
4795 * receive. Since EM4 sleep causes the chip to come up through the reset
4796 * vector any wake from EM4 must also shut off RF Sense to ensure proper
4797 * receive functionality.
4798 *
4799 * @warning For some chips, RF Sense functionality is only guaranteed within
4800 * a specified temperature range.
4801 * See chip-specific documentation for more details.
4802 */
4803 RAIL_Time_t RAIL_StartRfSense(RAIL_Handle_t railHandle,
4804 RAIL_RfSenseBand_t band,
4805 RAIL_Time_t senseTime,
4806 RAIL_RfSense_CallbackPtr_t cb);
4807
4808 /// Start/stop the RF Sense functionality in Selective(OOK Based) Mode for use
4809 /// during low-energy sleep modes.
4810 ///
4811 /// @param[in] railHandle A RAIL instance handle.
4812 /// @param[in] config \ref RAIL_RfSenseSelectiveOokConfig_t holds the RFSENSE
4813 /// configuration for Selective(OOK) mode.
4814 /// @return Status code indicating success of the function call.
4815 ///
4816 /// Some chips support Selective RF energy detection (OOK mode) where the
4817 /// user can program the chip to look for a particular sync word pattern
4818 /// (1byte - 4bytes) sent using OOK and wake only when that is detected.
4819 /// See chip-specific documentation for more details.
4820 ///
4821 /// The following code gives an example of how to use RF Sense functionality
4822 /// in Selective(OOK Based) Mode.
4823 /// @code{.c}
4824 ///
4825 /// // Syncword Length in bytes, 1-4 bytes.
4826 /// #define NUMSYNCWORDBYTES (2U)
4827 /// // Syncword Value.
4828 /// #define SYNCWORD (0xB16FU)
4829 ///
4830 /// // Configure the transmitting node for sending the wakeup packet.
4831 /// RAIL_Idle(railHandle, RAIL_IDLE_ABORT, true);
4832 /// RAIL_ConfigRfSenseSelectiveOokWakeupPhy(railHandle);
4833 /// RAIL_SetRfSenseSelectiveOokWakeupPayload(railHandle, NUMSYNCWORDBYTES, SYNCWORD);
4834 /// RAIL_StartTx(railHandle, channel, RAIL_TX_OPTIONS_DEFAULT, NULL);
4835 ///
4836 /// // Configure the receiving node (EFR32XG22) for RF Sense.
4837 /// RAIL_RfSenseSelectiveOokConfig_t config = {
4838 /// .band = rfBand,
4839 /// .syncWordNumBytes = NUMSYNCWORDBYTES,
4840 /// .syncWord = SYNCWORD,
4841 /// .cb = &RAILCb_SensedRf
4842 /// };
4843 /// RAIL_StartSelectiveOokRfSense(railHandle, &config);
4844 ///
4845 /// @endcode
4846 ///
4847 /// @note After RF energy has been sensed, the RF Sense is automatically
4848 /// disabled and \ref RAIL_StartSelectiveOokRfSense() must be called again to
4849 /// reactivate. If RF energy has not been sensed and to manually disable
4850 /// RF Sense, \ref RAIL_StartSelectiveOokRfSense() must be called with band
4851 /// specified as \ref RAIL_RFSENSE_OFF or with
4852 /// \ref RAIL_RfSenseSelectiveOokConfig_t as NULL.
4853 ///
4854 /// @note Packet reception is not guaranteed to work correctly once RF Sense is
4855 /// enabled, both in single protocol and multiprotocol RAIL.
4856 /// To be safe, an application should turn this on only after idling
4857 /// the radio to stop receive and turn it off before attempting to restart
4858 /// receive. Since EM4 sleep causes the chip to come up through the reset
4859 /// vector any wake from EM4 must also shut off RF Sense to ensure proper
4860 /// receive functionality.
4861 ///
4862 RAIL_Status_t RAIL_StartSelectiveOokRfSense(RAIL_Handle_t railHandle,
4863 RAIL_RfSenseSelectiveOokConfig_t *config);
4864
4865 /**
4866 * Switch to RF Sense Selective(OOK) PHY.
4867 *
4868 * @param[in] railHandle A handle for RAIL instance.
4869 * @return A status code indicating success of the function call.
4870 *
4871 * This function switches to the RFSENSE Selective(OOK) PHY for transmitting a
4872 * packet to wake up a chip that supports Selective RF energy detection (OOK
4873 * mode). You may only call this function while the radio is idle. While the
4874 * radio is configured for this PHY, receive functionality should not be used.
4875 *
4876 * @note The user must also set up the transmit FIFO, via
4877 * \ref RAIL_SetRfSenseSelectiveOokWakeupPayload, post this function call to
4878 * include the first byte as the Preamble Byte, followed by the
4879 * Syncword (1byte - 4bytes).
4880 * See chip-specific documentation for more details.
4881 */
4882 RAIL_Status_t RAIL_ConfigRfSenseSelectiveOokWakeupPhy(RAIL_Handle_t railHandle);
4883
4884 /**
4885 * Set the transmit payload for waking up a node configured for
4886 * RF Sense Selective(OOK).
4887 *
4888 * @param[in] railHandle A handle for RAIL instance.
4889 * @param[in] numSyncwordBytes Syncword Length in bytes, 1-4 bytes.
4890 * @param[in] syncword Syncword Value.
4891 * @return A status code indicating success of the function call.
4892 *
4893 * @note You must call this function after the chip has been set up with the
4894 * RF Sense Selective(OOK) PHY, using \ref RAIL_ConfigRfSenseSelectiveOokWakeupPhy.
4895 *
4896 */
4897 RAIL_Status_t RAIL_SetRfSenseSelectiveOokWakeupPayload(RAIL_Handle_t railHandle,
4898 uint8_t numSyncwordBytes,
4899 uint32_t syncword);
4900
4901 /**
4902 * Check whether the RF was sensed.
4903 *
4904 * @param[in] railHandle A RAIL instance handle.
4905 * @return true if RF was sensed since the last call to \ref RAIL_StartRfSense.
4906 * False otherwise.
4907 *
4908 * This function is useful if \ref RAIL_StartRfSense is called with a null
4909 * callback. It is generally used after EM4 reboot but can be used any time.
4910 */
4911 bool RAIL_IsRfSensed(RAIL_Handle_t railHandle);
4912
4913 /** @} */ // end of group Rf_Sense
4914
4915 /******************************************************************************
4916 * RX Channel Hopping
4917 *****************************************************************************/
4918 /**
4919 * @addtogroup Rx_Channel_Hopping RX Channel Hopping
4920 * @brief Hardware accelerated hopping between channels while waiting for a
4921 * packet in receive.
4922 * @{
4923 *
4924 * Channel hopping provides a hardware accelerated method for
4925 * scanning across multiple channels quickly, as part of a receive protocol.
4926 * While it is possible to call \ref RAIL_StartRx on different channels,
4927 * back to back, and listen on many channels sequentially in that way, the
4928 * time it takes to switch channels with that method may be too long for some
4929 * protocols. This API pre-computes necessary channel change operations
4930 * for a given list of channels, so that the radio can move from channel
4931 * to channel much faster. Additionally, it leads to more succinct code
4932 * as channel changes will be done implicitly, without requiring numerous calls
4933 * to \ref RAIL_StartRx. Currently, while this feature is enabled, the radio
4934 * will hop channels in the given sequence each time it enters RX.
4935 *
4936 * The channel hopping buffer requires RAIL_CHANNEL_HOPPING_BUFFER_SIZE_PER_CHANNEL
4937 * number of 32-bit words of overhead per channel, plus 3 words overall plus the
4938 * twice the size of the radioConfigDeltaSubtract of the whole radio configuration,
4939 * plus the twice the sum of the sizes of all the radioConfigDeltaAdds of
4940 * all the channel hopping channels.
4941 *
4942 * The following code gives an example of how to use
4943 * the RX Channel Hopping API.
4944 * @code{.c}
4945 *
4946
4947 * #define CHANNEL_HOPPING_NUMBER_OF_CHANNELS 4
4948 * #define CHANNEL_HOPPING_BUFFER_SIZE do { \
4949 * 3 + \
4950 * (RAIL_CHANNEL_HOPPING_BUFFER_SIZE_PER_CHANNEL \
4951 * * CHANNEL_HOPPING_NUMBER_OF_CHANNELS) + \
4952 * 2 * (SIZEOF_UINT32_DELTA_SUBTRACT + \
4953 * SIZEOF_UINT32_DELTA_ADD_0 + \
4954 * SIZEOF_UINT32_DELTA_ADD_1 + \
4955 * SIZEOF_UINT32_DELTA_ADD_2 + \
4956 * SIZEOF_UINT32_DELTA_ADD_3) \
4957 * } while (0)
4958 *
4959 * RAIL_RxChannelHoppingConfigEntry_t channelHoppingEntries[CHANNEL_HOPPING_NUMBER_OF_CHANNELS];
4960 * uint32_t channelHoppingBuffer[CHANNEL_HOPPING_BUFFER_SIZE];
4961 *
4962 * RAIL_RxChannelHoppingConfig_t channelHoppingConfig = {
4963 * .buffer = channelHoppingBuffer,
4964 * .bufferLength = CHANNEL_HOPPING_BUFFER_SIZE,
4965 * .numberOfChannels = CHANNEL_HOPPING_NUMBER_OF_CHANNELS,
4966 * .entries = channelHoppingEntries
4967 * };
4968 *
4969 * channelHoppingEntries[0].channel = 1;
4970 * channelHoppingEntries[1].channel = 2;
4971 * channelHoppingEntries[2].channel = 3;
4972 *
4973 * RAIL_ConfigRxChannelHopping(railHandle, &channelHoppingConfig);
4974 * RAIL_EnableRxChannelHopping(railHandle, true, true)
4975 * @endcode
4976 */
4977
4978 /**
4979 * Configure RX Channel Hopping.
4980 *
4981 * @param[in] railHandle A RAIL instance handle.
4982 * @param[in] config Configuration parameters for RX Channel Hopping.
4983 * @return Status code indicating success of the function call.
4984 *
4985 * Configure Channel Hopping channels, conditions, and parameters. This
4986 * API must be called before \ref RAIL_EnableRxChannelHopping(). This API must
4987 * never be called while the radio is on with RX Duty Cycle or Channel
4988 * Hopping enabled.
4989 *
4990 * @note This feature/API is not supported on the EFR32XG1 family of chips.
4991 * Use the compile time symbol \ref RAIL_SUPPORTS_CHANNEL_HOPPING or
4992 * the runtime call \ref RAIL_SupportsChannelHopping() to check whether
4993 * the platform supports this feature.
4994 *
4995 * @note Calling this function will overwrite any settings configured with
4996 * \ref RAIL_ConfigRxDutyCycle.
4997 */
4998 RAIL_Status_t RAIL_ConfigRxChannelHopping(RAIL_Handle_t railHandle,
4999 RAIL_RxChannelHoppingConfig_t *config);
5000
5001 /**
5002 * Enable RX channel hopping.
5003 *
5004 * @param[in] railHandle A RAIL instance handle.
5005 * @param[in] enable Enable (true) or disable (false) RX Channel Hopping.
5006 * @param[in] reset Start from the first channel of the channel hopping
5007 * sequence (true) or from wherever hopping left off last time the code
5008 * left RX.
5009 * @return Status code indicating success of the function call.
5010 *
5011 * Enable or disable Channel Hopping. Additionally, specify whether hopping
5012 * should be reset to start from the channel at index zero, or continue
5013 * from the channel last hopped to. The radio should not be on when
5014 * this API is called. \ref RAIL_ConfigRxChannelHopping must be called
5015 * successfully before this API is called.
5016 *
5017 * @note This feature/API is not supported on the EFR32XG1 family of chips.
5018 * Use the compile time symbol \ref RAIL_SUPPORTS_CHANNEL_HOPPING or
5019 * the runtime call \ref RAIL_SupportsChannelHopping() to check whether
5020 * the platform supports this feature.
5021 *
5022 * @note RX Channel Hopping may not be enabled while auto-ACKing is enabled.
5023 *
5024 * @note Calling this function will overwrite any settings configured with
5025 * \ref RAIL_EnableRxDutyCycle.
5026 */
5027 RAIL_Status_t RAIL_EnableRxChannelHopping(RAIL_Handle_t railHandle,
5028 bool enable,
5029 bool reset);
5030 /**
5031 * Get RSSI of one channel in the channel hopping sequence, during
5032 * channel hopping.
5033 *
5034 * @param[in] railHandle A RAIL instance handle.
5035 * @param[in] channelIndex Index in the channel hopping sequence of the
5036 * channel of interest
5037 * @return Latest RSSI for the channel at the specified index.
5038 *
5039 * @note This feature/API is not supported on the EFR32XG1 family of chips.
5040 * Use the compile time symbol \ref RAIL_SUPPORTS_CHANNEL_HOPPING or
5041 * the runtime call \ref RAIL_SupportsChannelHopping() to check whether
5042 * the platform supports this feature.
5043 *
5044 * @note In multiprotocol, this function returns \ref RAIL_RSSI_INVALID
5045 * immediately if railHandle is not the current active \ref RAIL_Handle_t.
5046 *
5047 * @note \ref RAIL_ConfigRxChannelHopping must be called successfully
5048 * before this API is called.
5049 *
5050 * @note When the Z-Wave protocol is active, it is expected that after
5051 * \ref RAIL_ConfigRxChannelHopping is called successfully on EFR32XG1
5052 * family of chips, running \ref RAIL_GetChannelHoppingRssi() on a 40kbps
5053 * PHY will not work well. Plan to use the 9.6kbps PHY for estimating
5054 * channel noise instead. On EFR32XG2 family of chips, running
5055 * \ref RAIL_GetChannelHoppingRssi() on the 9.6kbps PHY returns the RSSI
5056 * measurement of the 40kpbs PHY. This is because the 9.6kbps PHY has
5057 * trouble with RSSI measurements on EFR32XG2 family of chips.
5058 */
5059 int16_t RAIL_GetChannelHoppingRssi(RAIL_Handle_t railHandle,
5060 uint8_t channelIndex);
5061
5062 /// Configure RX duty cycle mode.
5063 ///
5064 /// @param[in] railHandle A RAIL instance handle.
5065 /// @param[in] config Configuration structure to specify duty cycle parameters.
5066 /// @return Status code indicating success of the function call.
5067 ///
5068 /// Configure RX duty cycle mode. With this mode enabled, every time the radio
5069 /// enters RX, it will duty cycle on and off to save power. The duty cycle
5070 /// ratio can be altered dynamically and intelligently by the hardware by
5071 /// staying on longer if a preamble or other packet segments are detected in
5072 /// the air. This API must never be called while the radio is on with RX Duty
5073 /// Cycle or Channel Hopping enabled.
5074 /// For short delays (in the order of microseconds),
5075 /// \ref RAIL_RxDutyCycleConfig_t::delay, this can be used to save receive
5076 /// current while having little impact on the radio performance, for protocols
5077 /// with long preambles. For long delays (in the order of milliseconds or higher)
5078 /// the chip can be put into EM2 energy mode before re-entering RX,
5079 /// to save extra power, with some application hooks as shown below.
5080 ///
5081 /// @code{.c}
5082 /// #include <rail.h>
5083 /// #include <rail_types.h>
5084 ///
5085 /// extern RAIL_Handle_t railHandle;
5086 /// RAIL_Time_t periodicWakeupUs;
5087 ///
5088 /// void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events) {
5089 /// // Omitting other event handlers
5090 /// if (events & RAIL_EVENT_RX_DUTY_CYCLE_RX_END) {
5091 /// // Schedule the next receive.
5092 /// RAIL_ScheduleRxConfig_t rxCfg = {
5093 /// .start = periodicWakeupUs,
5094 /// .startMode = RAIL_TIME_DELAY,
5095 /// .end = 0U,
5096 /// .endMode = RAIL_TIME_DISABLED,
5097 /// .rxTransitionEndSchedule = 0U,
5098 /// .hardWindowEnd = 0U
5099 /// };
5100 ///
5101 /// RAIL_Idle(railHandle, RAIL_IDLE_ABORT, true);
5102 /// RAIL_ScheduleRx(railHandle, channel, &rxCfg, NULL);
5103 /// }
5104 /// }
5105 ///
5106 /// void main(void) {
5107 /// RAIL_Status_t status;
5108 /// bool shouldSleep = false;
5109 ///
5110 /// // This function depends on your board/chip but it must enable the LFCLK
5111 /// // you intend to use for RTCC sync before we configure sleep as that
5112 /// // function will attempt to auto detect the clock.
5113 /// BoardSetupLFCLK();
5114 /// // Initialize Power Manager module
5115 /// sl_power_manager_init();
5116 /// // Initialize RAIL Power Manager
5117 /// RAIL_InitPowerManager();
5118 ///
5119 /// // Configure sleep for timer synchronization
5120 /// status = RAIL_ConfigSleep(railHandle, RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED);
5121 /// assert(status == RAIL_STATUS_NO_ERROR);
5122 ///
5123 /// // Application main loop
5124 /// while(1) {
5125 /// // ... do normal app stuff and set shouldSleep when we want to sleep
5126 /// if (shouldSleep) {
5127 /// // Let the CPU go to sleep if the system allows it.
5128 /// sl_power_manager_sleep();
5129 /// }
5130 /// }
5131 /// }
5132 /// @endcode
5133 ///
5134 /// @note This feature/API is not supported on the EFR32XG1 family of chips.
5135 /// Use the compile time symbol \ref RAIL_SUPPORTS_CHANNEL_HOPPING or
5136 /// the runtime call \ref RAIL_SupportsChannelHopping() to check whether
5137 /// the platform supports this feature.
5138 ///
5139 /// @note Calling this function will overwrite any settings configured with
5140 /// \ref RAIL_ConfigRxChannelHopping.
5141 RAIL_Status_t RAIL_ConfigRxDutyCycle(RAIL_Handle_t railHandle,
5142 const RAIL_RxDutyCycleConfig_t *config);
5143
5144 /**
5145 * Enable RX duty cycle mode.
5146 *
5147 * @param[in] railHandle A RAIL instance handle.
5148 * @param[in] enable Enable (true) or disable (false) RX Duty Cycling.
5149 * @return Status code indicating success of the function call.
5150 *
5151 * Enable or disable RX duty cycle mode. After this is called, the radio
5152 * will begin duty cycling each time it enters RX, based on the
5153 * configuration passed to \ref RAIL_ConfigRxDutyCycle. This API must not
5154 * be called while the radio is on.
5155 *
5156 * @note This feature/API is not supported on the EFR32XG1 family of chips.
5157 * Use the compile time symbol \ref RAIL_SUPPORTS_CHANNEL_HOPPING or
5158 * the runtime call \ref RAIL_SupportsChannelHopping() to check whether
5159 * the platform supports this feature.
5160 *
5161 * @note Calling this function will overwrite any settings configured with
5162 * \ref RAIL_EnableRxChannelHopping.
5163 */
5164 RAIL_Status_t RAIL_EnableRxDutyCycle(RAIL_Handle_t railHandle,
5165 bool enable);
5166
5167 /**
5168 * Get the default RX duty cycle configuration.
5169 *
5170 * @param[in] railHandle A RAIL instance handle.
5171 * @param[out] config An application-provided non-NULL pointer to store
5172 * the default RX duty cycle configuration.
5173 * @return Status code indicating success of the function call.
5174 * Note that RAIL_STATUS_INVALID_PARAMETER will be returned if the current
5175 * channel's radio configuration does not support the requested information.
5176 *
5177 * To save power during RX, an application may want to go to low power as long as
5178 * possible by periodically waking up and trying to
5179 * "sense" if there are any incoming packets. This API returns the recommended
5180 * RX duty cycle configuration, so the application can enter low power mode
5181 * periodically without missing packets. To wake up
5182 * earlier, the application can reduce the delay parameter.
5183 * Note that these value might be different if any configuration / channel has
5184 * changed.
5185 **/
5186 RAIL_Status_t RAIL_GetDefaultRxDutyCycleConfig(RAIL_Handle_t railHandle,
5187 RAIL_RxDutyCycleConfig_t *config);
5188
5189 /** @} */ // end of group Rx_Channel_Hopping
5190
5191 /******************************************************************************
5192 * Multiprotocol-Specific Functions
5193 *****************************************************************************/
5194 /**
5195 * @addtogroup Multiprotocol
5196 * @brief Multiprotocol scheduler APIs to support multiple time-sliced PHYs.
5197 * @{
5198 */
5199
5200 /**
5201 * Yield the radio to other configurations.
5202 *
5203 * @param[in] railHandle A RAIL instance handle.
5204 *
5205 * This function is used to indicate that the previous transmit or scheduled
5206 * receive operation has completed. It must be used in multiprotocol RAIL because
5207 * the scheduler assumes that any transmit or receive operation that is started
5208 * can go on indefinitely based on state transitions and your protocol.
5209 * RAIL will not allow a lower priority tasks to run until this is called so it
5210 * can negatively impact performance of those protocols if this is omitted or
5211 * delayed. It is also possible to call the \ref RAIL_Idle() API to
5212 * both terminate the operation and idle the radio. In single protocol RAIL
5213 * this API does nothing, however, if RAIL Power Manager is initialized,
5214 * calling \ref RAIL_YieldRadio after scheduled TX/RX and instantaneous TX
5215 * completion, is required, to indicate to the Power Manager that the the radio
5216 * is no longer busy and can be idled for sleeping.
5217 *
5218 * See \ref rail_radio_scheduler_yield for more details.
5219 */
5220 void RAIL_YieldRadio(RAIL_Handle_t railHandle);
5221
5222 /**
5223 * Get the status of the RAIL scheduler.
5224 *
5225 * @param[in] railHandle A RAIL instance handle.
5226 * @return \ref RAIL_SchedulerStatus_t status.
5227 *
5228 * This function can only be called from a callback context after the
5229 * \ref RAIL_EVENT_SCHEDULER_STATUS event occurs.
5230 */
5231 RAIL_SchedulerStatus_t RAIL_GetSchedulerStatus(RAIL_Handle_t railHandle);
5232
5233 /**
5234 * Get the status of the RAIL scheduler, specific to the radio operation,
5235 * along with \ref RAIL_Status_t returned by RAIL API invoked by the
5236 * RAIL scheduler.
5237 *
5238 * @param[in] railHandle A RAIL instance handle.
5239 * @param[out] pSchedulerStatus An application-provided pointer to store
5240 * \ref RAIL_SchedulerStatus_t status. Can be NULL as long as
5241 * \ref RAIL_Status_t pointer is not NULL.
5242 * @param[out] pRailStatus An application-provided pointer to store
5243 * \ref RAIL_Status_t of the RAIL API invoked by the RAIL scheduler.
5244 * Can be NULL as long as \ref RAIL_SchedulerStatus_t pointer is not NULL.
5245 * @return \ref RAIL_Status_t indicating success of the function call.
5246 *
5247 * This function can only be called from a callback context after the
5248 * \ref RAIL_EVENT_SCHEDULER_STATUS event occurs.
5249 */
5250 RAIL_Status_t RAIL_GetSchedulerStatusAlt(RAIL_Handle_t railHandle,
5251 RAIL_SchedulerStatus_t *pSchedulerStatus,
5252 RAIL_Status_t *pRailStatus);
5253
5254 /**
5255 * Change the priority of a specified task type in multiprotocol.
5256 *
5257 * @param[in] railHandle A RAIL instance handle.
5258 * @param[in] priority Desired new priority for the railHandle's active task
5259 * @param[in] taskType Type of task whose priority should be updated
5260 * @return \ref RAIL_Status_t indicating success of the function call.
5261 *
5262 * While the application can use this function however it likes, a major use
5263 * case is being able to increase an infinite receive priority while receiving
5264 * a packet. In other words, a given RAIL_Handle_t can maintain a very low
5265 * priority background receive, but upon getting a
5266 * \ref RAIL_EVENT_RX_SYNC1_DETECT_SHIFT or
5267 * \ref RAIL_EVENT_RX_SYNC2_DETECT_SHIFT event, the app can call this function
5268 * to increase the background RX priority to lower the risk another protocol
5269 * might preempt during packet reception.
5270 */
5271 RAIL_Status_t RAIL_SetTaskPriority(RAIL_Handle_t railHandle,
5272 uint8_t priority,
5273 RAIL_TaskType_t taskType);
5274
5275 /**
5276 * Get time needed to switch between protocols.
5277 *
5278 * @return \ref RAIL_Time_t Time needed to switch between protocols.
5279 */
5280 RAIL_Time_t RAIL_GetTransitionTime(void);
5281
5282 /**
5283 * Set time needed to switch between protocols. Call this API
5284 * only once, before any protocol is initialized via
5285 * \ref RAIL_Init(). Changing this value during normal operation
5286 * can result in improper scheduling behavior.
5287 *
5288 * @param[in] transitionTime Time needed to switch between protocols.
5289 */
5290 void RAIL_SetTransitionTime(RAIL_Time_t transitionTime);
5291
5292 /** @} */ // end of group Multiprotocol
5293
5294 /******************************************************************************
5295 * Diagnostic
5296 *****************************************************************************/
5297 /**
5298 * @addtogroup Diagnostic
5299 * @brief APIs for diagnostic and test chip modes
5300 * @{
5301 */
5302
5303 /**
5304 * Configure direct mode for RAIL.
5305 *
5306 * @param[in] railHandle A RAIL instance handle.
5307 * @param[in] directModeConfig Configuration structure to specify direct mode
5308 * parameters. Default configuration will be used if NULL is passed.
5309 * @return \ref RAIL_STATUS_NO_ERROR on success and an error code on failure.
5310 *
5311 * This API configures direct mode and should be called before
5312 * calling \ref RAIL_EnableDirectMode(). If this function is not called, the
5313 * following default configuration will be used: \n
5314 * \b EFR32xG1x \n
5315 * Sync Rx : false \n
5316 * Sync Tx : false \n
5317 * TX data in (DIN) : EFR32_PC10 \n
5318 * RX data out (DOUT) : EFR32_PC11 \n
5319 * TX/RX clk out (DCLK) : EFR32_PC9 \n
5320 * \b EFR32xG2x: \n
5321 * Sync Rx : false \n
5322 * Sync Tx : false \n
5323 * TX data in (DIN) : EFR32_PA7 \n
5324 * RX data out (DOUT) : EFR32_PA5 \n
5325 * TX/RX clk out (DCLK) : EFR32_PA6
5326 *
5327 * @warning This API is not safe to use in a multiprotocol app.
5328 */
5329 RAIL_Status_t RAIL_ConfigDirectMode(RAIL_Handle_t railHandle,
5330 const RAIL_DirectModeConfig_t *directModeConfig);
5331
5332 /**
5333 * Enable or disable direct mode for RAIL.
5334 *
5335 * @param[in] railHandle A RAIL instance handle.
5336 * @param[in] enable Whether or not to enable direct mode for TX and RX.
5337 * @return \ref RAIL_STATUS_NO_ERROR on success and an error code on failure.
5338 * *
5339 * See \ref RAIL_EnableDirectModeAlt() for more detailed function
5340 * description.
5341 *
5342 * @warning New applications should consider using RAIL_EnableDirectModeAlt() for
5343 * this functionality.
5344 *
5345 * @note This feature is only available on certain devices.
5346 * \ref RAIL_SupportsDirectMode() can be used to check if a particular
5347 * device supports this feature or not.
5348 *
5349 * @warning This API is not safe to use in a true multiprotocol app.
5350 */
5351 RAIL_Status_t RAIL_EnableDirectMode(RAIL_Handle_t railHandle,
5352 bool enable);
5353
5354 /**
5355 * Enable or disable direct mode for RAIL.
5356 *
5357 * @param[in] railHandle A RAIL instance handle.
5358 * @param[in] enableDirectTx Enable direct mode for data being transmitted out
5359 * of the radio.
5360 * @param[in] enableDirectRx Enable direct mode for data being received from the
5361 * radio.
5362 * @return \ref RAIL_STATUS_NO_ERROR on success and an error code on failure.
5363 *
5364 * This API enables or disables the modem and GPIOs for direct mode operation.
5365 * see \ref RAIL_ConfigDirectMode for information on selecting the
5366 * correct hardware configuration. If direct mode is enabled,
5367 * packets are output and input directly to the radio via GPIO
5368 * and RAIL packet handling is ignored.
5369 *
5370 * @note This feature is only available on certain chips.
5371 * \ref RAIL_SupportsDirectMode() can be used to check if a particular
5372 * chip supports this feature or not.
5373 *
5374 * @warning this API is not safe to use in a true multiprotocol app.
5375 */
5376 RAIL_Status_t RAIL_EnableDirectModeAlt(RAIL_Handle_t railHandle,
5377 bool enableDirectTx,
5378 bool enableDirectRx);
5379
5380 /**
5381 * Get the radio subsystem clock frequency in Hz.
5382 *
5383 * @param[in] railHandle A RAIL instance handle.
5384 * @return Radio subsystem clock frequency in Hz.
5385 */
5386 uint32_t RAIL_GetRadioClockFreqHz(RAIL_Handle_t railHandle);
5387
5388 /**
5389 * Set the crystal tuning.
5390 *
5391 * @param[in] railHandle A RAIL instance handle.
5392 * @param[in] tune A chip-dependent crystal capacitor bank tuning parameter.
5393 * @return Status code indicating success of the function call.
5394 *
5395 * Tunes the crystal that the radio depends on to change the location of the
5396 * center frequency for transmitting and receiving. This function will only
5397 * succeed if the radio is idle at the time of the call.
5398 *
5399 * @note This function proportionally affects the entire chip's timing
5400 * across all its peripherals, including radio tuning and channel spacing.
5401 * A separate function, \ref RAIL_SetFreqOffset(), can be used to adjust
5402 * just the radio tuner without disturbing channel spacing or other chip
5403 * peripheral timing.
5404 * @note On EFR32xG2 series devices, this API sets CTUNEXIANA and internally
5405 * CTUNEXOANA = CTUNEXIANA + delta where delta is set or changed by
5406 * \ref RAIL_SetTuneDelta. The default delta may not be 0 on some devices.
5407 */
5408 RAIL_Status_t RAIL_SetTune(RAIL_Handle_t railHandle, uint32_t tune);
5409
5410 /**
5411 * Get the crystal tuning.
5412 *
5413 * @param[in] railHandle A RAIL instance handle.
5414 * @return A chip-dependent crystal capacitor bank tuning parameter.
5415 *
5416 * Retrieves the current tuning value used by the crystal that the radio
5417 * depends on.
5418 * @note On EFR32xG2 series devices, this is the CTUNEXIANA value.
5419 */
5420 uint32_t RAIL_GetTune(RAIL_Handle_t railHandle);
5421
5422 /**
5423 * Set the crystal tuning delta.
5424 *
5425 * @param[in] railHandle A RAIL instance handle.
5426 * @param[in] delta A chip-dependent crystal capacitor bank tuning delta.
5427 * @return Status code indicating success of the function call.
5428 *
5429 * Set the CTUNEXOANA delta for \ref RAIL_SetTune to use on EFR32xG2 series devices:
5430 * CTUNEXOANA = CTUNEXIANA + delta. This function does not change CTUNE values;
5431 * call \ref RAIL_SetTune to put a new delta into effect.
5432 *
5433 */
5434 RAIL_Status_t RAIL_SetTuneDelta(RAIL_Handle_t railHandle, int32_t delta);
5435
5436 /**
5437 * Get the crystal tuning delta on EFR32xG2 series devices.
5438 *
5439 * @param[in] railHandle A RAIL instance handle.
5440 * @return A chip-dependent crystal capacitor bank tuning delta.
5441 *
5442 * Retrieves the current tuning delta used by \ref RAIL_SetTune.
5443 * @note The default delta if \ref RAIL_SetTuneDelta has never been called
5444 * is device-dependent and may not be 0.
5445 */
5446 int32_t RAIL_GetTuneDelta(RAIL_Handle_t railHandle);
5447
5448 /**
5449 * Get the frequency offset.
5450 *
5451 * @param[in] railHandle A RAIL instance handle.
5452 * @return Returns the measured frequency offset on a received packet.
5453 * The units are described in the \ref RAIL_FrequencyOffset_t
5454 * documentation. If this returns \ref RAIL_FREQUENCY_OFFSET_INVALID,
5455 * it was called while the radio wasn't active and there is no way
5456 * to get the frequency offset.
5457 *
5458 * Retrieves the measured frequency offset used during the previous
5459 * received packet, which includes the current radio frequency offset
5460 * (see \ref RAIL_SetFreqOffset()). If the chip has not been in RX,
5461 * it returns the nominal radio frequency offset.
5462 *
5463 * @note Changing to any non-idle radio state after reception can cause this
5464 * value to be overwritten so it is safest to capture during packet reception.
5465 */
5466 RAIL_FrequencyOffset_t RAIL_GetRxFreqOffset(RAIL_Handle_t railHandle);
5467
5468 /**
5469 * Set the nominal radio frequency offset.
5470 *
5471 * @param[in] railHandle A RAIL instance handle.
5472 * @param[in] freqOffset \ref RAIL_FrequencyOffset_t parameter (signed, 2's
5473 * complement).
5474 * @return Status code indicating success of the function call.
5475 *
5476 * This function is used to adjust the radio's tuning frequency slightly up or down.
5477 * It might be used in conjunction with \ref RAIL_GetRxFreqOffset() after
5478 * receiving a packet from a peer to adjust the tuner to better match the
5479 * peer's tuned frequency.
5480 *
5481 * @note Unlike \ref RAIL_SetTune(), which affects the entire chip's
5482 * timing including radio tuning and channel spacing, this function
5483 * only affects radio tuning without disturbing channel spacing or
5484 * other chip peripheral timing.
5485 */
5486 RAIL_Status_t RAIL_SetFreqOffset(RAIL_Handle_t railHandle,
5487 RAIL_FrequencyOffset_t freqOffset);
5488
5489 /**
5490 * Start transmitting a stream on a certain channel.
5491 *
5492 * @param[in] railHandle A RAIL instance handle.
5493 * @param[in] channel A channel on which to emit a stream.
5494 * @param[in] mode Choose the stream mode (PN9, and so on).
5495 * @return Status code indicating success of the function call.
5496 *
5497 * Begins streaming onto the given channel. The sources can either be an
5498 * unmodulated carrier wave or an encoded stream of bits from a PN9 source.
5499 * All ongoing radio operations will be stopped before transmission begins.
5500 */
5501 RAIL_Status_t RAIL_StartTxStream(RAIL_Handle_t railHandle,
5502 uint16_t channel,
5503 RAIL_StreamMode_t mode);
5504
5505 /**
5506 * Start transmitting a stream on a certain channel with the ability to select
5507 * an antenna.
5508 *
5509 * @param[in] railHandle A RAIL instance handle.
5510 * @param[in] channel A channel on which to emit a stream.
5511 * @param[in] mode Choose the stream mode (PN9, and so on).
5512 * @param[in] options Choose the TX Antenna option.
5513 * Takes only \ref RAIL_TX_OPTION_ANTENNA0, \ref RAIL_TX_OPTION_ANTENNA1,
5514 * \ref RAIL_TX_OPTIONS_DEFAULT or \ref RAIL_TX_OPTIONS_NONE from the
5515 * \ref RAIL_TxOptions_t. If some other value is used then, transmission
5516 * is possible on any antenna.
5517 * @return Status code indicating success of the function call.
5518 *
5519 * Begins streaming onto the given channel. The sources can either be an
5520 * unmodulated carrier wave or an encoded stream of bits from a PN9 source.
5521 * All ongoing radio operations will be stopped before transmission begins.
5522 */
5523 RAIL_Status_t RAIL_StartTxStreamAlt(RAIL_Handle_t railHandle,
5524 uint16_t channel,
5525 RAIL_StreamMode_t mode,
5526 RAIL_TxOptions_t options);
5527
5528 /**
5529 * Stop stream transmission.
5530 *
5531 * @param[in] railHandle A RAIL instance handle.
5532 * @return Status code indicating success of the function call.
5533 *
5534 * Halts the transmission started by RAIL_StartTxStream().
5535 */
5536 RAIL_Status_t RAIL_StopTxStream(RAIL_Handle_t railHandle);
5537
5538 /**
5539 * Stop infinite preamble transmission started and start transmitting the rest
5540 * of the packet.
5541 *
5542 * This function is only useful for radio configurations that specify an
5543 * infinite preamble. Call this API only after \ref RAIL_EVENT_TX_STARTED
5544 * has occurred and the radio is transmitting.
5545 *
5546 * @param[in] railHandle A RAIL instance handle.
5547 * @return Status code indicating success of the function call:
5548 * \ref RAIL_STATUS_NO_ERROR if infinite preamble was stopped;
5549 * \ref RAIL_STATUS_INVALID_CALL if the radio isn't configured for infinite
5550 * preamble;
5551 * \ref RAIL_STATUS_INVALID_STATE if the radio isn't transmitting.
5552 */
5553 RAIL_Status_t RAIL_StopInfinitePreambleTx(RAIL_Handle_t railHandle);
5554
5555 /**
5556 * Configure the verification of radio memory contents.
5557 *
5558 * @param[in] railHandle A RAIL instance handle.
5559 * @param[in,out] configVerify A configuration structure made available to
5560 * RAIL to perform radio state verification. This structure must be
5561 * allocated in application global read-write memory. RAIL may modify
5562 * fields within or referenced by this structure during its operation.
5563 * @param[in] radioConfig A pointer to a radioConfig that is to be used as a
5564 * white list for verifying memory contents.
5565 * @param[in] cb A callback that notifies the application of a mismatch in
5566 * expected vs actual memory contents. A NULL parameter may be passed in
5567 * if a callback is not provided by the application.
5568 * @return \ref RAIL_STATUS_NO_ERROR if setup of the verification feature
5569 * successfully occurred.
5570 * \ref RAIL_STATUS_INVALID_PARAMETER is returned if the provided railHandle
5571 * or configVerify structures are invalid.
5572 */
5573 RAIL_Status_t RAIL_ConfigVerification(RAIL_Handle_t railHandle,
5574 RAIL_VerifyConfig_t *configVerify,
5575 const uint32_t *radioConfig,
5576 RAIL_VerifyCallbackPtr_t cb);
5577
5578 /**
5579 * Verify radio memory contents.
5580 *
5581 * @param[in,out] configVerify A configuration structure made available to
5582 * RAIL to perform radio state verification. This structure must be
5583 * allocated in application global read-write memory. RAIL may modify
5584 * fields within or referenced by this structure during its operation.
5585 * @param[in] durationUs The duration (in microseconds) for how long memory
5586 * verification should occur before returning to the application. A value of
5587 * RAIL_VERIFY_DURATION_MAX indicates that all memory contents should be
5588 * verified before returning to the application.
5589 * @param[in] restart This flag only has meaning if a previous call of this
5590 * function returned \ref RAIL_STATUS_SUSPENDED. By restarting (true), the
5591 * verification process starts over from the beginning, or by resuming
5592 * where verification left off after being suspended (false), verification
5593 * can proceed towards completion.
5594 * @return \ref RAIL_STATUS_NO_ERROR if the contents of all applicable
5595 * memory locations have been verified.
5596 * \ref RAIL_STATUS_SUSPENDED is returned if the provided test duration
5597 * expired but the time was not sufficient to verify all memory contents.
5598 * By calling \ref RAIL_Verify again, further verification will commence.
5599 * \ref RAIL_STATUS_INVALID_PARAMETER is returned if the provided
5600 * verifyConfig structure pointer is not configured for use by the active
5601 * RAIL handle.
5602 * \ref RAIL_STATUS_INVALID_STATE is returned if any of the verified
5603 * memory contents are different from their reference values.
5604 */
5605 RAIL_Status_t RAIL_Verify(RAIL_VerifyConfig_t *configVerify,
5606 uint32_t durationUs,
5607 bool restart);
5608
5609 #ifndef DOXYGEN_SHOULD_SKIP_THIS
5610
5611 /**
5612 * A global pointer to the memory address of the internal RAIL hardware timer
5613 * that drives the RAIL timebase.
5614 *
5615 * @note The corresponding timer tick value is not adjusted for overflow or the
5616 * clock period, and will simply be a register read. The ticks wrap after
5617 * about 17 minutes since it does not use the full 32-bit range.
5618 * For more details, check the documentation for \ref RAIL_TimerTick_t.
5619 */
5620 extern const volatile RAIL_TimerTick_t *RAIL_TimerTick;
5621
5622 /**
5623 * A global pointer to the memory address of the internal RAIL hardware timer
5624 * that captures the latest RX packet reception time. This would not include
5625 * the RX chain delay, so may not be equal to the packet timestamp, passed to
5626 * the application, representing the actual on-air time the packet finished.
5627 *
5628 * @note The corresponding timer tick value is not adjusted for overflow or the
5629 * clock period, and will simply be a register read. The ticks wrap after
5630 * about 17 minutes since it does not use the full 32-bit range.
5631 * For more details, check the documentation for \ref RAIL_TimerTick_t.
5632 */
5633 extern const volatile RAIL_TimerTick_t *RAIL_RxPacketTimestamp;
5634
5635 /**
5636 * Get elapsed time, in microseconds, between two \ref RAIL_TimerTick_t ticks.
5637 *
5638 * @param[in] startTick Tick recorded at the start of the operation.
5639 * @param[in] endTick Tick recorded at the end of the operation.
5640 *
5641 * @return Returns the elapsed time, in microseconds, between two timer ticks.
5642 */
5643 RAIL_Time_t RAIL_TimerTicksToUs(RAIL_TimerTick_t startTick,
5644 RAIL_TimerTick_t endTick);
5645
5646 /**
5647 * Get \ref RAIL_TimerTick_t tick corresponding to the \ref RAIL_Time_t time.
5648 *
5649 * @param[in] microseconds Time in microseconds.
5650 *
5651 * @return Returns the \ref RAIL_TimerTick_t tick corresponding to the
5652 * \ref RAIL_Time_t time.
5653 */
5654 RAIL_TimerTick_t RAIL_UsToTimerTicks(RAIL_Time_t microseconds);
5655
5656 /**
5657 * Enable Radio state change interrupt.
5658 *
5659 * @param[in] railHandle A RAIL instance handle.
5660 * @param[in] enable Enable/disable Radio state change interrupt.
5661 * @return Status code indicating success of the function call. Returns
5662 * \ref RAIL_STATUS_NO_ERROR once the interrupt has been enabled or disabled.
5663 *
5664 * @note If enabled, state change events are reported through the separate
5665 * RAILCb_RadioStateChanged() callback.
5666 */
5667 RAIL_Status_t RAIL_EnableRadioStateChanged(RAIL_Handle_t railHandle,
5668 bool enable);
5669
5670 /**
5671 * Get the current radio state.
5672 *
5673 * @param[in] railHandle A RAIL instance handle.
5674 * @return An enumeration, \ref RAIL_RadioStateEfr32_t, for the current radio
5675 * state.
5676 *
5677 */
5678 RAIL_RadioStateEfr32_t RAIL_GetRadioStateAlt(RAIL_Handle_t railHandle);
5679
5680 #endif//DOXYGEN_SHOULD_SKIP_THIS
5681
5682 /** @} */ // end of group Diagnostic
5683
5684 /******************************************************************************
5685 * Energy Friendly Front End Module (EFF)
5686 *****************************************************************************/
5687 /**
5688 * @addtogroup EFF Energy Friendly Front End Module (EFF)
5689 * @brief APIs for configuring and controlling an attached Energy Friendly Front
5690 * End Module (EFF).
5691 *
5692 * The EFF is a high-performance, transmit/receive (T/R) front end module (FEM)
5693 * for sub-GHz EFR32 devices. RAIL includes built-in functionality to transmit
5694 * and receive via an attached EFF. This functionality optimizes RF performance
5695 * while ensuring that the EFF stays within safe operating temperature limits.
5696 *
5697 * Configuration and control of the EFF is performed by the \ref rail_util_eff.
5698 *
5699 * @note The EFF is only supported with EFR32XG25 devices.
5700 * @{
5701 */
5702
5703 /** Minimum power for CLPC usage in deci-dBm. Below this power CLPC will not activate.
5704 * Recommend staying above 19 dBm for best performance. Signed unit, do not add U. */
5705 #define RAIL_CLPC_MINIMUM_POWER 180
5706
5707 /**
5708 * Configure the attached EFF device.
5709 *
5710 * @param[in] genericRailHandle A generic RAIL instance handle.
5711 * @param[in] config A pointer to a \ref RAIL_EffConfig_t struct that contains
5712 * configuration data for the EFF.
5713 * @return Status code indicating success of the function call.
5714 */
5715
5716 RAIL_Status_t RAIL_ConfigEff(RAIL_Handle_t genericRailHandle,
5717 const RAIL_EffConfig_t *config);
5718
5719 /** Number of temperature values provided for the EFF thermal protection */
5720 #define RAIL_EFF_TEMP_MEASURE_COUNT (6U)
5721 /** Number of deprecated temperature values in EFF thermal protection */
5722 #define RAIL_EFF_TEMP_MEASURE_DEPRECATED_COUNT (2U)
5723 /** Number of temperature values provided for HFXO metrics */
5724 #define RAIL_HFXO_TEMP_MEASURE_COUNT (1U)
5725
5726 /** Total number of temperature values provided by \ref RAIL_GetTemperature(). */
5727 #define RAIL_TEMP_MEASURE_COUNT (RAIL_CHIP_TEMP_MEASURE_COUNT \
5728 + RAIL_EFF_TEMP_MEASURE_COUNT \
5729 + RAIL_EFF_TEMP_MEASURE_DEPRECATED_COUNT \
5730 + RAIL_HFXO_TEMP_MEASURE_COUNT)
5731
5732 /**
5733 * Get the different temperature measurements in Kelvin done by sequencer or host.
5734 * Values that are not populated yet or incorrect are set to 0.
5735 *
5736 * Temperatures, in Kelvin, are stored in tempBuffer such as:
5737 * tempBuffer[0] is the chip temperature
5738 * tempBuffer[1] is the minimal chip temperature
5739 * tempBuffer[2] is the maximal chip temperature
5740 *
5741 * If \ref RAIL_SUPPORTS_EFF is defined
5742 * tempBuffer[3] is the EFF temperature before Tx
5743 * tempBuffer[4] is the EFF temperature after Tx
5744 * tempBuffer[5] is the minimal EFF temperature value before Tx
5745 * tempBuffer[6] is the minimal EFF temperature value after Tx
5746 * tempBuffer[7] is the maximal EFF temperature value before Tx
5747 * tempBuffer[8] is the maximal EFF temperature value after Tx
5748 * tempBuffer[9] is not used
5749 * tempBuffer[10] is not used
5750 *
5751 * If \ref RAIL_SUPPORTS_HFXO_COMPENSATION
5752 * tempBuffer[11] is the HFXO temperature
5753 *
5754 * @param[in] railHandle A RAIL instance handle.
5755 * @param[out] tempBuffer The address of the array that will contain temperatures.
5756 * tempBuffer array must be at least \ref RAIL_TEMP_MEASURE_COUNT int16_t.
5757 * @param[in] reset Reset min, max and average temperature values.
5758 * @return Status code indicating success of the function call.
5759 */
5760 RAIL_Status_t RAIL_GetTemperature(RAIL_Handle_t railHandle,
5761 int16_t tempBuffer[RAIL_TEMP_MEASURE_COUNT],
5762 bool reset);
5763
5764 /** Number of bytes provided by \ref RAIL_GetSetEffControl(). */
5765 #define RAIL_EFF_CONTROL_SIZE (52U)
5766
5767 /**
5768 * Get the different EFF Control measurements.
5769 *
5770 * @param[in] railHandle A RAIL instance handle.
5771 * @param[out] tempBuffer The address of the target array.
5772 * tempBuffer array must be at least \ref RAIL_EFF_CONTROL_SIZE bytes.
5773 * @param[in] reset Reset the EFF Control measurements.
5774 * @return Status code indicating success of the function call.
5775 */
5776 RAIL_Status_t RAIL_GetSetEffControl(RAIL_Handle_t railHandle,
5777 uint16_t tempBuffer[RAIL_EFF_CONTROL_SIZE / sizeof(uint16_t)],
5778 bool reset);
5779
5780 /**
5781 * Copy the current FEM_DATA pin values into newMode. If changeMode is true,
5782 * update FEM_DATA pin values with newMode first.
5783 *
5784 * @param[in] railHandle A RAIL instance handle
5785 * @param[in,out] newMode A pointer to a uint8_t that will contain the FEM_DATA pin values
5786 * @param[in] changeMode If true, use newMode to update FEM_DATA pin values
5787 * @return Status code indicating success of the function call.
5788 */
5789 RAIL_Status_t RAIL_GetSetEffMode(RAIL_Handle_t railHandle,
5790 uint8_t *newMode,
5791 bool changeMode);
5792
5793 /**
5794 * Copy the current Rural to Urban trip voltage into newTrip. If changeTrip is true,
5795 * update current Rural to Urban trip voltage with newTrip first.
5796 *
5797 * @param[in] railHandle A RAIL instance handle
5798 * @param[in,out] newTrip A pointer to a uint16_t that will contain the Rural to Urban trip voltage, in millivolts
5799 * @param[in] changeTrip If true, use newTrip to update current Rural to Urban trip voltage
5800 * @return Status code indicating success of the function call.
5801 */
5802 RAIL_Status_t RAIL_GetSetEffRuralUrbanMv(RAIL_Handle_t railHandle,
5803 uint16_t *newTrip,
5804 bool changeTrip);
5805
5806 /**
5807 * Copy the current Urban to Bypass trip voltage into newTrip. If changeTrip is true,
5808 * update current Urban to Bypass trip voltage with newTrip first.
5809 *
5810 * @param[in] railHandle A RAIL instance handle
5811 * @param[in,out] newTrip A pointer to a uint16_t that will contain the Urban to Bypass trip voltage, in millivolts
5812 * @param[in] changeTrip If true, use newTrip to update current Urban to Bypass trip voltage
5813 * @return Status code indicating success of the function call.
5814 */
5815 RAIL_Status_t RAIL_GetSetEffUrbanBypassMv(RAIL_Handle_t railHandle,
5816 uint16_t *newTrip,
5817 bool changeTrip);
5818
5819 /**
5820 * Copy the current Urban dwell time into newDwellTime. If changeDwellTime is true,
5821 * update current Urban dwell time with newDwellTime first.
5822 *
5823 * @param[in] railHandle A RAIL instance handle
5824 * @param[in,out] newDwellTime A pointer to a uint16_t that will contain the Urban dwell
5825 * dwell time, in milliseconds
5826 * @param[in] changeDwellTime If true, use newDwellTime to update current Urban dwell time
5827 * @return Status code indicating success of the function call.
5828 */
5829 RAIL_Status_t RAIL_GetSetEffUrbanDwellTimeMs(RAIL_Handle_t railHandle,
5830 uint32_t *newDwellTime,
5831 bool changeDwellTime);
5832
5833 /**
5834 * Copy the current Bypass dwell time into newDwellTime. If changeDwellTime is true,
5835 * update current Bypass dwell time with newDwellTime first.
5836 *
5837 * @param[in] railHandle A RAIL instance handle
5838 * @param[in,out] newDwellTime A pointer to a uint16_t that will contain the Bypass dwell
5839 * dwell time, in milliseconds
5840 * @param[in] changeDwellTime If true, use newDwellTime to update current Bypass dwell time
5841 * @return Status code indicating success of the function call.
5842 */
5843 RAIL_Status_t RAIL_GetSetEffBypassDwellTimeMs(RAIL_Handle_t railHandle,
5844 uint32_t *newDwellTime,
5845 bool changeDwellTime);
5846
5847 /**
5848 * If changeValues is true, update current CLPC Fast Loop calibration
5849 * values using the new variables. If false, copy the current CLPC
5850 * Fast Loop calibration values into new variables.
5851 *
5852 * @param[in] railHandle A RAIL instance handle
5853 * @param[in] modeSensorIndex The mode sensor to use for this operation.
5854 * @param[in,out] calibrationEntry The calibration entry to retrieve or update
5855 * @param[in] changeValues If true, use new values to update the CLPC fast loop calibration
5856 * @return Status code indicating success of the function call.
5857 */
5858 RAIL_Status_t RAIL_GetSetClpcFastLoopCal(RAIL_Handle_t railHandle,
5859 RAIL_EffModeSensor_t modeSensorIndex,
5860 RAIL_EffCalConfig_t *calibrationEntry,
5861 bool changeValues);
5862
5863 /**
5864 * If changeValues is true, update current CLPC Fast Loop calibration
5865 * equations using the new variables. If false, copy the current CLPC
5866 * Fast Loop calibration equations into new variables.
5867 *
5868 * @param[in] railHandle A RAIL instance handle
5869 * @param[in] modeSensorIndex The mode sensor to use for this operation.
5870 * @param[in,out] newSlope1e1MvPerDdbm A pointer to a uint16_t that will contain the CLPC Cal slope, in mV/ddBm * 10
5871 * @param[in,out] newoffset290Ddbm A pointer to a uint16_t that will contain the CLPC Cal offset from 29 dB
5872 * @param[in] changeValues If true, use new values to update the CLPC fast loop calibration equations
5873 * @return Status code indicating success of the function call.
5874 */
5875 RAIL_Status_t RAIL_GetSetClpcFastLoopCalSlp(RAIL_Handle_t railHandle,
5876 RAIL_EffModeSensor_t modeSensorIndex,
5877 int16_t *newSlope1e1MvPerDdbm,
5878 int16_t *newoffset290Ddbm,
5879 bool changeValues);
5880
5881 /**
5882 * If changeValues is true, update current CLPC Fast Loop Target and
5883 * Slope. If false, copy the current CLPC Fast Loop values into
5884 * newTarget and newSlope.
5885 *
5886 * @param[in] railHandle A RAIL instance handle
5887 * @param[in] modeSensorIndex The mode sensor to use for this operation.
5888 * @param[in,out] newTargetMv A pointer to a uint16_t that will contain the CLPC Fast Loop Target in mV
5889 * @param[in,out] newSlopeMvPerPaLevel A pointer to a uint16_t that will contain the CLPC Fast Loop Slope in mV/(PA power level)
5890 * @param[in] changeValues If true, use newTargetMv and newSlopeMvPerPaLevel to update the CLPC Fast Loop values
5891 * @return Status code indicating success of the function call.
5892 */
5893 RAIL_Status_t RAIL_GetSetClpcFastLoop(RAIL_Handle_t railHandle,
5894 RAIL_EffModeSensor_t modeSensorIndex,
5895 uint16_t *newTargetMv,
5896 uint16_t *newSlopeMvPerPaLevel,
5897 bool changeValues);
5898
5899 /**
5900 * Copy the current CLPC Enable in to newClpcEnable. If changeClpcEnable is true,
5901 * update current CLPC Enable with newClpcEnable first.
5902 *
5903 * @param[in] railHandle A RAIL instance handle
5904 * @param[in,out] newClpcEnable A pointer to a uint8_t that will contain the CLPC Enable
5905 * @param[in] changeClpcEnable If true, use newClpcEnable to update the current CLPC Enable
5906 * @return Status code indicating success of the function call.
5907 */
5908 RAIL_Status_t RAIL_GetSetClpcEnable(RAIL_Handle_t railHandle,
5909 uint8_t *newClpcEnable,
5910 bool changeClpcEnable);
5911
5912 #ifndef DOXYGEN_SHOULD_SKIP_THIS
5913 /**
5914 * Get or set the EFF CLPC control flags for internal developer control.
5915 * This interface may change at any time.
5916 *
5917 * @param[in] railHandle A RAIL instance handle
5918 * @param[in] flags Pointer to the location of a single uint8_t containing flag values
5919 * @param[in] change If true, use flags to update current EFF CLPC flags
5920 * @return RAIL_Status_t indicating success or failure of the function
5921 */
5922 RAIL_Status_t RAIL_GetSetEffClpcFlags(RAIL_Handle_t railHandle,
5923 uint8_t *flags,
5924 bool change);
5925 #endif
5926
5927 /**
5928 * Get and set the EFF temperature threshold.
5929 *
5930 * The EFR32 device periodically takes temperature measurements of the attached
5931 * EFF device. If the EFF temperature ever exceeds the EFF temperature
5932 * threshold, any active transmit operation is aborted and future transmit
5933 * operations are blocked until the EFF temperature falls below the threshold.
5934 *
5935 * @param[in] railHandle A RAIL instance handle.
5936 * @param[in,out] newThresholdK A pointer to a uint16_t that will contain the
5937 * current EFF temperature threshold, in Kelvin.
5938 * @param[in] changeThreshold If true, use newThresholdK to update
5939 * current EFF temperature threshold.
5940 * @return Status code indicating the result of the function call.
5941 */
5942 RAIL_Status_t RAIL_GetSetEffTempThreshold(RAIL_Handle_t railHandle,
5943 uint16_t *newThresholdK,
5944 bool changeThreshold);
5945
5946 /** @} */ // end of group EFF
5947
5948 /******************************************************************************
5949 * Thermal Protection
5950 *****************************************************************************/
5951 /**
5952 * @addtogroup Thermal_Protection Thermal Protection
5953 * @{
5954 */
5955
5956 /**
5957 * Enable or disable the thermal protection if \ref RAIL_SUPPORTS_THERMAL_PROTECTION
5958 * is defined and update the temperature threshold and cool down hysteresis preventing or
5959 * allowing transmissions.
5960 *
5961 * When the temperature threshold minus a precise number of degrees
5962 * specified by the cool down hysteresis parameter is exceeded,
5963 * any future transmits are blocked until the temperature decreases below that limit.
5964 * Besides, if the temperature threshold is exceeded, any active transmit is aborted.
5965 *
5966 * By default the threshold is set to \ref RAIL_CHIP_TEMP_THRESHOLD_MAX and
5967 * the cool down hysteresis is set to \ref RAIL_CHIP_TEMP_COOLDOWN_DEFAULT.
5968 *
5969 * @param[in] genericRailHandle A generic RAIL instance handle.
5970 * @param[in] chipTempConfig A pointer to the struct \ref RAIL_ChipTempConfig_t that contains
5971 * the configuration to be applied.
5972 * @return Status code indicating the result of the function call.
5973 * Returns RAIL_STATUS_INVALID_PARAMETER if enable field from \ref RAIL_ChipTempConfig_t
5974 * is set to false when an EFF is present on the board.
5975 *
5976 * @note The thermal protection is automatically enabled when an EFF is present
5977 * on the board. There is no use in calling this API in this case.
5978 */
5979 RAIL_Status_t RAIL_ConfigThermalProtection(RAIL_Handle_t genericRailHandle,
5980 const RAIL_ChipTempConfig_t *chipTempConfig);
5981
5982 /**
5983 * Get the current thermal configuration parameter and status.
5984 *
5985 * @param[in] genericRailHandle A generic RAIL instance handle.
5986 * @param[in,out] chipTempConfig A pointer to the struct \ref RAIL_ChipTempConfig_t that will contain
5987 * the current configuration.
5988 * @return Status code indicating the result of the function call.
5989 */
5990 RAIL_Status_t RAIL_GetThermalProtection(RAIL_Handle_t genericRailHandle,
5991 RAIL_ChipTempConfig_t *chipTempConfig);
5992
5993 /** @} */ // end of group Thermal_Protection
5994
5995 #ifndef DOXYGEN_SHOULD_SKIP_THIS
5996
5997 /******************************************************************************
5998 * Debug
5999 *****************************************************************************/
6000 /**
6001 * @addtogroup Debug
6002 * @brief APIs for debugging
6003 * @{
6004 */
6005
6006 /**
6007 * Configure the debug mode for the radio library. Do not use this function
6008 * unless instructed by Silicon Labs.
6009 * @param[in] railHandle A RAIL instance handle.
6010 * @param[in] debugMode Debug mode to enter.
6011 * @return Status code indicating success of the function call.
6012 */
6013 RAIL_Status_t RAIL_SetDebugMode(RAIL_Handle_t railHandle, uint32_t debugMode);
6014
6015 /**
6016 * Return the debug mode for the radio library. Do not use this function
6017 * unless instructed by Silicon Labs.
6018 * @param[in] railHandle A RAIL instance handle.
6019 * @return Debug mode for the radio library.
6020 */
6021 uint32_t RAIL_GetDebugMode(RAIL_Handle_t railHandle);
6022
6023 /**
6024 * Override the radio base frequency.
6025 *
6026 * @param[in] railHandle A RAIL instance handle.
6027 * @param[in] freq A desired frequency in Hz.
6028 * @return Status code indicating success of the function call.
6029 *
6030 * Sets the radio to transmit at the frequency given. This function can only
6031 * be used while in \ref RAIL_DEBUG_MODE_FREQ_OVERRIDE. The given frequency
6032 * needs to be close to the base frequency of the current PHY. After this
6033 * call, a full reset is needed to restore normal RAIL operation.
6034 */
6035 RAIL_Status_t RAIL_OverrideDebugFrequency(RAIL_Handle_t railHandle,
6036 uint32_t freq);
6037
6038 /**
6039 * Get the size of the radio's multiprotocol scheduler state buffer.
6040 *
6041 * @param[in] genericRailHandle A generic RAIL instance handle.
6042 * @return Size, in bytes, of the radio's internal scheduler state buffer.
6043 * Zero is returned if the handle is invalid or this is the singleprotocol
6044 * library.
6045 */
6046 uint32_t RAIL_GetSchedBufferSize(RAIL_Handle_t genericRailHandle);
6047
6048 /** @} */ // end of group Debug
6049
6050 #endif//DOXYGEN_SHOULD_SKIP_THIS
6051
6052 /******************************************************************************
6053 * Assertion Callback
6054 *****************************************************************************/
6055 /**
6056 * @addtogroup Assertions
6057 * @brief Callbacks called by assertions
6058 *
6059 * The assertion framework was implemented to not only
6060 * assert that certain conditions are true in a block of code, but also
6061 * to handle them more appropriately. In previous implementations,
6062 * the behavior upon a failed assert was to hang in a while(1) loop.
6063 * However, with the callback, each assert is given a unique error code so that
6064 * they can be handled on a more case-by-case basis. For documentation on each
6065 * of the errors, see the rail_assert_error_codes.h file.
6066 * RAIL_ASSERT_ERROR_MESSAGES[errorCode] gives the explanation of the error.
6067 * With asserts built into the library, users can choose how to handle each
6068 * error inside the callback.
6069 *
6070 * @{
6071 */
6072
6073 /**
6074 * Callback called upon failed assertion.
6075 *
6076 * @param[in] railHandle A RAIL instance handle.
6077 * @param[in] errorCode Value passed in by the calling assertion API indicating
6078 * the RAIL error that is indicated by the failing assertion.
6079 */
6080 void RAILCb_AssertFailed(RAIL_Handle_t railHandle,
6081 RAIL_AssertErrorCodes_t errorCode);
6082
6083 /** @} */ // end of group Assertions
6084
6085 /******************************************************************************
6086 * External_Thermistor
6087 *****************************************************************************/
6088 /**
6089 * @addtogroup External_Thermistor External Thermistor
6090 * @brief APIs to measure temperature using an external thermistor
6091 *
6092 * This feature allows reading the temperature via an external thermistor on
6093 * chips that support it. This will require connecting the necessary components
6094 * and configuring the pins as required.
6095 *
6096 * @{
6097 */
6098
6099 /**
6100 * Start a Thermistor measurement. To get the Thermistor impedance, call the
6101 * function \ref RAIL_GetThermistorImpedance. On platforms having
6102 * \ref RAIL_SUPPORTS_EXTERNAL_THERMISTOR, this function reconfigures
6103 * GPIO_THMSW_EN_PIN located in GPIO_THMSW_EN_PORT.
6104 * To locate this pin, refer to the data sheet or appropriate header files
6105 * of the device. For proper operation, \ref RAIL_Init must be called before
6106 * using this function.
6107 *
6108 * @note This function is not designed for safe usage in multiprotocol
6109 * applications.
6110 * @note When an EFF is attached, this function must not be called during
6111 * transmit.
6112 *
6113 * @param[in] railHandle A RAIL instance handle.
6114 * @return Status code indicating success of the function call.
6115 * Returns RAIL_STATUS_INVALID_STATE if the thermistor is started while the
6116 * radio is transmitting.
6117 */
6118 RAIL_Status_t RAIL_StartThermistorMeasurement(RAIL_Handle_t railHandle);
6119
6120 /**
6121 * Get the thermistor impedance measurement and returns \ref
6122 * RAIL_INVALID_THERMISTOR_VALUE if the thermistor is not properly
6123 * configured or the thermistor measurement is not ready.
6124 *
6125 * @param[in] railHandle A RAIL instance handle.
6126 * @param[out] thermistorImpedance Current thermistor impedance measurement in
6127 * Ohms.
6128 * @return Status code indicating success of the function call.
6129 *
6130 * @note This function is already called in \ref RAIL_CalibrateHFXO().
6131 * It does not need to be manually called during the compensation sequence.
6132 */
6133 RAIL_Status_t RAIL_GetThermistorImpedance(RAIL_Handle_t railHandle,
6134 uint32_t *thermistorImpedance);
6135
6136 /**
6137 * Convert the thermistor impedance into temperature, in Celsius.
6138 *
6139 * @param[in] railHandle A RAIL instance handle.
6140 * @param[in] thermistorImpedance Current thermistor impedance measurement in
6141 * Ohms.
6142 * @param[out] thermistorTemperatureC Pointer to current thermistor temperature
6143 * in eighth of Celsius degree
6144 * @return Status code indicating success of the function call.
6145 *
6146 * This function is provided in the rail_util_thermistor plugin to get
6147 * accurate values from our boards thermistors. For a custom board, this
6148 * function could be modified and re-implemented for other needs.
6149 * The variable railHandle is only used to indicate to the user from where the
6150 * function was called, so it is okay to use either a real protocol handle,
6151 * or one of the chip-specific ones, such as \ref RAIL_EFR32_HANDLE.
6152 *
6153 * @note This plugin is mandatory on EFR32xG25 platform.
6154 */
6155 RAIL_Status_t RAIL_ConvertThermistorImpedance(RAIL_Handle_t railHandle,
6156 uint32_t thermistorImpedance,
6157 int16_t *thermistorTemperatureC);
6158
6159 /**
6160 * Compute the crystal PPM deviation from the thermistor temperature.
6161 *
6162 * @param[in] railHandle A RAIL instance handle.
6163 * @param[in] crystalTemperatureC Current crystal temperature.
6164 * @param[out] crystalPPMError Pointer to current ppm error.
6165 * @return Status code indicating success of the function call.
6166 *
6167 * This function is provided in the rail_util_thermistor plugin to get
6168 * accurate values from our boards thermistor. For a custom board, this
6169 * function could be modified and re-implemented for other needs.
6170 * The variable railHandle is only used to indicate to the user from where the
6171 * function was called, so it is okay to use either a real protocol handle,
6172 * or one of the chip-specific ones, such as \ref RAIL_EFR32_HANDLE.
6173 *
6174 * @note This plugin is mandatory on EFR32xG25 platform.
6175 */
6176 RAIL_Status_t RAIL_ComputeHFXOPPMError(RAIL_Handle_t railHandle,
6177 int16_t crystalTemperatureC,
6178 int8_t *crystalPPMError);
6179
6180 /**
6181 * Configure the GPIO for thermistor usage.
6182 *
6183 * @param railHandle A RAIL instance handle.
6184 * @param[in] pHfxoThermistorConfig The thermistor configuration pointing to
6185 * the GPIO port and pin to access.
6186 * @return Status code indicating the result of the function call.
6187 *
6188 * @note The port and pin that must be passed in \ref RAIL_HFXOThermistorConfig_t
6189 * are GPIO_THMSW_EN_PORT and GPIO_THMSW_EN_PIN respectively.
6190 */
6191 RAIL_Status_t RAIL_ConfigHFXOThermistor(RAIL_Handle_t railHandle,
6192 const RAIL_HFXOThermistorConfig_t *pHfxoThermistorConfig);
6193
6194 /**
6195 * Configure the temperature parameters for HFXO compensation.
6196 *
6197 * @param railHandle A RAIL instance handle.
6198 * @param[in] pHfxoCompensationConfig HFXO compensation parameters pointing to the
6199 * temperature variations used to trigger a compensation.
6200 * @return Status code indicating the result of the function call.
6201 *
6202 * @note This function must be called after \ref RAIL_ConfigHFXOThermistor to succeed.
6203 *
6204 * In \ref RAIL_HFXOCompensationConfig_t, deltaNominal and deltaCritical define
6205 * the temperature variation triggering a new compensation.
6206 * The field zoneTemperatureC defines the temperature separating
6207 * the nominal case (below) from the critical one (above).
6208 *
6209 * When enabled and either deltaNominal or deltaCritical are exceeded, RAIL raises
6210 * event \ref RAIL_EVENT_CAL_NEEDED with \ref RAIL_CAL_TEMP_HFXO bit set.
6211 * The API \ref RAIL_StartThermistorMeasurement() must be called afterwards.
6212 * The latter will raise RAIL_EVENT_THERMISTOR_DONE with calibration bit
6213 * \ref RAIL_CAL_COMPENSATE_HFXO set and RAIL_CalibrateHFXO() must follow.
6214 *
6215 * @note Set deltaNominal and deltaCritical to 0 to perform compensation after
6216 * each transmit.
6217 */
6218 RAIL_Status_t RAIL_ConfigHFXOCompensation(RAIL_Handle_t railHandle,
6219 const RAIL_HFXOCompensationConfig_t *pHfxoCompensationConfig);
6220
6221 /**
6222 * Get the temperature parameters for HFXO compensation.
6223 *
6224 * @param railHandle A RAIL instance handle.
6225 * @param pHfxoCompensationConfig HFXO compensation parameters pointing to the
6226 * temperature variations used to trigger a compensation.
6227 * @return Status code indicating the result of the function call.
6228 */
6229 RAIL_Status_t RAIL_GetHFXOCompensationConfig(RAIL_Handle_t railHandle,
6230 RAIL_HFXOCompensationConfig_t *pHfxoCompensationConfig);
6231
6232 /**
6233 * Compute a frequency offset and compensate HFXO accordingly.
6234 *
6235 * @param railHandle A RAIL instance handle.
6236 * @param crystalPPMError The current ppm error. Positive values indicate the HFXO
6237 * frequency is too high; negative values indicate it's too low.
6238 * @return Status code indicating success of the function call.
6239 *
6240 * @note This function only works for platforms having
6241 * \ref RAIL_SUPPORTS_EXTERNAL_THERMISTOR alongside \ref RAIL_SUPPORTS_HFXO_COMPENSATION.
6242 */
6243 RAIL_Status_t RAIL_CompensateHFXO(RAIL_Handle_t railHandle, int8_t crystalPPMError);
6244 /** @} */ // end of group External_Thermistor
6245
6246 /**
6247 * @addtogroup Features
6248 * @{
6249 */
6250
6251 /**
6252 * Indicate whether RAIL supports 2.4 GHz band operation on this chip.
6253 *
6254 * @param[in] railHandle A RAIL instance handle.
6255 * @return true if the 2.4 GHz band is supported; false otherwise.
6256 *
6257 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_2P4GHZ_BAND.
6258 */
6259 bool RAIL_Supports2p4GHzBand(RAIL_Handle_t railHandle);
6260
6261 /**
6262 * Indicate whether RAIL supports SubGHz band operation on this chip.
6263 *
6264 * @param[in] railHandle A RAIL instance handle.
6265 * @return true if the SubGHz band is supported; false otherwise.
6266 *
6267 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_SUBGHZ_BAND.
6268 */
6269 bool RAIL_SupportsSubGHzBand(RAIL_Handle_t railHandle);
6270
6271 /**
6272 * Indicate whether this chip supports dual 2.4 GHz and SubGHz band operation.
6273 *
6274 * @param[in] railHandle A RAIL instance handle.
6275 * @return true if the dual band is supported; false otherwise.
6276 *
6277 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_DUAL_BAND.
6278 */
6279 bool RAIL_SupportsDualBand(RAIL_Handle_t railHandle);
6280
6281 /**
6282 * Indicate whether this chip supports bit masked address filtering
6283 *
6284 * @param[in] railHandle A RAIL instance handle.
6285 * @return true if bit masked address filtering is supported; false otherwise.
6286 *
6287 * Runtime refinement of compile-time
6288 * \ref RAIL_SUPPORTS_ADDR_FILTER_ADDRESS_BIT_MASK.
6289 */
6290 bool RAIL_SupportsAddrFilterAddressBitMask(RAIL_Handle_t railHandle);
6291
6292 /**
6293 * Indicate whether this chip supports address filter mask information
6294 * for incoming packets in
6295 * \ref RAIL_RxPacketInfo_t::filterMask and
6296 * \ref RAIL_IEEE802154_Address_t::filterMask.
6297 *
6298 * @param[in] railHandle A RAIL instance handle.
6299 * @return true if address filter information is supported; false otherwise
6300 * (in which case \ref RAIL_RxPacketInfo_t::filterMask value is undefined).
6301 *
6302 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_ADDR_FILTER_MASK.
6303 */
6304 bool RAIL_SupportsAddrFilterMask(RAIL_Handle_t railHandle);
6305
6306 /**
6307 * Indicate whether this chip supports alternate TX power settings.
6308 *
6309 * @param[in] railHandle A RAIL instance handle.
6310 * @return true if alternate TX power settings are supported; false otherwise.
6311 *
6312 * Runtime refinement of compile-time \ref
6313 * RAIL_SUPPORTS_ALTERNATE_TX_POWER.
6314 */
6315 bool RAIL_SupportsAlternateTxPower(RAIL_Handle_t railHandle);
6316
6317 /**
6318 * Indicate whether this chip supports antenna diversity.
6319 *
6320 * @param[in] railHandle A RAIL instance handle.
6321 * @return true if antenna diversity is supported; false otherwise.
6322 *
6323 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_ANTENNA_DIVERSITY.
6324 *
6325 * @note Certain radio configurations may not support this feature even
6326 * if the chip in general claims to support it.
6327 */
6328 bool RAIL_SupportsAntennaDiversity(RAIL_Handle_t railHandle);
6329
6330 /**
6331 * Indicate whether RAIL supports AUXADC measurements on this chip.
6332 *
6333 * @param[in] railHandle A RAIL instance handle.
6334 * @return true if AUXADC measurements are supported; false otherwise.
6335 *
6336 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_AUXADC.
6337 */
6338 bool RAIL_SupportsAuxAdc(RAIL_Handle_t railHandle);
6339
6340 /**
6341 * Indicate whether RAIL supports channel hopping on this chip.
6342 *
6343 * @param[in] railHandle A RAIL instance handle.
6344 * @return true if channel hopping is supported; false otherwise.
6345 *
6346 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_CHANNEL_HOPPING.
6347 */
6348 bool RAIL_SupportsChannelHopping(RAIL_Handle_t railHandle);
6349
6350 /**
6351 * Indicate whether this chip supports direct mode.
6352 *
6353 * @param[in] railHandle A RAIL instance handle.
6354 * @return true if direct mode is supported; false otherwise.
6355 *
6356 * Runtime refinement of compile-time \ref
6357 * RAIL_SUPPORTS_DIRECT_MODE.
6358 */
6359 bool RAIL_SupportsDirectMode(RAIL_Handle_t railHandle);
6360
6361 /**
6362 * Indicate whether this chip supports dual sync words.
6363 *
6364 * @param[in] railHandle A RAIL instance handle.
6365 * @return true if dual sync words are supported; false otherwise.
6366 *
6367 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_DUAL_SYNC_WORDS.
6368 *
6369 * @note Certain radio configurations may not support this feature even
6370 * if the chip in general claims to support it.
6371 */
6372 bool RAIL_SupportsDualSyncWords(RAIL_Handle_t railHandle);
6373
6374 /**
6375 * Indicate whether this chip supports EFF.
6376 *
6377 * @param[in] railHandle A RAIL instance handle.
6378 * @return true if EFF identifier is supported; false otherwise.
6379 */
6380 bool RAIL_SupportsEff(RAIL_Handle_t railHandle);
6381
6382 /**
6383 * Indicate whether RAIL supports thermistor measurements on this chip.
6384 *
6385 * @param[in] railHandle A RAIL instance handle.
6386 * @return true if thermistor measurements are supported; false otherwise.
6387 *
6388 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_EXTERNAL_THERMISTOR.
6389 */
6390 bool RAIL_SupportsExternalThermistor(RAIL_Handle_t railHandle);
6391
6392 /**
6393 * Indicate whether RAIL supports HFXO compensation on this chip.
6394 *
6395 * @param[in] railHandle A RAIL instance handle.
6396 * @return true if HFXO compensation is supported and
6397 * \ref RAIL_ConfigHFXOThermistor() has been successfully called;
6398 * false otherwise.
6399 *
6400 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_HFXO_COMPENSATION.
6401 */
6402 bool RAIL_SupportsHFXOCompensation(RAIL_Handle_t railHandle);
6403
6404 /**
6405 * Indicate whether this chip supports MFM protocol.
6406 *
6407 * @param[in] railHandle A RAIL instance handle.
6408 * @return true if MFM protocol is supported; false otherwise.
6409 *
6410 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_MFM.
6411 */
6412 bool RAIL_SupportsMfm(RAIL_Handle_t railHandle);
6413
6414 /**
6415 * Indicate whether RAIL supports OFDM band operation on this chip.
6416 *
6417 * @param[in] railHandle A RAIL instance handle.
6418 * @return true if OFDM operation is supported; false otherwise.
6419 *
6420 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_OFDM_PA.
6421 */
6422 bool RAIL_SupportsOFDMPA(RAIL_Handle_t railHandle);
6423
6424 /**
6425 * Indicate whether this chip supports a high-precision LFRCO.
6426 *
6427 * @param[in] railHandle A RAIL instance handle.
6428 * @return true if high-precision LFRCO is supported; false otherwise.
6429 *
6430 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_PRECISION_LFRCO.
6431 */
6432 bool RAIL_SupportsPrecisionLFRCO(RAIL_Handle_t railHandle);
6433
6434 /**
6435 * Indicate whether this chip supports radio entropy.
6436 *
6437 * @param[in] railHandle A RAIL instance handle.
6438 * @return true if radio entropy is supported; false otherwise.
6439 *
6440 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_RADIO_ENTROPY.
6441 */
6442 bool RAIL_SupportsRadioEntropy(RAIL_Handle_t railHandle);
6443
6444 /**
6445 * Indicate whether RAIL supports RFSENSE Energy Detection Mode on this chip.
6446 *
6447 * @param[in] railHandle A RAIL instance handle.
6448 * @return true if RFSENSE Energy Detection Mode is supported; false otherwise.
6449 *
6450 * Runtime refinement of compile-time
6451 * \ref RAIL_SUPPORTS_RFSENSE_ENERGY_DETECTION.
6452 */
6453 bool RAIL_SupportsRfSenseEnergyDetection(RAIL_Handle_t railHandle);
6454
6455 /**
6456 * Indicate whether RAIL supports RFSENSE Selective(OOK) Mode on this chip.
6457 *
6458 * @param[in] railHandle A RAIL instance handle.
6459 * @return true if RFSENSE Selective(OOK) Mode is supported; false otherwise.
6460 *
6461 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_RFSENSE_SELECTIVE_OOK.
6462 */
6463 bool RAIL_SupportsRfSenseSelectiveOok(RAIL_Handle_t railHandle);
6464
6465 /**
6466 * Indicate whether this chip supports configurable RSSI threshold
6467 * set by \ref RAIL_SetRssiDetectThreshold().
6468 *
6469 * @param[in] railHandle A RAIL instance handle.
6470 * @return true if setting configurable RSSI is supported; false otherwise.
6471 *
6472 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_RSSI_DETECT_THRESHOLD.
6473 */
6474 bool RAIL_SupportsRssiDetectThreshold(RAIL_Handle_t railHandle);
6475
6476 /**
6477 * Indicate whether this chip supports RX direct mode data to FIFO.
6478 *
6479 * @param[in] railHandle A RAIL instance handle.
6480 * @return true if direct mode data to FIFO is supported; false otherwise.
6481 *
6482 * Runtime refinement of compile-time \ref
6483 * RAIL_SUPPORTS_RX_DIRECT_MODE_DATA_TO_FIFO.
6484 */
6485 bool RAIL_SupportsRxDirectModeDataToFifo(RAIL_Handle_t railHandle);
6486
6487 /**
6488 * Indicate whether this chip supports raw RX data
6489 * sources other than \ref RAIL_RxDataSource_t::RX_PACKET_DATA.
6490 *
6491 * @param[in] railHandle A RAIL instance handle.
6492 * @return true if direct mode is supported; false otherwise.
6493 *
6494 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_RX_RAW_DATA.
6495 */
6496 bool RAIL_SupportsRxRawData(RAIL_Handle_t railHandle);
6497
6498 /**
6499 * Indicate whether this chip supports SQ-based PHY.
6500 *
6501 * @param[in] railHandle A RAIL instance handle.
6502 * @return true if the SQ-based PHY is supported; false otherwise.
6503 *
6504 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_SQ_PHY.
6505 */
6506 bool RAIL_SupportsSQPhy(RAIL_Handle_t railHandle);
6507
6508 /**
6509 * Indicate whether this chip supports a particular power mode (PA).
6510 * @note Consider using \ref RAIL_SupportsTxPowerModeAlt to also get the power
6511 * mode's lowest allowed power level.
6512 *
6513 * @param[in] railHandle A RAIL instance handle.
6514 * @param[in] powerMode The power mode to check if supported.
6515 * @param[out] pMaxPowerLevel A pointer to a \ref RAIL_TxPowerLevel_t that
6516 * if non-NULL will be filled in with the power mode's highest power level
6517 * allowed if this function returns true.
6518 * @return true if the powerMode is supported; false otherwise.
6519 *
6520 * This function has no compile-time equivalent.
6521 */
6522 bool RAIL_SupportsTxPowerMode(RAIL_Handle_t railHandle,
6523 RAIL_TxPowerMode_t powerMode,
6524 RAIL_TxPowerLevel_t *pMaxPowerLevel);
6525
6526 /**
6527 * Indicate whether this chip supports a particular power mode (PA) and
6528 * provides the maximum and minimum power level for that power mode
6529 * if supported by the chip.
6530 *
6531 * @param[in] railHandle A RAIL instance handle.
6532 * @param[in,out] powerMode A pointer to PA power mode to check if supported.
6533 * In case of RAIL_TX_POWER_MODE_2P4_HIGHEST or
6534 * RAIL_TX_POWER_MODE_SUBGIG_HIGHEST is used as input
6535 * then the highest selected PA on the chip is updated here.
6536 * @param[out] maxPowerLevel A pointer to a \ref RAIL_TxPowerLevel_t that
6537 * if non-NULL will be filled in with the power mode's highest power level
6538 * allowed if this function returns \ref RAIL_STATUS_NO_ERROR.
6539 * @param[out] minPowerLevel A pointer to a \ref RAIL_TxPowerLevel_t that
6540 * if non-NULL will be filled in with the power mode's lowest power level
6541 * allowed if this function returns \ref RAIL_STATUS_NO_ERROR.
6542 * @return true if powerMode is supported; false otherwise.
6543 */
6544 bool RAIL_SupportsTxPowerModeAlt(RAIL_Handle_t railHandle,
6545 RAIL_TxPowerMode_t *powerMode,
6546 RAIL_TxPowerLevel_t *maxPowerLevel,
6547 RAIL_TxPowerLevel_t *minPowerLevel);
6548
6549 /**
6550 * Indicate whether this chip supports automatic TX to TX transitions.
6551 *
6552 * @param[in] railHandle A RAIL instance handle.
6553 * @return true if TX to TX transitions are supported; false otherwise.
6554 *
6555 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_TX_TO_TX.
6556 */
6557 bool RAIL_SupportsTxToTx(RAIL_Handle_t railHandle);
6558
6559 /**
6560 * Indicate whether RAIL supports the BLE protocol on this chip.
6561 *
6562 * @param[in] railHandle A RAIL instance handle.
6563 * @return true if BLE is supported; false otherwise.
6564 *
6565 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_PROTOCOL_BLE.
6566 */
6567 bool RAIL_SupportsProtocolBLE(RAIL_Handle_t railHandle);
6568
6569 /**
6570 * Indicate whether this chip supports BLE 1Mbps Non-Viterbi PHY.
6571 *
6572 * @param[in] railHandle A RAIL instance handle.
6573 * @return true if BLE 1Mbps Non-Viterbi is supported; false otherwise.
6574 *
6575 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_1MBPS_NON_VITERBI.
6576 */
6577 bool RAIL_BLE_Supports1MbpsNonViterbi(RAIL_Handle_t railHandle);
6578
6579 /**
6580 * Indicate whether this chip supports BLE 1Mbps Viterbi PHY.
6581 *
6582 * @param[in] railHandle A RAIL instance handle.
6583 * @return true if BLE 1Mbps Viterbi is supported; false otherwise.
6584 *
6585 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_1MBPS_VITERBI.
6586 */
6587 bool RAIL_BLE_Supports1MbpsViterbi(RAIL_Handle_t railHandle);
6588
6589 /**
6590 * Indicate whether this chip supports BLE 1Mbps operation.
6591 *
6592 * @param[in] railHandle A RAIL instance handle.
6593 * @return true if BLE 1Mbps operation is supported; false otherwise.
6594 *
6595 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_1MBPS.
6596 */
6597 static inline
RAIL_BLE_Supports1Mbps(RAIL_Handle_t railHandle)6598 bool RAIL_BLE_Supports1Mbps(RAIL_Handle_t railHandle)
6599 {
6600 bool temp = RAIL_BLE_Supports1MbpsViterbi(railHandle); // Required for MISRA compliance
6601 return (RAIL_BLE_Supports1MbpsNonViterbi(railHandle)
6602 || temp);
6603 }
6604
6605 /**
6606 * Indicate whether this chip supports BLE 2Mbps Non-Viterbi PHY.
6607 *
6608 * @param[in] railHandle A RAIL instance handle.
6609 * @return true if BLE 2Mbps Non-Viterbi is supported; false otherwise.
6610 *
6611 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_2MBPS_NON_VITERBI.
6612 */
6613 bool RAIL_BLE_Supports2MbpsNonViterbi(RAIL_Handle_t railHandle);
6614
6615 /**
6616 * Indicate whether this chip supports BLE 2Mbps Viterbi PHY.
6617 *
6618 * @param[in] railHandle A RAIL instance handle.
6619 * @return true if BLE 2Mbps Viterbi is supported; false otherwise.
6620 *
6621 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_2MBPS_VITERBI.
6622 */
6623 bool RAIL_BLE_Supports2MbpsViterbi(RAIL_Handle_t railHandle);
6624
6625 /**
6626 * Indicate whether this chip supports BLE 2Mbps operation.
6627 *
6628 * @param[in] railHandle A RAIL instance handle.
6629 * @return true if BLE 2Mbps operation is supported; false otherwise.
6630 *
6631 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_2MBPS.
6632 */
6633 static inline
RAIL_BLE_Supports2Mbps(RAIL_Handle_t railHandle)6634 bool RAIL_BLE_Supports2Mbps(RAIL_Handle_t railHandle)
6635 {
6636 bool temp = RAIL_BLE_Supports2MbpsViterbi(railHandle); // Required for MISRA compliance
6637 return (RAIL_BLE_Supports2MbpsNonViterbi(railHandle)
6638 || temp);
6639 }
6640
6641 /**
6642 * Indicate whether this chip supports BLE Antenna Switching needed for
6643 * Angle-of-Arrival receives or Angle-of-Departure transmits.
6644 * @param[in] railHandle A RAIL instance handle.
6645 * @return true if BLE Antenna Switching is supported; false otherwise.
6646 *
6647 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_ANTENNA_SWITCHING.
6648 */
6649 bool RAIL_BLE_SupportsAntennaSwitching(RAIL_Handle_t railHandle);
6650
6651 /**
6652 * Indicate whether this chip supports BLE Coded PHY used for Long-Range.
6653 *
6654 * @param[in] railHandle A RAIL instance handle.
6655 * @return true if BLE Coded PHY is supported; false otherwise.
6656 *
6657 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_CODED_PHY.
6658 */
6659 bool RAIL_BLE_SupportsCodedPhy(RAIL_Handle_t railHandle);
6660
6661 /**
6662 * Indicate whether this chip supports BLE CTE (Constant Tone Extension)
6663 * needed for Angle-of-Arrival/Departure transmits.
6664 *
6665 * @param[in] railHandle A RAIL instance handle.
6666 * @return true if BLE CTE is supported; false otherwise.
6667 *
6668 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_CTE.
6669 */
6670 bool RAIL_BLE_SupportsCte(RAIL_Handle_t railHandle);
6671
6672 /**
6673 * Indicate whether this chip supports BLE IQ Sampling needed for
6674 * Angle-of-Arrival/Departure receives.
6675 *
6676 * @param[in] railHandle A RAIL instance handle.
6677 * @return true if BLE IQ Sampling is supported; false otherwise.
6678 *
6679 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_IQ_SAMPLING.
6680 */
6681 bool RAIL_BLE_SupportsIQSampling(RAIL_Handle_t railHandle);
6682
6683 /**
6684 * Indicate whether this chip supports BLE PHY switch to RX
6685 * functionality, which is used to switch BLE PHYs at a specific time
6686 * to receive auxiliary packets.
6687 *
6688 * @param[in] railHandle A RAIL instance handle.
6689 * @return true if BLE PHY switch to RX is supported; false otherwise.
6690 *
6691 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_PHY_SWITCH_TO_RX.
6692 */
6693 bool RAIL_BLE_SupportsPhySwitchToRx(RAIL_Handle_t railHandle);
6694
6695 /**
6696 * Indicate whether this chip supports the Quuppa PHY.
6697 *
6698 * @param[in] railHandle A RAIL instance handle.
6699 * @return true if the Quuppa is supported; false otherwise.
6700 *
6701 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_QUUPPA.
6702 */
6703 bool RAIL_BLE_SupportsQuuppa(RAIL_Handle_t railHandle);
6704
6705 /**
6706 * Indicate whether this chip supports BLE signal identifier.
6707 *
6708 * @param[in] railHandle A RAIL instance handle.
6709 * @return true if signal identifier is supported; false otherwise.
6710 */
6711 bool RAIL_BLE_SupportsSignalIdentifier(RAIL_Handle_t railHandle);
6712
6713 /**
6714 * Indicate whether this chip supports BLE Simulscan PHY used for simultaneous
6715 * BLE 1Mbps and Coded PHY reception.
6716 *
6717 * @param[in] railHandle A RAIL instance handle.
6718 * @return true if BLE Simulscan PHY is supported; false otherwise.
6719 *
6720 * Runtime refinement of compile-time \ref RAIL_BLE_SUPPORTS_SIMULSCAN_PHY.
6721 */
6722 bool RAIL_BLE_SupportsSimulscanPhy(RAIL_Handle_t railHandle);
6723
6724 /**
6725 * Indicate whether this chip supports the IEEE 802.15.4 protocol.
6726 *
6727 * @param[in] railHandle A RAIL instance handle.
6728 * @return true if the 802.15.4 protocol is supported; false otherwise.
6729 *
6730 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_PROTOCOL_IEEE802154.
6731 */
6732 bool RAIL_SupportsProtocolIEEE802154(RAIL_Handle_t railHandle);
6733
6734 /**
6735 * Indicate whether this chip supports the IEEE 802.15.4 Wi-Fi Coexistence PHY.
6736 *
6737 * @param[in] railHandle A RAIL instance handle.
6738 * @return true if the 802.15.4 COEX PHY is supported; false otherwise.
6739 *
6740 * Runtime refinement of compile-time \ref RAIL_IEEE802154_SUPPORTS_COEX_PHY.
6741 */
6742 bool RAIL_IEEE802154_SupportsCoexPhy(RAIL_Handle_t railHandle);
6743
6744 /**
6745 * Indicate whether this chip supports the IEEE 802.15.4 2.4 GHz band variant.
6746 *
6747 * @param[in] railHandle A RAIL instance handle.
6748 * @return true if IEEE 802.15.4 2.4 GHz band variant is supported;
6749 * false otherwise.
6750 *
6751 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_IEEE802154_BAND_2P4.
6752 */
6753 bool RAIL_SupportsIEEE802154Band2P4(RAIL_Handle_t railHandle);
6754
6755 /**
6756 * Indicate whether this chip supports the thermal protection.
6757 *
6758 * @param[in] railHandle A RAIL instance handle.
6759 * @return true if thermal protection is supported;
6760 * false otherwise.
6761 *
6762 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_THERMAL_PROTECTION.
6763 */
6764 bool RAIL_SupportsThermalProtection(RAIL_Handle_t railHandle);
6765
6766 /**
6767 * Indicate whether this chip supports the IEEE 802.15.4 2.4 RX channel switching.
6768 *
6769 * @param[in] railHandle A RAIL instance handle.
6770 * @return true if IEEE 802.15.4 2.4 GHz RX channel switching is supported;
6771 * false otherwise.
6772 *
6773 * Runtime refinement of compile-time \ref RAIL_IEEE802154_SUPPORTS_RX_CHANNEL_SWITCHING.
6774 */
6775 bool RAIL_IEEE802154_SupportsRxChannelSwitching(RAIL_Handle_t railHandle);
6776
6777 /**
6778 * Indicate whether this chip supports the IEEE 802.15.4 PHY with custom settings.
6779 *
6780 * @param[in] railHandle A RAIL instance handle.
6781 * @return true if the 802.15.4 PHY with custom settings is supported; false otherwise.
6782 *
6783 * Runtime refinement of compile-time \ref RAIL_IEEE802154_SUPPORTS_CUSTOM1_PHY.
6784 */
6785 bool RAIL_IEEE802154_SupportsCustom1Phy(RAIL_Handle_t railHandle);
6786
6787 /**
6788 * Indicate whether this chip supports the IEEE 802.15.4
6789 * front end module optimized PHY.
6790 *
6791 * @param[in] railHandle A RAIL instance handle.
6792 * @return true if a front end module is supported; false otherwise.
6793 *
6794 * Runtime refinement of compile-time \ref RAIL_IEEE802154_SUPPORTS_FEM_PHY.
6795 */
6796 bool RAIL_IEEE802154_SupportsFemPhy(RAIL_Handle_t railHandle);
6797
6798 /**
6799 * Indicate whether this chip supports canceling the frame-pending lookup
6800 * event \ref RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND when the radio
6801 * transitions to a state that renders the the reporting of this event moot
6802 * (i.e., too late for the stack to influence the outgoing ACK).
6803 *
6804 * @param[in] railHandle A RAIL instance handle.
6805 * @return true if canceling the lookup event is supported; false otherwise.
6806 *
6807 * Runtime refinement of compile-time \ref
6808 * RAIL_IEEE802154_SUPPORTS_CANCEL_FRAME_PENDING_LOOKUP.
6809 */
6810 bool RAIL_IEEE802154_SupportsCancelFramePendingLookup(RAIL_Handle_t railHandle);
6811
6812 /**
6813 * Indicate whether this chip supports early triggering of the frame-pending
6814 * lookup event \ref RAIL_EVENT_IEEE802154_DATA_REQUEST_COMMAND
6815 * just after MAC address fields have been received.
6816 *
6817 * @param[in] railHandle A RAIL instance handle.
6818 * @return true if early triggering is supported; false otherwise.
6819 *
6820 * Runtime refinement of compile-time \ref
6821 * RAIL_IEEE802154_SUPPORTS_EARLY_FRAME_PENDING_LOOKUP.
6822 */
6823 bool RAIL_IEEE802154_SupportsEarlyFramePendingLookup(RAIL_Handle_t railHandle);
6824
6825 /**
6826 * Indicate whether RAIL supports dual PA mode on this chip.
6827 *
6828 * @param[in] railHandle A RAIL instance handle.
6829 * @return true if the dual PA mode is supported; false otherwise.
6830 *
6831 * Runtime refinement of compile-time \ref RAIL_IEEE802154_SUPPORTS_DUAL_PA_CONFIG.
6832 */
6833 bool RAIL_IEEE802154_SupportsDualPaConfig(RAIL_Handle_t railHandle);
6834
6835 /**
6836 * Indicate whether this chip supports IEEE 802.15.4E-2012 Enhanced ACKing.
6837 *
6838 * @param[in] railHandle A RAIL instance handle.
6839 * @return true if 802.15.4E Enhanced ACKing is supported; false otherwise.
6840 *
6841 * Runtime refinement of compile-time \ref
6842 * RAIL_IEEE802154_SUPPORTS_E_ENHANCED_ACK.
6843 */
6844 bool RAIL_IEEE802154_SupportsEEnhancedAck(RAIL_Handle_t railHandle);
6845
6846 /**
6847 * Indicate whether this chip supports IEEE 802.15.4E-2012 Multipurpose frame
6848 * reception.
6849 *
6850 * @param[in] railHandle A RAIL instance handle.
6851 * @return true if Multipurpose frame reception is supported; false otherwise.
6852 *
6853 * Runtime refinement of compile-time \ref
6854 * RAIL_IEEE802154_SUPPORTS_E_MULTIPURPOSE_FRAMES.
6855 */
6856 bool RAIL_IEEE802154_SupportsEMultipurposeFrames(RAIL_Handle_t railHandle);
6857
6858 /**
6859 * Indicate whether this chip supports the IEEE 802.15.4E-2012 feature
6860 * subset needed for Zigbee R22 GB868.
6861 *
6862 * @param[in] railHandle A RAIL instance handle.
6863 * @return true if 802.15.4E GB868 subset is supported; false otherwise.
6864 *
6865 * Runtime refinement of compile-time \ref
6866 * RAIL_IEEE802154_SUPPORTS_E_SUBSET_GB868.
6867 */
6868 bool RAIL_IEEE802154_SupportsESubsetGB868(RAIL_Handle_t railHandle);
6869
6870 /**
6871 * Indicate whether this chip supports IEEE 802.15.4G-2012 reception and
6872 * transmission of frames with 4-byte CRC.
6873 *
6874 * @param[in] railHandle A RAIL instance handle.
6875 * @return true if 802.15.4G 4-byte CRC is supported; false otherwise.
6876 *
6877 * Runtime refinement of compile-time \ref
6878 * RAIL_IEEE802154_SUPPORTS_G_4BYTE_CRC.
6879 */
6880 bool RAIL_IEEE802154_SupportsG4ByteCrc(RAIL_Handle_t railHandle);
6881
6882 /**
6883 * Indicate whether this chip supports IEEE 802.15.4G dynamic FEC
6884 *
6885 * @param[in] railHandle A RAIL instance handle.
6886 * @return true if dynamic FEC is supported; false otherwise.
6887 *
6888 * Runtime refinement of compile-time \ref
6889 * RAIL_IEEE802154_SUPPORTS_G_DYNFEC.
6890 */
6891 bool RAIL_IEEE802154_SupportsGDynFec(RAIL_Handle_t railHandle);
6892
6893 /**
6894 * Indicate whether this chip supports Wi-SUN mode switching
6895 *
6896 * @param[in] railHandle A RAIL instance handle.
6897 * @return true if Wi-SUN mode switching is supported; false otherwise.
6898 *
6899 * Runtime refinement of compile-time \ref
6900 * RAIL_IEEE802154_SUPPORTS_G_MODESWITCH.
6901 */
6902 bool RAIL_IEEE802154_SupportsGModeSwitch(RAIL_Handle_t railHandle);
6903
6904 /**
6905 * Indicate whether this chip supports IEEE 802.15.4G-2012 feature
6906 * subset needed for Zigbee R22 GB868.
6907 *
6908 * @param[in] railHandle A RAIL instance handle.
6909 * @return true if 802.15.4G GB868 subset is supported; false otherwise.
6910 *
6911 * Runtime refinement of compile-time \ref
6912 * RAIL_IEEE802154_SUPPORTS_G_SUBSET_GB868.
6913 */
6914 bool RAIL_IEEE802154_SupportsGSubsetGB868(RAIL_Handle_t railHandle);
6915
6916 /**
6917 * Indicate whether this chip supports IEEE 802.15.4G-2012 reception
6918 * of unwhitened frames.
6919 *
6920 * @param[in] railHandle A RAIL instance handle.
6921 * @return true if 802.15.4G unwhitened frame reception is supported;
6922 * false otherwise.
6923 *
6924 * Runtime refinement of compile-time \ref
6925 * RAIL_IEEE802154_SUPPORTS_G_UNWHITENED_RX.
6926 */
6927 bool RAIL_IEEE802154_SupportsGUnwhitenedRx(RAIL_Handle_t railHandle);
6928
6929 /**
6930 * Indicate whether this chip supports IEEE 802.15.4G-2012 transmission
6931 * of unwhitened frames.
6932 *
6933 * @param[in] railHandle A RAIL instance handle.
6934 * @return true if 802.15.4G unwhitened frame transmit is supported;
6935 * false otherwise.
6936 *
6937 * Runtime refinement of compile-time \ref
6938 * RAIL_IEEE802154_SUPPORTS_G_UNWHITENED_TX.
6939 */
6940 bool RAIL_IEEE802154_SupportsGUnwhitenedTx(RAIL_Handle_t railHandle);
6941
6942 /**
6943 * Indicate whether this chip supports the Z-Wave protocol.
6944 *
6945 * @param[in] railHandle A RAIL instance handle.
6946 * @return true if the Z-Wave protocol is supported; false otherwise.
6947 *
6948 * Runtime refinement of compile-time \ref RAIL_SUPPORTS_PROTOCOL_ZWAVE.
6949 */
6950 bool RAIL_SupportsProtocolZWave(RAIL_Handle_t railHandle);
6951
6952 /**
6953 * Indicate whether this chip supports the Z-Wave concurrent PHY.
6954 *
6955 * @param[in] railHandle A RAIL instance handle.
6956 * @return true if the Z-Wave concurrent PHY is supported; false otherwise.
6957 *
6958 * Runtime refinement of compile-time \ref RAIL_ZWAVE_SUPPORTS_CONC_PHY.
6959 */
6960 bool RAIL_ZWAVE_SupportsConcPhy(RAIL_Handle_t railHandle);
6961
6962 /**
6963 * Indicate whether this chip supports the Z-Wave energy detect PHY.
6964 *
6965 * @param[in] railHandle A RAIL instance handle.
6966 * @return true if the Z-Wave energy detect PHY is supported; false otherwise.
6967 *
6968 * Runtime refinement of compile-time \ref RAIL_ZWAVE_SUPPORTS_ED_PHY.
6969 */
6970 bool RAIL_ZWAVE_SupportsEnergyDetectPhy(RAIL_Handle_t railHandle);
6971
6972 /**
6973 * Indicate whether this chip supports Z-Wave Region in PTI.
6974 *
6975 * @param[in] railHandle A RAIL instance handle.
6976 * @return true if ZWAVE Region in PTI is supported; false otherwise.
6977 *
6978 * Runtime refinement of compile-time \ref RAIL_ZWAVE_SUPPORTS_REGION_PTI.
6979 */
6980 bool RAIL_ZWAVE_SupportsRegionPti(RAIL_Handle_t railHandle);
6981
6982 /**
6983 * Indicate whether this chip supports IEEE 802.15.4 signal identifier.
6984 *
6985 * @param[in] railHandle A RAIL instance handle.
6986 * @return true if signal identifier is supported; false otherwise.
6987 */
6988 bool RAIL_IEEE802154_SupportsSignalIdentifier(RAIL_Handle_t railHandle);
6989
6990 /** @} */ // end of group Features
6991
6992 /** @} */ // end of group RAIL_API
6993
6994 #ifdef __cplusplus
6995 }
6996 #endif
6997
6998 #endif // __RAIL_H__
6999