Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /***************************************************************************//**
sahilmgandhi 18:6a4db94011d3 2 * @file rail_types.h
sahilmgandhi 18:6a4db94011d3 3 * @brief This file contains the type definitions for RAIL structures, enums,
sahilmgandhi 18:6a4db94011d3 4 * and other types.
sahilmgandhi 18:6a4db94011d3 5 * @copyright Copyright 2015 Silicon Laboratories, Inc. http://www.silabs.com
sahilmgandhi 18:6a4db94011d3 6 ******************************************************************************/
sahilmgandhi 18:6a4db94011d3 7
sahilmgandhi 18:6a4db94011d3 8 #ifndef __RAIL_TYPES_H__
sahilmgandhi 18:6a4db94011d3 9 #define __RAIL_TYPES_H__
sahilmgandhi 18:6a4db94011d3 10
sahilmgandhi 18:6a4db94011d3 11 // Include standard type headers to help define structures
sahilmgandhi 18:6a4db94011d3 12 #include <stdint.h>
sahilmgandhi 18:6a4db94011d3 13 #include <stdbool.h>
sahilmgandhi 18:6a4db94011d3 14 #include <stddef.h>
sahilmgandhi 18:6a4db94011d3 15
sahilmgandhi 18:6a4db94011d3 16 #include "rail_chip_specific.h"
sahilmgandhi 18:6a4db94011d3 17
sahilmgandhi 18:6a4db94011d3 18 /**
sahilmgandhi 18:6a4db94011d3 19 * @addtogroup RAIL_API
sahilmgandhi 18:6a4db94011d3 20 * @{
sahilmgandhi 18:6a4db94011d3 21 */
sahilmgandhi 18:6a4db94011d3 22
sahilmgandhi 18:6a4db94011d3 23 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 24 // Calibration Structures
sahilmgandhi 18:6a4db94011d3 25 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 26 /**
sahilmgandhi 18:6a4db94011d3 27 * @addtogroup Calibration
sahilmgandhi 18:6a4db94011d3 28 * @{
sahilmgandhi 18:6a4db94011d3 29 */
sahilmgandhi 18:6a4db94011d3 30
sahilmgandhi 18:6a4db94011d3 31 /**
sahilmgandhi 18:6a4db94011d3 32 * @typedef RAIL_CalMask_t
sahilmgandhi 18:6a4db94011d3 33 * @brief Calibration mask type
sahilmgandhi 18:6a4db94011d3 34 *
sahilmgandhi 18:6a4db94011d3 35 * This type is a bitmask of different RAIL calibration values. The exact
sahilmgandhi 18:6a4db94011d3 36 * meaning of these bits depends on what your particular chip supports.
sahilmgandhi 18:6a4db94011d3 37 */
sahilmgandhi 18:6a4db94011d3 38 typedef uint32_t RAIL_CalMask_t;
sahilmgandhi 18:6a4db94011d3 39
sahilmgandhi 18:6a4db94011d3 40 /**
sahilmgandhi 18:6a4db94011d3 41 * @struct RAIL_CalInit_t
sahilmgandhi 18:6a4db94011d3 42 * @brief Initialization structure for RAIL calibrations.
sahilmgandhi 18:6a4db94011d3 43 */
sahilmgandhi 18:6a4db94011d3 44 typedef struct RAIL_CalInit {
sahilmgandhi 18:6a4db94011d3 45 RAIL_CalMask_t calEnable; /**< Mask that defines calibrations to perform in RAIL. */
sahilmgandhi 18:6a4db94011d3 46 const uint8_t *irCalSettings; /**< Pointer to image rejection calibration settings. */
sahilmgandhi 18:6a4db94011d3 47 } RAIL_CalInit_t;
sahilmgandhi 18:6a4db94011d3 48
sahilmgandhi 18:6a4db94011d3 49 /**
sahilmgandhi 18:6a4db94011d3 50 * @}
sahilmgandhi 18:6a4db94011d3 51 */
sahilmgandhi 18:6a4db94011d3 52
sahilmgandhi 18:6a4db94011d3 53 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 54 // Radio Configuration Structures
sahilmgandhi 18:6a4db94011d3 55 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 56
sahilmgandhi 18:6a4db94011d3 57 /**
sahilmgandhi 18:6a4db94011d3 58 * @addtogroup General
sahilmgandhi 18:6a4db94011d3 59 * @{
sahilmgandhi 18:6a4db94011d3 60 */
sahilmgandhi 18:6a4db94011d3 61
sahilmgandhi 18:6a4db94011d3 62 /**
sahilmgandhi 18:6a4db94011d3 63 * @struct RAIL_Version_t
sahilmgandhi 18:6a4db94011d3 64 * @brief Contains RAIL Library Version Information
sahilmgandhi 18:6a4db94011d3 65 */
sahilmgandhi 18:6a4db94011d3 66 typedef struct RAIL_Version {
sahilmgandhi 18:6a4db94011d3 67 uint32_t hash; /**< Git hash */
sahilmgandhi 18:6a4db94011d3 68 uint8_t major; /**< Major number */
sahilmgandhi 18:6a4db94011d3 69 uint8_t minor; /**< Minor number */
sahilmgandhi 18:6a4db94011d3 70 uint8_t rev; /**< Revision number */
sahilmgandhi 18:6a4db94011d3 71 uint8_t build; /**< Build number */
sahilmgandhi 18:6a4db94011d3 72 uint8_t flags; /**< Build flags */
sahilmgandhi 18:6a4db94011d3 73 } RAIL_Version_t;
sahilmgandhi 18:6a4db94011d3 74
sahilmgandhi 18:6a4db94011d3 75 /**
sahilmgandhi 18:6a4db94011d3 76 * @struct RAIL_Init_t
sahilmgandhi 18:6a4db94011d3 77 * @brief Initialization structure for the RAIL library.
sahilmgandhi 18:6a4db94011d3 78 */
sahilmgandhi 18:6a4db94011d3 79 typedef struct RAIL_Init {
sahilmgandhi 18:6a4db94011d3 80 uint16_t maxPacketLength; /**< The maximum number of bytes in a packet. UNUSED! */
sahilmgandhi 18:6a4db94011d3 81 const uint32_t rfXtalFreq; /**< The xtal frequency of the radio. */
sahilmgandhi 18:6a4db94011d3 82 RAIL_CalMask_t calEnable; /**< Mask that defines calibrations to perform in RAIL. */
sahilmgandhi 18:6a4db94011d3 83 } RAIL_Init_t;
sahilmgandhi 18:6a4db94011d3 84
sahilmgandhi 18:6a4db94011d3 85 /**
sahilmgandhi 18:6a4db94011d3 86 * @enum RAIL_PtiProtocol_t
sahilmgandhi 18:6a4db94011d3 87 * @brief The protocol that RAIL outputs via the Packet Trace Interface (PTI)
sahilmgandhi 18:6a4db94011d3 88 */
sahilmgandhi 18:6a4db94011d3 89 typedef enum RAIL_PtiProtocol {
sahilmgandhi 18:6a4db94011d3 90 RAIL_PTI_PROTOCOL_CUSTOM = 0, /**< PTI output for a custom protocol */
sahilmgandhi 18:6a4db94011d3 91 RAIL_PTI_PROTOCOL_THREAD = 2, /**< PTI output for the Thread protocol */
sahilmgandhi 18:6a4db94011d3 92 RAIL_PTI_PROTOCOL_BLE = 3, /**< PTI output for the Bluetooth Smart protocol */
sahilmgandhi 18:6a4db94011d3 93 RAIL_PTI_PROTOCOL_CONNECT = 4, /**< PTI output for the Connect protocol */
sahilmgandhi 18:6a4db94011d3 94 RAIL_PTI_PROTOCOL_ZIGBEE = 5, /**< PTI output for the Zigbee protocol */
sahilmgandhi 18:6a4db94011d3 95 } RAIL_PtiProtocol_t;
sahilmgandhi 18:6a4db94011d3 96
sahilmgandhi 18:6a4db94011d3 97 /**
sahilmgandhi 18:6a4db94011d3 98 * @enum RAIL_RadioState_t
sahilmgandhi 18:6a4db94011d3 99 * @brief The current state of the radio
sahilmgandhi 18:6a4db94011d3 100 */
sahilmgandhi 18:6a4db94011d3 101 typedef enum RAIL_RadioState {
sahilmgandhi 18:6a4db94011d3 102 RAIL_RF_STATE_IDLE, /**< Radio is idle */
sahilmgandhi 18:6a4db94011d3 103 RAIL_RF_STATE_RX, /**< Radio is in receive */
sahilmgandhi 18:6a4db94011d3 104 RAIL_RF_STATE_TX, /**< Radio is in transmit */
sahilmgandhi 18:6a4db94011d3 105 } RAIL_RadioState_t;
sahilmgandhi 18:6a4db94011d3 106
sahilmgandhi 18:6a4db94011d3 107 /**
sahilmgandhi 18:6a4db94011d3 108 * @enum RAIL_Status_t
sahilmgandhi 18:6a4db94011d3 109 * @brief The available status options
sahilmgandhi 18:6a4db94011d3 110 */
sahilmgandhi 18:6a4db94011d3 111 typedef enum RAIL_Status {
sahilmgandhi 18:6a4db94011d3 112 RAIL_STATUS_NO_ERROR, /**< RAIL function reports no error */
sahilmgandhi 18:6a4db94011d3 113 RAIL_STATUS_INVALID_PARAMETER, /**< Call to RAIL function errored because of an invalid parameter */
sahilmgandhi 18:6a4db94011d3 114 RAIL_STATUS_INVALID_STATE, /**< Call to RAIL function errored because called during an invalid radio state */
sahilmgandhi 18:6a4db94011d3 115 RAIL_STATUS_INVALID_CALL, /**< The function is called in an invalid order */
sahilmgandhi 18:6a4db94011d3 116 } RAIL_Status_t;
sahilmgandhi 18:6a4db94011d3 117
sahilmgandhi 18:6a4db94011d3 118 /**
sahilmgandhi 18:6a4db94011d3 119 * @enum RAIL_RfSenseBand_t
sahilmgandhi 18:6a4db94011d3 120 * @brief Enumeration for specifying Rf Sense frequency band.
sahilmgandhi 18:6a4db94011d3 121 */
sahilmgandhi 18:6a4db94011d3 122 typedef enum {
sahilmgandhi 18:6a4db94011d3 123 RAIL_RFSENSE_OFF, /**< RFSense is disabled */
sahilmgandhi 18:6a4db94011d3 124 RAIL_RFSENSE_2_4GHZ, /**< RFSense is in 2.4G band */
sahilmgandhi 18:6a4db94011d3 125 RAIL_RFSENSE_SUBGHZ, /**< RFSense is in subgig band */
sahilmgandhi 18:6a4db94011d3 126 RAIL_RFSENSE_ANY, /**< RfSense is in both bands */
sahilmgandhi 18:6a4db94011d3 127 RAIL_RFSENSE_MAX // Must be last
sahilmgandhi 18:6a4db94011d3 128 } RAIL_RfSenseBand_t;
sahilmgandhi 18:6a4db94011d3 129
sahilmgandhi 18:6a4db94011d3 130 /**
sahilmgandhi 18:6a4db94011d3 131 * @enum RAIL_RfIdleMode_t
sahilmgandhi 18:6a4db94011d3 132 * @brief Enumeration for the different types of idle modes we support. These
sahilmgandhi 18:6a4db94011d3 133 * vary how quickly and destructively we will put the radio into idle.
sahilmgandhi 18:6a4db94011d3 134 */
sahilmgandhi 18:6a4db94011d3 135 typedef enum {
sahilmgandhi 18:6a4db94011d3 136 /**
sahilmgandhi 18:6a4db94011d3 137 * Idle the radio by turning off receive and canceling any future scheduled
sahilmgandhi 18:6a4db94011d3 138 * receive or transmit operations. This will not abort a receive or
sahilmgandhi 18:6a4db94011d3 139 * transmit that is in progress.
sahilmgandhi 18:6a4db94011d3 140 */
sahilmgandhi 18:6a4db94011d3 141 RAIL_IDLE,
sahilmgandhi 18:6a4db94011d3 142 /**
sahilmgandhi 18:6a4db94011d3 143 * Idle the radio by turning off receive and any scheduled events. This will
sahilmgandhi 18:6a4db94011d3 144 * also abort any receive, transmit, or scheduled events in progress.
sahilmgandhi 18:6a4db94011d3 145 */
sahilmgandhi 18:6a4db94011d3 146 RAIL_IDLE_ABORT,
sahilmgandhi 18:6a4db94011d3 147 /**
sahilmgandhi 18:6a4db94011d3 148 * Force the radio into a shutdown mode as quickly as possible. This will
sahilmgandhi 18:6a4db94011d3 149 * abort all current operations and cancel any pending scheduled operations.
sahilmgandhi 18:6a4db94011d3 150 * It may also corrupt receive or transmit buffers and end up clearing them.
sahilmgandhi 18:6a4db94011d3 151 */
sahilmgandhi 18:6a4db94011d3 152 RAIL_IDLE_FORCE_SHUTDOWN,
sahilmgandhi 18:6a4db94011d3 153 /**
sahilmgandhi 18:6a4db94011d3 154 * Similar to the \ref RAIL_IDLE_FORCE_SHUTDOWN command this will quickly
sahilmgandhi 18:6a4db94011d3 155 * put the radio into the idle state. In addition to this it will clear any
sahilmgandhi 18:6a4db94011d3 156 * pending receive or transmit callbacks and clear both the receive and
sahilmgandhi 18:6a4db94011d3 157 * transmit storage.
sahilmgandhi 18:6a4db94011d3 158 */
sahilmgandhi 18:6a4db94011d3 159 RAIL_IDLE_FORCE_SHUTDOWN_CLEAR_FLAGS
sahilmgandhi 18:6a4db94011d3 160 } RAIL_RfIdleMode_t;
sahilmgandhi 18:6a4db94011d3 161
sahilmgandhi 18:6a4db94011d3 162 /**
sahilmgandhi 18:6a4db94011d3 163 * @}
sahilmgandhi 18:6a4db94011d3 164 */
sahilmgandhi 18:6a4db94011d3 165
sahilmgandhi 18:6a4db94011d3 166 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 167 // Data Management Structures
sahilmgandhi 18:6a4db94011d3 168 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 169
sahilmgandhi 18:6a4db94011d3 170 /**
sahilmgandhi 18:6a4db94011d3 171 * @addtogroup Data_Management
sahilmgandhi 18:6a4db94011d3 172 * @{
sahilmgandhi 18:6a4db94011d3 173 */
sahilmgandhi 18:6a4db94011d3 174
sahilmgandhi 18:6a4db94011d3 175 /**
sahilmgandhi 18:6a4db94011d3 176 * @enum RAIL_TxDataSource_t
sahilmgandhi 18:6a4db94011d3 177 * @brief Transmit data sources supported by RAIL.
sahilmgandhi 18:6a4db94011d3 178 */
sahilmgandhi 18:6a4db94011d3 179 typedef enum{
sahilmgandhi 18:6a4db94011d3 180 TX_PACKET_DATA, /**< Use the frame hardware to packetize data */
sahilmgandhi 18:6a4db94011d3 181 } RAIL_TxDataSource_t;
sahilmgandhi 18:6a4db94011d3 182
sahilmgandhi 18:6a4db94011d3 183 /**
sahilmgandhi 18:6a4db94011d3 184 * @enum RAIL_RxDataSource_t
sahilmgandhi 18:6a4db94011d3 185 * @brief Receive data sources supported by RAIL.
sahilmgandhi 18:6a4db94011d3 186 */
sahilmgandhi 18:6a4db94011d3 187 typedef enum{
sahilmgandhi 18:6a4db94011d3 188 RX_PACKET_DATA, /**< Use the frame hardware to packetize data */
sahilmgandhi 18:6a4db94011d3 189 RX_DEMOD_DATA, /**< Get 8-bit data output from the demodulator */
sahilmgandhi 18:6a4db94011d3 190 RX_IQDATA_FILTLSB, /**< Get lower 16 bits of I/Q data provided to demodulator */
sahilmgandhi 18:6a4db94011d3 191 RX_IQDATA_FILTMSB /**< Get highest 16 bits of I/Q data provided to demodulator */
sahilmgandhi 18:6a4db94011d3 192 } RAIL_RxDataSource_t;
sahilmgandhi 18:6a4db94011d3 193
sahilmgandhi 18:6a4db94011d3 194 /**
sahilmgandhi 18:6a4db94011d3 195 * @enum RAIL_DataMethod_t
sahilmgandhi 18:6a4db94011d3 196 * @brief Methods for the application to provide and retreive data from RAIL.
sahilmgandhi 18:6a4db94011d3 197 */
sahilmgandhi 18:6a4db94011d3 198 typedef enum{
sahilmgandhi 18:6a4db94011d3 199 PACKET_MODE, /**< Packet based data method */
sahilmgandhi 18:6a4db94011d3 200 FIFO_MODE, /**< FIFO based data method */
sahilmgandhi 18:6a4db94011d3 201 } RAIL_DataMethod_t;
sahilmgandhi 18:6a4db94011d3 202
sahilmgandhi 18:6a4db94011d3 203 /**
sahilmgandhi 18:6a4db94011d3 204 * @struct RAIL_DataConfig_t
sahilmgandhi 18:6a4db94011d3 205 * @brief RAIL data configuration structure
sahilmgandhi 18:6a4db94011d3 206 *
sahilmgandhi 18:6a4db94011d3 207 * This structure is used to select the transmit/receive data sources, and the
sahilmgandhi 18:6a4db94011d3 208 * method the application uses to provide/retreive data from RAIL.
sahilmgandhi 18:6a4db94011d3 209 */
sahilmgandhi 18:6a4db94011d3 210 typedef struct {
sahilmgandhi 18:6a4db94011d3 211 RAIL_TxDataSource_t txSource; /**< Source of TX Data */
sahilmgandhi 18:6a4db94011d3 212 RAIL_RxDataSource_t rxSource; /**< Source of RX Data */
sahilmgandhi 18:6a4db94011d3 213 RAIL_DataMethod_t txMethod; /**< Method of providing transmit data */
sahilmgandhi 18:6a4db94011d3 214 RAIL_DataMethod_t rxMethod; /**< Method of retrieving receive data */
sahilmgandhi 18:6a4db94011d3 215 } RAIL_DataConfig_t;
sahilmgandhi 18:6a4db94011d3 216
sahilmgandhi 18:6a4db94011d3 217 /**
sahilmgandhi 18:6a4db94011d3 218 * @def RAIL_SETFIXEDLENGTH_INVALID
sahilmgandhi 18:6a4db94011d3 219 * @brief Invalid return value when calling RAIL_SetFixedLength()
sahilmgandhi 18:6a4db94011d3 220 *
sahilmgandhi 18:6a4db94011d3 221 * Invalid return value when calling RAIL_SetFixedLength() while the radio is
sahilmgandhi 18:6a4db94011d3 222 * not in fixed length mode.
sahilmgandhi 18:6a4db94011d3 223 */
sahilmgandhi 18:6a4db94011d3 224 #define RAIL_SETFIXEDLENGTH_INVALID (0xFFFF)
sahilmgandhi 18:6a4db94011d3 225
sahilmgandhi 18:6a4db94011d3 226 /**
sahilmgandhi 18:6a4db94011d3 227 * @}
sahilmgandhi 18:6a4db94011d3 228 */
sahilmgandhi 18:6a4db94011d3 229
sahilmgandhi 18:6a4db94011d3 230 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 231 // PHY Configuration Structures
sahilmgandhi 18:6a4db94011d3 232 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 233
sahilmgandhi 18:6a4db94011d3 234 /**
sahilmgandhi 18:6a4db94011d3 235 * @addtogroup Radio_Configuration
sahilmgandhi 18:6a4db94011d3 236 * @{
sahilmgandhi 18:6a4db94011d3 237 */
sahilmgandhi 18:6a4db94011d3 238
sahilmgandhi 18:6a4db94011d3 239 /**
sahilmgandhi 18:6a4db94011d3 240 * @struct RAIL_StateTiming_t
sahilmgandhi 18:6a4db94011d3 241 * @brief Timing configuration structure for the RAIL State Machine
sahilmgandhi 18:6a4db94011d3 242 *
sahilmgandhi 18:6a4db94011d3 243 * This is used to configure the timings of the radio state transitions for
sahilmgandhi 18:6a4db94011d3 244 * common situations. All of the listed timings are in us. Timing values cannot
sahilmgandhi 18:6a4db94011d3 245 * exceed 13ms. Transitions to IDLE always happen as fast as possible.
sahilmgandhi 18:6a4db94011d3 246 */
sahilmgandhi 18:6a4db94011d3 247 typedef struct RAIL_StateTiming {
sahilmgandhi 18:6a4db94011d3 248 uint16_t idleToRx; /**<Transition time from IDLE to RX */
sahilmgandhi 18:6a4db94011d3 249 uint16_t txToRx; /**<Transition time from TX to RX */
sahilmgandhi 18:6a4db94011d3 250 uint16_t idleToTx; /**<Transition time from IDLE to RX */
sahilmgandhi 18:6a4db94011d3 251 uint16_t rxToTx; /**<Transition time from RX to TX */
sahilmgandhi 18:6a4db94011d3 252 } RAIL_StateTiming_t;
sahilmgandhi 18:6a4db94011d3 253
sahilmgandhi 18:6a4db94011d3 254 /**
sahilmgandhi 18:6a4db94011d3 255 * @struct RAIL_FrameType_t
sahilmgandhi 18:6a4db94011d3 256 * @brief Configure if there is a frame type in your frame and the lengths of each frame.
sahilmgandhi 18:6a4db94011d3 257 * The number of bits set in the mask determines the number of elements in frameLen
sahilmgandhi 18:6a4db94011d3 258 * If your packet does not have frame types but instead are of fixed length, set the mask
sahilmgandhi 18:6a4db94011d3 259 * and offset to 0. RAIL will use the value at frameLen to determine the packet length.
sahilmgandhi 18:6a4db94011d3 260 * If each frame type has a different location for the addres, variableAddrLoc should be True.
sahilmgandhi 18:6a4db94011d3 261 */
sahilmgandhi 18:6a4db94011d3 262 typedef struct RAIL_FrameType {
sahilmgandhi 18:6a4db94011d3 263 uint8_t offset; /**< Zero-based location of the frame type field in packet. */
sahilmgandhi 18:6a4db94011d3 264 uint8_t mask; /**< Bit mask of the frame type field. Determines number of frames expected. Must be contiguous ones. */
sahilmgandhi 18:6a4db94011d3 265 uint16_t *frameLen; /**< Pointer to array of frame lengths for each frame type. */
sahilmgandhi 18:6a4db94011d3 266 uint8_t *isValid; /**< Pointer to array that marks if each frame is valid or should be filtered. */
sahilmgandhi 18:6a4db94011d3 267 bool variableAddrLoc; /**< If true, address location varies per frame type. */
sahilmgandhi 18:6a4db94011d3 268 } RAIL_FrameType_t;
sahilmgandhi 18:6a4db94011d3 269
sahilmgandhi 18:6a4db94011d3 270 /**
sahilmgandhi 18:6a4db94011d3 271 * @struct RAIL_ChannelConfigEntry_t
sahilmgandhi 18:6a4db94011d3 272 * @brief Channel configuration entry structure. Defines a base frequency and
sahilmgandhi 18:6a4db94011d3 273 * channel space and the channel indexes that are valid within this range.
sahilmgandhi 18:6a4db94011d3 274 *
sahilmgandhi 18:6a4db94011d3 275 * * frequency = baseFrequency + channelSpacing * (channel - channelNumberStart);
sahilmgandhi 18:6a4db94011d3 276 *
sahilmgandhi 18:6a4db94011d3 277 * Each RAIL_ChannelConfigEntry_t should not span more than 64 channels.
sahilmgandhi 18:6a4db94011d3 278 */
sahilmgandhi 18:6a4db94011d3 279 typedef struct RAIL_ChannelConfigEntry {
sahilmgandhi 18:6a4db94011d3 280 uint16_t channelNumberStart; /**< RAIL Channel number in which this channel set begins.*/
sahilmgandhi 18:6a4db94011d3 281 uint16_t channelNumberEnd; /**< The last valid RAIL channel number for this channel set. */
sahilmgandhi 18:6a4db94011d3 282 uint32_t channelSpacing; /**< Channel spacing in Hz of this channel set. */
sahilmgandhi 18:6a4db94011d3 283 uint32_t baseFrequency; /**< Base frequency in Hz of this channel set. */
sahilmgandhi 18:6a4db94011d3 284 } RAIL_ChannelConfigEntry_t;
sahilmgandhi 18:6a4db94011d3 285
sahilmgandhi 18:6a4db94011d3 286 /**
sahilmgandhi 18:6a4db94011d3 287 * @struct RAIL_ChannelConfig_t
sahilmgandhi 18:6a4db94011d3 288 * @brief Channel configuration structure which defines the channel meaning when
sahilmgandhi 18:6a4db94011d3 289 * a channel number is passed into a RAIL function, eg. RAIL_TxStart(), RAIL_RxStart()
sahilmgandhi 18:6a4db94011d3 290 *
sahilmgandhi 18:6a4db94011d3 291 * A RAIL_ChannelConfig_t structure defines the channel scheme that an
sahilmgandhi 18:6a4db94011d3 292 * application uses when registered in RAIL_ChannelConfig(). A channel scheme
sahilmgandhi 18:6a4db94011d3 293 * must be in the same band, it can not span across frequencies that would
sahilmgandhi 18:6a4db94011d3 294 * change the divider.
sahilmgandhi 18:6a4db94011d3 295 *
sahilmgandhi 18:6a4db94011d3 296 * A few examples of different channel schemes:
sahilmgandhi 18:6a4db94011d3 297 * @code{.c}
sahilmgandhi 18:6a4db94011d3 298 * // Ten channels starting a 915 Mhz with a channel spacing of 1 Mhz
sahilmgandhi 18:6a4db94011d3 299 * RAIL_ChannelConfigEntry_t channels = {
sahilmgandhi 18:6a4db94011d3 300 * 0, 9, 1000000, 915000000
sahilmgandhi 18:6a4db94011d3 301 * };
sahilmgandhi 18:6a4db94011d3 302 * RAIL_ChannelConfig_t channelScheme = {
sahilmgandhi 18:6a4db94011d3 303 * channels,
sahilmgandhi 18:6a4db94011d3 304 * 1
sahilmgandhi 18:6a4db94011d3 305 * };
sahilmgandhi 18:6a4db94011d3 306 *
sahilmgandhi 18:6a4db94011d3 307 * // 120 channels starting at 915Mhz with channel spacing of 100KHz
sahilmgandhi 18:6a4db94011d3 308 * RAIL_ChannelConfigEntry_t channels[] = {
sahilmgandhi 18:6a4db94011d3 309 * {0, 63, 100000, 910000000},
sahilmgandhi 18:6a4db94011d3 310 * {64, 119, 100000, 916400000},
sahilmgandhi 18:6a4db94011d3 311 * };
sahilmgandhi 18:6a4db94011d3 312 * RAIL_ChannelConfig_t channelScheme = {
sahilmgandhi 18:6a4db94011d3 313 * channels,
sahilmgandhi 18:6a4db94011d3 314 * 2
sahilmgandhi 18:6a4db94011d3 315 * };
sahilmgandhi 18:6a4db94011d3 316 *
sahilmgandhi 18:6a4db94011d3 317 * // 5 nonlinear channels
sahilmgandhi 18:6a4db94011d3 318 * RAIL_ChannelConfigEntry_t channels[] = {
sahilmgandhi 18:6a4db94011d3 319 * {0, 0, 0, 910123456},
sahilmgandhi 18:6a4db94011d3 320 * {1, 1, 0, 911654789},
sahilmgandhi 18:6a4db94011d3 321 * {2, 2, 0, 912321456},
sahilmgandhi 18:6a4db94011d3 322 * {3, 3, 0, 913147852},
sahilmgandhi 18:6a4db94011d3 323 * {4, 4, 0, 914567890}
sahilmgandhi 18:6a4db94011d3 324 * };
sahilmgandhi 18:6a4db94011d3 325 * RAIL_ChannelConfig_t channelScheme = {
sahilmgandhi 18:6a4db94011d3 326 * channels,
sahilmgandhi 18:6a4db94011d3 327 * 5
sahilmgandhi 18:6a4db94011d3 328 * };
sahilmgandhi 18:6a4db94011d3 329 * @endcode
sahilmgandhi 18:6a4db94011d3 330 */
sahilmgandhi 18:6a4db94011d3 331 typedef struct RAIL_ChannelConfig {
sahilmgandhi 18:6a4db94011d3 332 RAIL_ChannelConfigEntry_t *configs; /**< Pointer to an array of RAIL_ChannelConfigEntry_t entries.*/
sahilmgandhi 18:6a4db94011d3 333 uint32_t length; /**< Number of RAIL_ChannelConfigEntry_t entries. */
sahilmgandhi 18:6a4db94011d3 334 } RAIL_ChannelConfig_t;
sahilmgandhi 18:6a4db94011d3 335
sahilmgandhi 18:6a4db94011d3 336 /**
sahilmgandhi 18:6a4db94011d3 337 * @}
sahilmgandhi 18:6a4db94011d3 338 */
sahilmgandhi 18:6a4db94011d3 339
sahilmgandhi 18:6a4db94011d3 340 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 341 // Address Filtering Configuration Structures
sahilmgandhi 18:6a4db94011d3 342 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 343 /**
sahilmgandhi 18:6a4db94011d3 344 * @addtogroup Address_Filtering
sahilmgandhi 18:6a4db94011d3 345 * @{
sahilmgandhi 18:6a4db94011d3 346 */
sahilmgandhi 18:6a4db94011d3 347
sahilmgandhi 18:6a4db94011d3 348 /// Default address filtering match table for configurations that use only one
sahilmgandhi 18:6a4db94011d3 349 /// address field. The truth table for address matching is below.
sahilmgandhi 18:6a4db94011d3 350 ///
sahilmgandhi 18:6a4db94011d3 351 /// | | 0000 | 0001 | 0010 | 0100 | 1000 |
sahilmgandhi 18:6a4db94011d3 352 /// |----------|------|------|------|------|------|
sahilmgandhi 18:6a4db94011d3 353 /// | __0000__ | 0 | 1 | 1 | 1 | 1 |
sahilmgandhi 18:6a4db94011d3 354 /// | __0001__ | 1 | 1 | 1 | 1 | 1 |
sahilmgandhi 18:6a4db94011d3 355 /// | __0010__ | 1 | 1 | 1 | 1 | 1 |
sahilmgandhi 18:6a4db94011d3 356 /// | __0100__ | 1 | 1 | 1 | 1 | 1 |
sahilmgandhi 18:6a4db94011d3 357 /// | __1000__ | 1 | 1 | 1 | 1 | 1 |
sahilmgandhi 18:6a4db94011d3 358 ///
sahilmgandhi 18:6a4db94011d3 359 #define ADDRCONFIG_MATCH_TABLE_SINGLE_FIELD (0x1fffffe)
sahilmgandhi 18:6a4db94011d3 360 /// Default address filtering match table for configurations that use two
sahilmgandhi 18:6a4db94011d3 361 /// address fields and just want to match the same index in each. The truth
sahilmgandhi 18:6a4db94011d3 362 /// table for address matching is shown below.
sahilmgandhi 18:6a4db94011d3 363 ///
sahilmgandhi 18:6a4db94011d3 364 /// | | 0000 | 0001 | 0010 | 0100 | 1000 |
sahilmgandhi 18:6a4db94011d3 365 /// |----------|------|------|------|------|------|
sahilmgandhi 18:6a4db94011d3 366 /// | __0000__ | 0 | 0 | 0 | 0 | 0 |
sahilmgandhi 18:6a4db94011d3 367 /// | __0001__ | 0 | 1 | 0 | 0 | 0 |
sahilmgandhi 18:6a4db94011d3 368 /// | __0010__ | 0 | 0 | 1 | 0 | 0 |
sahilmgandhi 18:6a4db94011d3 369 /// | __0100__ | 0 | 0 | 0 | 1 | 0 |
sahilmgandhi 18:6a4db94011d3 370 /// | __1000__ | 0 | 0 | 0 | 0 | 1 |
sahilmgandhi 18:6a4db94011d3 371 #define ADDRCONFIG_MATCH_TABLE_DOUBLE_FIELD (0x1041040)
sahilmgandhi 18:6a4db94011d3 372
sahilmgandhi 18:6a4db94011d3 373 /**
sahilmgandhi 18:6a4db94011d3 374 * @struct RAIL_AddrConfig_t
sahilmgandhi 18:6a4db94011d3 375 * @brief A structure to configure the address filtering functionality in RAIL.
sahilmgandhi 18:6a4db94011d3 376 */
sahilmgandhi 18:6a4db94011d3 377 typedef struct RAIL_AddrConfig {
sahilmgandhi 18:6a4db94011d3 378 /** The number of fields to configure. You cannot have more than 2. */
sahilmgandhi 18:6a4db94011d3 379 uint8_t numFields;
sahilmgandhi 18:6a4db94011d3 380
sahilmgandhi 18:6a4db94011d3 381 /**
sahilmgandhi 18:6a4db94011d3 382 * A list of the start offsets for each field
sahilmgandhi 18:6a4db94011d3 383 *
sahilmgandhi 18:6a4db94011d3 384 * These offsets are specified relative to the previous field's end. In the
sahilmgandhi 18:6a4db94011d3 385 * case of the first field it's relative to either the beginning of the packet
sahilmgandhi 18:6a4db94011d3 386 * or the end of the frame type byte if frame type decoding is enabled.
sahilmgandhi 18:6a4db94011d3 387 */
sahilmgandhi 18:6a4db94011d3 388 uint8_t *offsets;
sahilmgandhi 18:6a4db94011d3 389
sahilmgandhi 18:6a4db94011d3 390 /**
sahilmgandhi 18:6a4db94011d3 391 * A list of the address field sizes
sahilmgandhi 18:6a4db94011d3 392 *
sahilmgandhi 18:6a4db94011d3 393 * These sizes are specified in bytes and can be from 0 to 8. If you choose a
sahilmgandhi 18:6a4db94011d3 394 * size of 0 this field is effectively disabled.
sahilmgandhi 18:6a4db94011d3 395 */
sahilmgandhi 18:6a4db94011d3 396 uint8_t *sizes;
sahilmgandhi 18:6a4db94011d3 397
sahilmgandhi 18:6a4db94011d3 398 /**
sahilmgandhi 18:6a4db94011d3 399 * The truth table to determine how the two fields combine to create a match
sahilmgandhi 18:6a4db94011d3 400 *
sahilmgandhi 18:6a4db94011d3 401 * For detailed information about how this truth table is formed see the
sahilmgandhi 18:6a4db94011d3 402 * detailed description of @ref Address_Filtering.
sahilmgandhi 18:6a4db94011d3 403 *
sahilmgandhi 18:6a4db94011d3 404 * For simple predefined configurations you can use the following defines.
sahilmgandhi 18:6a4db94011d3 405 * - ADDRCONFIG_MATCH_TABLE_SINGLE_FIELD
sahilmgandhi 18:6a4db94011d3 406 * - For filtering that only uses a single address field
sahilmgandhi 18:6a4db94011d3 407 * - ADDRCONFIG_MATCH_TABLE_DOUBLE_FIELD for two field filtering where you
sahilmgandhi 18:6a4db94011d3 408 * - For filtering that uses two address fields in a configurations where
sahilmgandhi 18:6a4db94011d3 409 * you want the following logic `((Field0, Index0) && (Field1, Index0)) ||
sahilmgandhi 18:6a4db94011d3 410 * ((Field0, Index1) && (Field1, Index1)) || ...`
sahilmgandhi 18:6a4db94011d3 411 */
sahilmgandhi 18:6a4db94011d3 412 uint32_t matchTable;
sahilmgandhi 18:6a4db94011d3 413 } RAIL_AddrConfig_t;
sahilmgandhi 18:6a4db94011d3 414
sahilmgandhi 18:6a4db94011d3 415 /**
sahilmgandhi 18:6a4db94011d3 416 * @}
sahilmgandhi 18:6a4db94011d3 417 */
sahilmgandhi 18:6a4db94011d3 418
sahilmgandhi 18:6a4db94011d3 419 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 420 // System Timing Structures
sahilmgandhi 18:6a4db94011d3 421 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 422 /**
sahilmgandhi 18:6a4db94011d3 423 * @addtogroup System_Timing
sahilmgandhi 18:6a4db94011d3 424 * @{
sahilmgandhi 18:6a4db94011d3 425 */
sahilmgandhi 18:6a4db94011d3 426
sahilmgandhi 18:6a4db94011d3 427 /**
sahilmgandhi 18:6a4db94011d3 428 * @enum RAIL_TimeMode_t
sahilmgandhi 18:6a4db94011d3 429 * @brief This type is used to specifying a time offset in RAIL APIs.
sahilmgandhi 18:6a4db94011d3 430 *
sahilmgandhi 18:6a4db94011d3 431 * Different APIs use these same constants and may provide more specifics of how
sahilmgandhi 18:6a4db94011d3 432 * they're used but the general philosophy for each is described below.
sahilmgandhi 18:6a4db94011d3 433 */
sahilmgandhi 18:6a4db94011d3 434 typedef enum RAIL_TimeMode {
sahilmgandhi 18:6a4db94011d3 435 /**
sahilmgandhi 18:6a4db94011d3 436 * The time specified is an exact time in the RAIL timebase and the given
sahilmgandhi 18:6a4db94011d3 437 * event should happen at exactly that time. If this time is already in the
sahilmgandhi 18:6a4db94011d3 438 * past we will return an error and fail. Since the RAIL timebase wraps at 32
sahilmgandhi 18:6a4db94011d3 439 * bits there is no real 'past' so we instead consider any event greater than
sahilmgandhi 18:6a4db94011d3 440 * 3/4 of the way into the future to be in the past.
sahilmgandhi 18:6a4db94011d3 441 */
sahilmgandhi 18:6a4db94011d3 442 RAIL_TIME_ABSOLUTE,
sahilmgandhi 18:6a4db94011d3 443 /**
sahilmgandhi 18:6a4db94011d3 444 * The time specified is relative to now and the event should occur that many
sahilmgandhi 18:6a4db94011d3 445 * ticks in the future. Delays are only guaranteed to be at least as long as
sahilmgandhi 18:6a4db94011d3 446 * the value specified. There may be some overhead between when the API is
sahilmgandhi 18:6a4db94011d3 447 * called and when the delay starts so we _do not_ recommend using this for
sahilmgandhi 18:6a4db94011d3 448 * operations that must happen at exactly a given time. For that you must use
sahilmgandhi 18:6a4db94011d3 449 * \ref RAIL_TIME_ABSOLUTE delays.
sahilmgandhi 18:6a4db94011d3 450 *
sahilmgandhi 18:6a4db94011d3 451 * Note that if you specify a delay of 0 we will trigger that event as soon as
sahilmgandhi 18:6a4db94011d3 452 * possible. This is different than specifying an absolute time of now which
sahilmgandhi 18:6a4db94011d3 453 * would return an error unless it was possible.
sahilmgandhi 18:6a4db94011d3 454 */
sahilmgandhi 18:6a4db94011d3 455 RAIL_TIME_DELAY,
sahilmgandhi 18:6a4db94011d3 456 /**
sahilmgandhi 18:6a4db94011d3 457 * The specified time is invalid and should be ignored. For some APIs this can
sahilmgandhi 18:6a4db94011d3 458 * also indicate that any previously stored delay should be invalidated and
sahilmgandhi 18:6a4db94011d3 459 * disabled.
sahilmgandhi 18:6a4db94011d3 460 */
sahilmgandhi 18:6a4db94011d3 461 RAIL_TIME_DISABLED
sahilmgandhi 18:6a4db94011d3 462 } RAIL_TimeMode_t;
sahilmgandhi 18:6a4db94011d3 463
sahilmgandhi 18:6a4db94011d3 464 /**
sahilmgandhi 18:6a4db94011d3 465 * @}
sahilmgandhi 18:6a4db94011d3 466 */
sahilmgandhi 18:6a4db94011d3 467
sahilmgandhi 18:6a4db94011d3 468 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 469 // Pre-Tx Configuration Structures
sahilmgandhi 18:6a4db94011d3 470 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 471 /**
sahilmgandhi 18:6a4db94011d3 472 * @addtogroup Pre-Transmit
sahilmgandhi 18:6a4db94011d3 473 * @{
sahilmgandhi 18:6a4db94011d3 474 */
sahilmgandhi 18:6a4db94011d3 475
sahilmgandhi 18:6a4db94011d3 476 /**
sahilmgandhi 18:6a4db94011d3 477 * @typedef RAIL_PreTxOp_t
sahilmgandhi 18:6a4db94011d3 478 * @brief Generic type used for all configurable pre-transmit operation
sahilmgandhi 18:6a4db94011d3 479 * functions.
sahilmgandhi 18:6a4db94011d3 480 */
sahilmgandhi 18:6a4db94011d3 481 typedef uint8_t (*RAIL_PreTxOp_t)(void *params);
sahilmgandhi 18:6a4db94011d3 482
sahilmgandhi 18:6a4db94011d3 483 /**
sahilmgandhi 18:6a4db94011d3 484 * @struct RAIL_ScheduleTxConfig_t
sahilmgandhi 18:6a4db94011d3 485 * @brief This structure is used to configure the Scheduled Tx algorithm.
sahilmgandhi 18:6a4db94011d3 486 * When using the built-in RAIL_PreTxSchedule() algorithm as your
sahilmgandhi 18:6a4db94011d3 487 * pre-transmit hook within RAIL_TxStart(), an instance of this structure
sahilmgandhi 18:6a4db94011d3 488 * must be passed as its argument.
sahilmgandhi 18:6a4db94011d3 489 */
sahilmgandhi 18:6a4db94011d3 490 typedef struct RAIL_ScheduleTxConfig {
sahilmgandhi 18:6a4db94011d3 491 /**
sahilmgandhi 18:6a4db94011d3 492 * When to transmit this packet. The exact interpretation of this value
sahilmgandhi 18:6a4db94011d3 493 * depends on the mode specified below.
sahilmgandhi 18:6a4db94011d3 494 */
sahilmgandhi 18:6a4db94011d3 495 uint32_t when;
sahilmgandhi 18:6a4db94011d3 496 /**
sahilmgandhi 18:6a4db94011d3 497 * They type of delay to use. See the \ref RAIL_TimeMode_t documentation for
sahilmgandhi 18:6a4db94011d3 498 * more information. Be sure to use \ref RAIL_TIME_ABSOLUTE delays for time
sahilmgandhi 18:6a4db94011d3 499 * critical protocols.
sahilmgandhi 18:6a4db94011d3 500 */
sahilmgandhi 18:6a4db94011d3 501 RAIL_TimeMode_t mode;
sahilmgandhi 18:6a4db94011d3 502 } RAIL_ScheduleTxConfig_t;
sahilmgandhi 18:6a4db94011d3 503
sahilmgandhi 18:6a4db94011d3 504 /**
sahilmgandhi 18:6a4db94011d3 505 * @def RAIL_MAX_LBT_TRIES
sahilmgandhi 18:6a4db94011d3 506 * @brief The maximum number of LBT/CSMA retries supported
sahilmgandhi 18:6a4db94011d3 507 */
sahilmgandhi 18:6a4db94011d3 508 #define RAIL_MAX_LBT_TRIES 15
sahilmgandhi 18:6a4db94011d3 509
sahilmgandhi 18:6a4db94011d3 510 /**
sahilmgandhi 18:6a4db94011d3 511 * @struct RAIL_CsmaConfig_t
sahilmgandhi 18:6a4db94011d3 512 * @brief This structure is used to configure the CSMA algorithm. When using
sahilmgandhi 18:6a4db94011d3 513 * the built-in RAIL_PreTxCsma() algorithm as your pre-transmit hook within
sahilmgandhi 18:6a4db94011d3 514 * RAIL_TxStart(), an instance of this structure must be passed as its
sahilmgandhi 18:6a4db94011d3 515 * argument.
sahilmgandhi 18:6a4db94011d3 516 */
sahilmgandhi 18:6a4db94011d3 517 typedef struct RAIL_CsmaConfig {
sahilmgandhi 18:6a4db94011d3 518 /**
sahilmgandhi 18:6a4db94011d3 519 * Minimum (starting) exponent for CSMA backoff (2^exp - 1)
sahilmgandhi 18:6a4db94011d3 520 */
sahilmgandhi 18:6a4db94011d3 521 uint8_t csmaMinBoExp;
sahilmgandhi 18:6a4db94011d3 522 /**
sahilmgandhi 18:6a4db94011d3 523 * Maximum exponent for CSMA backoff
sahilmgandhi 18:6a4db94011d3 524 */
sahilmgandhi 18:6a4db94011d3 525 uint8_t csmaMaxBoExp;
sahilmgandhi 18:6a4db94011d3 526 /**
sahilmgandhi 18:6a4db94011d3 527 * Number of CCA failures before report CCA_FAIL. With a maximum value defined
sahilmgandhi 18:6a4db94011d3 528 * in @ref RAIL_MAX_LBT_TRIES). A value of 0 will perform no CCA assessments,
sahilmgandhi 18:6a4db94011d3 529 * and always transmit immediately.
sahilmgandhi 18:6a4db94011d3 530 */
sahilmgandhi 18:6a4db94011d3 531 uint8_t csmaTries;
sahilmgandhi 18:6a4db94011d3 532 /**
sahilmgandhi 18:6a4db94011d3 533 * The CCA RSSI threshold, in dBm, above which the channel is
sahilmgandhi 18:6a4db94011d3 534 * considered 'busy'.
sahilmgandhi 18:6a4db94011d3 535 */
sahilmgandhi 18:6a4db94011d3 536 int8_t ccaThreshold;
sahilmgandhi 18:6a4db94011d3 537 /**
sahilmgandhi 18:6a4db94011d3 538 * The backoff unit period, in RAIL's microsecond time base. This is
sahilmgandhi 18:6a4db94011d3 539 * mulitiplied by the random backoff exponential controlled by @ref
sahilmgandhi 18:6a4db94011d3 540 * csmaMinBoExp and @ref csmaMaxBoExp to determine the overall backoff
sahilmgandhi 18:6a4db94011d3 541 * period. For random backoffs, any value above 511 microseconds will
sahilmgandhi 18:6a4db94011d3 542 * be truncated; for fixed backoffs it can go up to 65535 microseconds.
sahilmgandhi 18:6a4db94011d3 543 */
sahilmgandhi 18:6a4db94011d3 544 uint16_t ccaBackoff;
sahilmgandhi 18:6a4db94011d3 545 /**
sahilmgandhi 18:6a4db94011d3 546 * CCA check duration in microseconds.
sahilmgandhi 18:6a4db94011d3 547 */
sahilmgandhi 18:6a4db94011d3 548 uint16_t ccaDuration;
sahilmgandhi 18:6a4db94011d3 549 /**
sahilmgandhi 18:6a4db94011d3 550 * An overall timeout, in RAIL's microsecond time base, for the operation. If
sahilmgandhi 18:6a4db94011d3 551 * transmission doesn't start before this timeout expires, the transmission
sahilmgandhi 18:6a4db94011d3 552 * will fail. A value of 0 means no timeout is imposed.
sahilmgandhi 18:6a4db94011d3 553 */
sahilmgandhi 18:6a4db94011d3 554 uint32_t csmaTimeout;
sahilmgandhi 18:6a4db94011d3 555 } RAIL_CsmaConfig_t;
sahilmgandhi 18:6a4db94011d3 556
sahilmgandhi 18:6a4db94011d3 557 /**
sahilmgandhi 18:6a4db94011d3 558 * @def RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA
sahilmgandhi 18:6a4db94011d3 559 * @brief RAIL_CsmaConfig_t initializer configuring CSMA per 802.15.4-2003
sahilmgandhi 18:6a4db94011d3 560 * on 2.4 GHz OSPSK, commonly used by ZigBee.
sahilmgandhi 18:6a4db94011d3 561 */
sahilmgandhi 18:6a4db94011d3 562 #define RAIL_CSMA_CONFIG_802_15_4_2003_2p4_GHz_OQPSK_CSMA { \
sahilmgandhi 18:6a4db94011d3 563 /* CSMA per 802.15.4-2003 on 2.4 GHz OSPSK, commonly used by ZigBee */ \
sahilmgandhi 18:6a4db94011d3 564 /* csmaMinBoExp */ 3, /* 2^3-1 for 0..7 backoffs on 1st try */ \
sahilmgandhi 18:6a4db94011d3 565 /* csmaMaxBoExp */ 5, /* 2^5-1 for 0..31 backoffs on 3rd+ tries */ \
sahilmgandhi 18:6a4db94011d3 566 /* csmaTries */ 5, /* 5 tries overall (4 re-tries) */ \
sahilmgandhi 18:6a4db94011d3 567 /* ccaThreshold */ -75, /* 10 dB above sensitivity */ \
sahilmgandhi 18:6a4db94011d3 568 /* ccaBackoff */ 320, /* 20 symbols at 16 us/symbol */ \
sahilmgandhi 18:6a4db94011d3 569 /* ccaDuration */ 128, /* 8 symbols at 16 us/symbol */ \
sahilmgandhi 18:6a4db94011d3 570 /* csmaTimeout */ 0, /* no timeout */ \
sahilmgandhi 18:6a4db94011d3 571 }
sahilmgandhi 18:6a4db94011d3 572
sahilmgandhi 18:6a4db94011d3 573 /**
sahilmgandhi 18:6a4db94011d3 574 * @def RAIL_CSMA_CONFIG_SINGLE_CCA
sahilmgandhi 18:6a4db94011d3 575 * @brief RAIL_CsmaConfig_t initializer configuring a single CCA prior to Tx.
sahilmgandhi 18:6a4db94011d3 576 * Can be used to as a basis for implementing other channel access schemes
sahilmgandhi 18:6a4db94011d3 577 * with custom backoff delays. User can override ccaBackoff with a fixed
sahilmgandhi 18:6a4db94011d3 578 * delay on each use.
sahilmgandhi 18:6a4db94011d3 579 */
sahilmgandhi 18:6a4db94011d3 580 #define RAIL_CSMA_CONFIG_SINGLE_CCA { \
sahilmgandhi 18:6a4db94011d3 581 /* Perform a single CCA after 'fixed' delay */ \
sahilmgandhi 18:6a4db94011d3 582 /* csmaMinBoExp */ 0, /* Used for fixed backoff */ \
sahilmgandhi 18:6a4db94011d3 583 /* csmaMaxBoExp */ 0, /* Used for fixed backoff */ \
sahilmgandhi 18:6a4db94011d3 584 /* csmaTries */ 1, /* Single try */ \
sahilmgandhi 18:6a4db94011d3 585 /* ccaThreshold */ -75, /* Override if not desired choice */ \
sahilmgandhi 18:6a4db94011d3 586 /* ccaBackoff */ 0, /* No backoff (override with fixed value) */ \
sahilmgandhi 18:6a4db94011d3 587 /* ccaDuration */ 128, /* Override if not desired length */ \
sahilmgandhi 18:6a4db94011d3 588 /* csmaTimeout */ 0, /* no timeout */ \
sahilmgandhi 18:6a4db94011d3 589 }
sahilmgandhi 18:6a4db94011d3 590
sahilmgandhi 18:6a4db94011d3 591 /**
sahilmgandhi 18:6a4db94011d3 592 * @struct RAIL_LbtConfig_t
sahilmgandhi 18:6a4db94011d3 593 * @brief This structure is used to configure the LBT algorithm. When using
sahilmgandhi 18:6a4db94011d3 594 * the built-in RAIL_PreTxLbt() algorithm as your pre-transmit hook within
sahilmgandhi 18:6a4db94011d3 595 * RAIL_TxStart(), an instance of this structure must be passed as its
sahilmgandhi 18:6a4db94011d3 596 * argument.
sahilmgandhi 18:6a4db94011d3 597 */
sahilmgandhi 18:6a4db94011d3 598 typedef struct RAIL_LbtConfig {
sahilmgandhi 18:6a4db94011d3 599 /**
sahilmgandhi 18:6a4db94011d3 600 * Maximum backoff random multiplier
sahilmgandhi 18:6a4db94011d3 601 */
sahilmgandhi 18:6a4db94011d3 602 uint8_t lbtMinBoRand;
sahilmgandhi 18:6a4db94011d3 603 /**
sahilmgandhi 18:6a4db94011d3 604 * Maximum backoff random multiplier
sahilmgandhi 18:6a4db94011d3 605 */
sahilmgandhi 18:6a4db94011d3 606 uint8_t lbtMaxBoRand;
sahilmgandhi 18:6a4db94011d3 607 /**
sahilmgandhi 18:6a4db94011d3 608 * Number of CCA failures before report CCA_FAIL. With a maximum value defined
sahilmgandhi 18:6a4db94011d3 609 * in @ref RAIL_MAX_LBT_TRIES). A value of 0 will perform no CCA assessments,
sahilmgandhi 18:6a4db94011d3 610 * and always transmit immediately.
sahilmgandhi 18:6a4db94011d3 611 */
sahilmgandhi 18:6a4db94011d3 612 uint8_t lbtTries;
sahilmgandhi 18:6a4db94011d3 613 /**
sahilmgandhi 18:6a4db94011d3 614 * The CCA RSSI threshold, in dBm, above which the channel is
sahilmgandhi 18:6a4db94011d3 615 * considered 'busy'.
sahilmgandhi 18:6a4db94011d3 616 */
sahilmgandhi 18:6a4db94011d3 617 int8_t lbtThreshold;
sahilmgandhi 18:6a4db94011d3 618 /**
sahilmgandhi 18:6a4db94011d3 619 * The backoff unit period, in RAIL's microsecond time base. This is
sahilmgandhi 18:6a4db94011d3 620 * mulitiplied by the random backoff multiplier controlled by @ref
sahilmgandhi 18:6a4db94011d3 621 * lbtMinBoRand and @ref lbtMaxBoRand to determine the overall backoff
sahilmgandhi 18:6a4db94011d3 622 * period. For random backoffs, any value above 511 microseconds will
sahilmgandhi 18:6a4db94011d3 623 * be truncated; for fixed backoffs it can go up to 65535 microseconds.
sahilmgandhi 18:6a4db94011d3 624 */
sahilmgandhi 18:6a4db94011d3 625 uint16_t lbtBackoff;
sahilmgandhi 18:6a4db94011d3 626 /**
sahilmgandhi 18:6a4db94011d3 627 * LBT check duration in microseconds.
sahilmgandhi 18:6a4db94011d3 628 */
sahilmgandhi 18:6a4db94011d3 629 uint16_t lbtDuration;
sahilmgandhi 18:6a4db94011d3 630 /**
sahilmgandhi 18:6a4db94011d3 631 * An overall timeout, in RAIL's microsecond time base, for the
sahilmgandhi 18:6a4db94011d3 632 * operation. If transmission doesn't start before this timeout expires, the
sahilmgandhi 18:6a4db94011d3 633 * transmission will fail. This is important for limiting LBT due to LBT's
sahilmgandhi 18:6a4db94011d3 634 * unbounded requirement that if the channel is busy, the next try must wait
sahilmgandhi 18:6a4db94011d3 635 * for the channel to clear. A value of 0 means no timeout is imposed.
sahilmgandhi 18:6a4db94011d3 636 */
sahilmgandhi 18:6a4db94011d3 637 uint32_t lbtTimeout;
sahilmgandhi 18:6a4db94011d3 638 } RAIL_LbtConfig_t;
sahilmgandhi 18:6a4db94011d3 639
sahilmgandhi 18:6a4db94011d3 640 /**
sahilmgandhi 18:6a4db94011d3 641 * @def RAIL_LBT_CONFIG_ETSI_EN_300_220_1_V2_4_1
sahilmgandhi 18:6a4db94011d3 642 * @brief RAIL_LbtConfig_t initializer configuring LBT per ETSI 300 220-1
sahilmgandhi 18:6a4db94011d3 643 * V2.4.1 for a typical Sub-GHz band. To be practical, user should override
sahilmgandhi 18:6a4db94011d3 644 * lbtTries and/or lbtTimeout so channel access failure will be reported in a
sahilmgandhi 18:6a4db94011d3 645 * reasonable timeframe rather than the unbounded timeframe ETSI defined.
sahilmgandhi 18:6a4db94011d3 646 */
sahilmgandhi 18:6a4db94011d3 647 #define RAIL_LBT_CONFIG_ETSI_EN_300_220_1_V2_4_1 { \
sahilmgandhi 18:6a4db94011d3 648 /* LBT per ETSI 300 220-1 V2.4.1 */ \
sahilmgandhi 18:6a4db94011d3 649 /* LBT time = random backoff of 0-5ms in 0.5ms increments plus 5ms fixed */ \
sahilmgandhi 18:6a4db94011d3 650 /* lbtMinBoRand */ 0, /* */ \
sahilmgandhi 18:6a4db94011d3 651 /* lbtMaxBoRand */ 10, /* */ \
sahilmgandhi 18:6a4db94011d3 652 /* lbtTries */ RAIL_MAX_LBT_TRIES, /* the maximum supported */ \
sahilmgandhi 18:6a4db94011d3 653 /* lbtThreshold */ -87, /* */ \
sahilmgandhi 18:6a4db94011d3 654 /* lbtBackoff */ 500, /* 0.5 ms */ \
sahilmgandhi 18:6a4db94011d3 655 /* lbtDuration */ 5000, /* 5 ms */ \
sahilmgandhi 18:6a4db94011d3 656 /* lbtTimeout */ 0, /* no timeout (recommend user override) */ \
sahilmgandhi 18:6a4db94011d3 657 }
sahilmgandhi 18:6a4db94011d3 658
sahilmgandhi 18:6a4db94011d3 659 /**
sahilmgandhi 18:6a4db94011d3 660 * @}
sahilmgandhi 18:6a4db94011d3 661 */
sahilmgandhi 18:6a4db94011d3 662
sahilmgandhi 18:6a4db94011d3 663 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 664 // Tx/Rx Configuration Structures
sahilmgandhi 18:6a4db94011d3 665 // -----------------------------------------------------------------------------
sahilmgandhi 18:6a4db94011d3 666
sahilmgandhi 18:6a4db94011d3 667 /**
sahilmgandhi 18:6a4db94011d3 668 * @addtogroup Transmit
sahilmgandhi 18:6a4db94011d3 669 * @{
sahilmgandhi 18:6a4db94011d3 670 */
sahilmgandhi 18:6a4db94011d3 671
sahilmgandhi 18:6a4db94011d3 672 // Tx Config Callback Defines
sahilmgandhi 18:6a4db94011d3 673 /** Callback for a transmit buffer overflow event */
sahilmgandhi 18:6a4db94011d3 674 #define RAIL_TX_CONFIG_BUFFER_OVERFLOW (0x01 << 0)
sahilmgandhi 18:6a4db94011d3 675 /** Callback for a transmit buffer underflow event */
sahilmgandhi 18:6a4db94011d3 676 #define RAIL_TX_CONFIG_BUFFER_UNDERFLOW (0x01 << 1)
sahilmgandhi 18:6a4db94011d3 677 /** Callback for CCA/CSMA/LBT failure */
sahilmgandhi 18:6a4db94011d3 678 #define RAIL_TX_CONFIG_CHANNEL_BUSY (0x01 << 2)
sahilmgandhi 18:6a4db94011d3 679 /** Callback for when a Tx is aborted by the user */
sahilmgandhi 18:6a4db94011d3 680 #define RAIL_TX_CONFIG_TX_ABORTED (0x01 << 3)
sahilmgandhi 18:6a4db94011d3 681 /** Callback for when a Tx is blocked by something like PTA or RHO */
sahilmgandhi 18:6a4db94011d3 682 #define RAIL_TX_CONFIG_TX_BLOCKED (0x01 << 4)
sahilmgandhi 18:6a4db94011d3 683 /** Callback for CCA/CSMA/LBT success */
sahilmgandhi 18:6a4db94011d3 684 #define RAIL_TX_CONFIG_CHANNEL_CLEAR (0x01 << 5)
sahilmgandhi 18:6a4db94011d3 685 /** Callback for when an CCA check is being retried */
sahilmgandhi 18:6a4db94011d3 686 #define RAIL_TX_CONFIG_CCA_RETRY (0x01 << 6)
sahilmgandhi 18:6a4db94011d3 687 /** Callback for when a clear channel assessment (CCA) is begun */
sahilmgandhi 18:6a4db94011d3 688 #define RAIL_TX_CONFIG_START_CCA (0x01 << 7)
sahilmgandhi 18:6a4db94011d3 689
sahilmgandhi 18:6a4db94011d3 690 /**
sahilmgandhi 18:6a4db94011d3 691 * @struct RAIL_TxData_t
sahilmgandhi 18:6a4db94011d3 692 * @brief This structure is used to define the data to transmit. The data is copied
sahilmgandhi 18:6a4db94011d3 693 * into an RAIL space buffer so after RAIL_TxLoadData returns, the pointer
sahilmgandhi 18:6a4db94011d3 694 * can be deallocated or reused.
sahilmgandhi 18:6a4db94011d3 695 */
sahilmgandhi 18:6a4db94011d3 696 typedef struct RAIL_TxData {
sahilmgandhi 18:6a4db94011d3 697 uint8_t *dataPtr; /**< Pointer to data to transmit */
sahilmgandhi 18:6a4db94011d3 698 uint16_t dataLength; /**< Number of bytes to load into transmit buffer */
sahilmgandhi 18:6a4db94011d3 699 } RAIL_TxData_t;
sahilmgandhi 18:6a4db94011d3 700
sahilmgandhi 18:6a4db94011d3 701 /**
sahilmgandhi 18:6a4db94011d3 702 * @struct RAIL_TxPacketInfo_t
sahilmgandhi 18:6a4db94011d3 703 * @brief Information about the packet that was just transmitted.
sahilmgandhi 18:6a4db94011d3 704 */
sahilmgandhi 18:6a4db94011d3 705 typedef struct RAIL_TxPacketInfo {
sahilmgandhi 18:6a4db94011d3 706 /**
sahilmgandhi 18:6a4db94011d3 707 * Timestamp of the transmitted packet in the RAIL timebase of microseconds.
sahilmgandhi 18:6a4db94011d3 708 * The time is the end of the last bit of the transmitted packet.
sahilmgandhi 18:6a4db94011d3 709 */
sahilmgandhi 18:6a4db94011d3 710 uint32_t timeUs;
sahilmgandhi 18:6a4db94011d3 711 } RAIL_TxPacketInfo_t;
sahilmgandhi 18:6a4db94011d3 712
sahilmgandhi 18:6a4db94011d3 713 /**
sahilmgandhi 18:6a4db94011d3 714 * @struct RAIL_TxOptions_t
sahilmgandhi 18:6a4db94011d3 715 * @brief Tx Option structure that modifies the transmit. Only applies to one
sahilmgandhi 18:6a4db94011d3 716 * transmit.
sahilmgandhi 18:6a4db94011d3 717 */
sahilmgandhi 18:6a4db94011d3 718 typedef struct RAIL_TxOptions {
sahilmgandhi 18:6a4db94011d3 719 /**
sahilmgandhi 18:6a4db94011d3 720 * Configure if radio should wait for ack after transmit. waitForAck is only
sahilmgandhi 18:6a4db94011d3 721 * honored if Auto Ack is enabled and if Auto Ack Tx is not paused
sahilmgandhi 18:6a4db94011d3 722 */
sahilmgandhi 18:6a4db94011d3 723 bool waitForAck;
sahilmgandhi 18:6a4db94011d3 724 } RAIL_TxOptions_t;
sahilmgandhi 18:6a4db94011d3 725
sahilmgandhi 18:6a4db94011d3 726 /**
sahilmgandhi 18:6a4db94011d3 727 * @}
sahilmgandhi 18:6a4db94011d3 728 */
sahilmgandhi 18:6a4db94011d3 729
sahilmgandhi 18:6a4db94011d3 730 /**
sahilmgandhi 18:6a4db94011d3 731 * @addtogroup Receive
sahilmgandhi 18:6a4db94011d3 732 * @{
sahilmgandhi 18:6a4db94011d3 733 */
sahilmgandhi 18:6a4db94011d3 734
sahilmgandhi 18:6a4db94011d3 735 // Rx Config Callback Defines
sahilmgandhi 18:6a4db94011d3 736 /** Callback for when more is read from the Rx buffer than is available */
sahilmgandhi 18:6a4db94011d3 737 #define RAIL_RX_CONFIG_BUFFER_UNDERFLOW (0x01 << 0)
sahilmgandhi 18:6a4db94011d3 738 /** Callback for preamble detection */
sahilmgandhi 18:6a4db94011d3 739 #define RAIL_RX_CONFIG_PREAMBLE_DETECT (0x01 << 1)
sahilmgandhi 18:6a4db94011d3 740 /** Callback for detection of the first sync word */
sahilmgandhi 18:6a4db94011d3 741 #define RAIL_RX_CONFIG_SYNC1_DETECT (0x01 << 2)
sahilmgandhi 18:6a4db94011d3 742 /** Callback for detection of the second sync word */
sahilmgandhi 18:6a4db94011d3 743 #define RAIL_RX_CONFIG_SYNC2_DETECT (0x01 << 3)
sahilmgandhi 18:6a4db94011d3 744 /** Callback for detection of frame errors
sahilmgandhi 18:6a4db94011d3 745 *
sahilmgandhi 18:6a4db94011d3 746 * For efr32xg1x parts, frame errors include violations of variable length
sahilmgandhi 18:6a4db94011d3 747 * min/max limits, frame coding errors, and crc errors. If \ref
sahilmgandhi 18:6a4db94011d3 748 * RAIL_IGNORE_CRC_ERRORS are set, \ref RAIL_RX_CONFIG_FRAME_ERROR will not be
sahilmgandhi 18:6a4db94011d3 749 * asserted for crc errors.
sahilmgandhi 18:6a4db94011d3 750 */
sahilmgandhi 18:6a4db94011d3 751 #define RAIL_RX_CONFIG_FRAME_ERROR (0x01 << 4)
sahilmgandhi 18:6a4db94011d3 752 /** Callback for when we run out of Rx buffer space */
sahilmgandhi 18:6a4db94011d3 753 #define RAIL_RX_CONFIG_BUFFER_OVERFLOW (0x01 << 5)
sahilmgandhi 18:6a4db94011d3 754 /** Callback for when a packet is address filtered */
sahilmgandhi 18:6a4db94011d3 755 #define RAIL_RX_CONFIG_ADDRESS_FILTERED (0x01 << 6)
sahilmgandhi 18:6a4db94011d3 756 /** Callback for RF Sensed */
sahilmgandhi 18:6a4db94011d3 757 #define RAIL_RX_CONFIG_RF_SENSED (0x01 << 7)
sahilmgandhi 18:6a4db94011d3 758 /** Callback for when an Rx event times out */
sahilmgandhi 18:6a4db94011d3 759 #define RAIL_RX_CONFIG_TIMEOUT (0x01 << 8)
sahilmgandhi 18:6a4db94011d3 760 /** Callback for when the scheduled Rx window ends */
sahilmgandhi 18:6a4db94011d3 761 #define RAIL_RX_CONFIG_SCHEDULED_RX_END (0x01 << 9)
sahilmgandhi 18:6a4db94011d3 762 /** Callback for an aborted packet. This is triggered when a more specific
sahilmgandhi 18:6a4db94011d3 763 * reason the packet was aborted, such as RAIL_RX_CONFIG_ADDRESS_FILTERED, is
sahilmgandhi 18:6a4db94011d3 764 * not known. */
sahilmgandhi 18:6a4db94011d3 765 #define RAIL_RX_CONFIG_PACKET_ABORTED (0x01 << 10)
sahilmgandhi 18:6a4db94011d3 766 /**
sahilmgandhi 18:6a4db94011d3 767 * Callback for when the packet has passed any configured address and frame
sahilmgandhi 18:6a4db94011d3 768 * filtering options.
sahilmgandhi 18:6a4db94011d3 769 */
sahilmgandhi 18:6a4db94011d3 770 #define RAIL_RX_CONFIG_FILTER_PASSED (0x01 << 11)
sahilmgandhi 18:6a4db94011d3 771
sahilmgandhi 18:6a4db94011d3 772 /** To maintain backwards compatibility with RAIL 1.1,
sahilmgandhi 18:6a4db94011d3 773 * RAIL_RX_CONFIG_INVALID_CRC is the same as RAIL_RX_CONFIG_FRAME_ERROR
sahilmgandhi 18:6a4db94011d3 774 */
sahilmgandhi 18:6a4db94011d3 775 #define RAIL_RX_CONFIG_INVALID_CRC RAIL_RX_CONFIG_FRAME_ERROR
sahilmgandhi 18:6a4db94011d3 776
sahilmgandhi 18:6a4db94011d3 777 // Rx Option Defines
sahilmgandhi 18:6a4db94011d3 778 /** Option to configure whether the CRC portion of the packet is included in
sahilmgandhi 18:6a4db94011d3 779 * the dataPtr field of the RAIL_RxPacketInfo_t passed via
sahilmgandhi 18:6a4db94011d3 780 * RAILCb_RxPacketReceived(). Defaults to false. */
sahilmgandhi 18:6a4db94011d3 781 #define RAIL_RX_OPTION_STORE_CRC (1 << 0)
sahilmgandhi 18:6a4db94011d3 782
sahilmgandhi 18:6a4db94011d3 783 // Rx Config Ignore Error Defines
sahilmgandhi 18:6a4db94011d3 784 /**
sahilmgandhi 18:6a4db94011d3 785 * Ignore no errors.
sahilmgandhi 18:6a4db94011d3 786 *
sahilmgandhi 18:6a4db94011d3 787 * Drop all packets with errors. With this setting, crc errors will generate a
sahilmgandhi 18:6a4db94011d3 788 * RAILCb_RxRadioStatus() with \ref RAIL_RX_CONFIG_FRAME_ERROR.
sahilmgandhi 18:6a4db94011d3 789 */
sahilmgandhi 18:6a4db94011d3 790 #define RAIL_IGNORE_NO_ERRORS (0x00)
sahilmgandhi 18:6a4db94011d3 791 /**
sahilmgandhi 18:6a4db94011d3 792 * Hardware ignores CRC errors.
sahilmgandhi 18:6a4db94011d3 793 *
sahilmgandhi 18:6a4db94011d3 794 * When this setting is enabled and a CRC error occurs, RAILCb_RxRadioStatus()
sahilmgandhi 18:6a4db94011d3 795 * with \ref RAIL_RX_CONFIG_FRAME_ERROR will not occur. Instead packets with crc
sahilmgandhi 18:6a4db94011d3 796 * errors will generate RAILCb_RxPacketReceived().
sahilmgandhi 18:6a4db94011d3 797 */
sahilmgandhi 18:6a4db94011d3 798 #define RAIL_IGNORE_CRC_ERRORS (0x01 << 0)
sahilmgandhi 18:6a4db94011d3 799 /** Ignore all possible errors. Receive all possible packets */
sahilmgandhi 18:6a4db94011d3 800 #define RAIL_IGNORE_ALL_ERRORS (0xFF)
sahilmgandhi 18:6a4db94011d3 801
sahilmgandhi 18:6a4db94011d3 802 /** The value returned by RAIL for an invalid RSSI: (-128 * 4) quarter dBm */
sahilmgandhi 18:6a4db94011d3 803 #define RAIL_RSSI_INVALID ((int16_t)(-128 * 4))
sahilmgandhi 18:6a4db94011d3 804
sahilmgandhi 18:6a4db94011d3 805 /**
sahilmgandhi 18:6a4db94011d3 806 * @struct RAIL_AppendedInfo_t
sahilmgandhi 18:6a4db94011d3 807 * @brief Appended info structure that is returned in the RAILCb_RxPacketReceived
sahilmgandhi 18:6a4db94011d3 808 * callback
sahilmgandhi 18:6a4db94011d3 809 *
sahilmgandhi 18:6a4db94011d3 810 * @todo Define where the rssi latch point is. Is it configurable?
sahilmgandhi 18:6a4db94011d3 811 */
sahilmgandhi 18:6a4db94011d3 812 typedef struct RAIL_AppendedInfo {
sahilmgandhi 18:6a4db94011d3 813 /**
sahilmgandhi 18:6a4db94011d3 814 * Timestamp of the received packet in the RAIL timebase of microseconds. The
sahilmgandhi 18:6a4db94011d3 815 * time is the end of the sync word of the received packet.
sahilmgandhi 18:6a4db94011d3 816 */
sahilmgandhi 18:6a4db94011d3 817 uint32_t timeUs;
sahilmgandhi 18:6a4db94011d3 818 /**
sahilmgandhi 18:6a4db94011d3 819 * Indicates whether the CRC passed or failed for the receive packet. This
sahilmgandhi 18:6a4db94011d3 820 * will be set to 0 for fail and 1 for pass.
sahilmgandhi 18:6a4db94011d3 821 */
sahilmgandhi 18:6a4db94011d3 822 bool crcStatus:1;
sahilmgandhi 18:6a4db94011d3 823 /**
sahilmgandhi 18:6a4db94011d3 824 * Indicates whether frame coding found any errors in the receive packet.
sahilmgandhi 18:6a4db94011d3 825 * This will be set to 0 for fail and 1 for pass.
sahilmgandhi 18:6a4db94011d3 826 */
sahilmgandhi 18:6a4db94011d3 827 bool frameCodingStatus:1;
sahilmgandhi 18:6a4db94011d3 828 /**
sahilmgandhi 18:6a4db94011d3 829 * Indicates if the received packet is an ack. An 'ack' is defined as a
sahilmgandhi 18:6a4db94011d3 830 * packet received during the rx ack window when autoack is enabled.
sahilmgandhi 18:6a4db94011d3 831 * Set to 0 for not an ack, and 1 for is an ack. Will always be 0 if
sahilmgandhi 18:6a4db94011d3 832 * autoack is not enabled.
sahilmgandhi 18:6a4db94011d3 833 */
sahilmgandhi 18:6a4db94011d3 834 bool isAck:1;
sahilmgandhi 18:6a4db94011d3 835 /**
sahilmgandhi 18:6a4db94011d3 836 * RSSI of the received packet in integer dBm. This is latched when the sync
sahilmgandhi 18:6a4db94011d3 837 * word is detected for this packet.
sahilmgandhi 18:6a4db94011d3 838 */
sahilmgandhi 18:6a4db94011d3 839 int8_t rssiLatch;
sahilmgandhi 18:6a4db94011d3 840 /**
sahilmgandhi 18:6a4db94011d3 841 * Link quality indicator of the received packet. This is calculated as the
sahilmgandhi 18:6a4db94011d3 842 * average correlation for the first 8 symbols in a frame.
sahilmgandhi 18:6a4db94011d3 843 */
sahilmgandhi 18:6a4db94011d3 844 uint8_t lqi;
sahilmgandhi 18:6a4db94011d3 845 /**
sahilmgandhi 18:6a4db94011d3 846 * For radios and PHY configurations that support multiple sync words this
sahilmgandhi 18:6a4db94011d3 847 * number will be the ID of the sync word that was used for this packet.
sahilmgandhi 18:6a4db94011d3 848 */
sahilmgandhi 18:6a4db94011d3 849 uint8_t syncWordId;
sahilmgandhi 18:6a4db94011d3 850 } RAIL_AppendedInfo_t;
sahilmgandhi 18:6a4db94011d3 851
sahilmgandhi 18:6a4db94011d3 852 /**
sahilmgandhi 18:6a4db94011d3 853 * @struct RAIL_RxPacketInfo_t
sahilmgandhi 18:6a4db94011d3 854 * @brief Receive packet information structure
sahilmgandhi 18:6a4db94011d3 855 *
sahilmgandhi 18:6a4db94011d3 856 * The structure used to pass an over the air packet and some associated
sahilmgandhi 18:6a4db94011d3 857 * information up to the application code. The memory handle that you receive
sahilmgandhi 18:6a4db94011d3 858 * in the call to RAILCb_RxPacketReceived() will contain this data structure.
sahilmgandhi 18:6a4db94011d3 859 */
sahilmgandhi 18:6a4db94011d3 860 typedef struct RAIL_RxPacketInfo {
sahilmgandhi 18:6a4db94011d3 861 /**
sahilmgandhi 18:6a4db94011d3 862 * A structure containing the extra information associated with this received
sahilmgandhi 18:6a4db94011d3 863 * packet.
sahilmgandhi 18:6a4db94011d3 864 */
sahilmgandhi 18:6a4db94011d3 865 RAIL_AppendedInfo_t appendedInfo;
sahilmgandhi 18:6a4db94011d3 866 /**
sahilmgandhi 18:6a4db94011d3 867 * The number of bytes that are in the dataPtr array.
sahilmgandhi 18:6a4db94011d3 868 */
sahilmgandhi 18:6a4db94011d3 869 uint16_t dataLength;
sahilmgandhi 18:6a4db94011d3 870 /**
sahilmgandhi 18:6a4db94011d3 871 * A variable length array holding the receive packet data bytes.
sahilmgandhi 18:6a4db94011d3 872 */
sahilmgandhi 18:6a4db94011d3 873 uint8_t dataPtr[];
sahilmgandhi 18:6a4db94011d3 874 } RAIL_RxPacketInfo_t;
sahilmgandhi 18:6a4db94011d3 875
sahilmgandhi 18:6a4db94011d3 876 /**
sahilmgandhi 18:6a4db94011d3 877 * @struct RAIL_ScheduleRxConfig_t
sahilmgandhi 18:6a4db94011d3 878 * @brief This structure is used to configure the Scheduled Rx algorithm.
sahilmgandhi 18:6a4db94011d3 879 *
sahilmgandhi 18:6a4db94011d3 880 * It allows you to define the start and end times of the receive window created
sahilmgandhi 18:6a4db94011d3 881 * for scheduled receive. If either start or end times are disabled then they
sahilmgandhi 18:6a4db94011d3 882 * will be ignored.
sahilmgandhi 18:6a4db94011d3 883 */
sahilmgandhi 18:6a4db94011d3 884 typedef struct RAIL_ScheduleRxConfig {
sahilmgandhi 18:6a4db94011d3 885 /**
sahilmgandhi 18:6a4db94011d3 886 * The time to start receive. See startMode for more information about they
sahilmgandhi 18:6a4db94011d3 887 * types of start times that you can specify.
sahilmgandhi 18:6a4db94011d3 888 */
sahilmgandhi 18:6a4db94011d3 889 uint32_t start;
sahilmgandhi 18:6a4db94011d3 890 /**
sahilmgandhi 18:6a4db94011d3 891 * How to interpret the time value specified in the start parameter. See the
sahilmgandhi 18:6a4db94011d3 892 * \ref RAIL_TimeMode_t documentation for more information. Use
sahilmgandhi 18:6a4db94011d3 893 * \ref RAIL_TIME_ABSOLUTE for absolute times, \ref RAIL_TIME_DELAY for times
sahilmgandhi 18:6a4db94011d3 894 * relative to now, and \ref RAIL_TIME_DISABLED to ignore the start time.
sahilmgandhi 18:6a4db94011d3 895 */
sahilmgandhi 18:6a4db94011d3 896 RAIL_TimeMode_t startMode;
sahilmgandhi 18:6a4db94011d3 897 /**
sahilmgandhi 18:6a4db94011d3 898 * The time to end receive. See endMode for more information about the types
sahilmgandhi 18:6a4db94011d3 899 * of end times you can specify.
sahilmgandhi 18:6a4db94011d3 900 */
sahilmgandhi 18:6a4db94011d3 901 uint32_t end;
sahilmgandhi 18:6a4db94011d3 902 /**
sahilmgandhi 18:6a4db94011d3 903 * How to interpret the time value specified in the end parameter. See the
sahilmgandhi 18:6a4db94011d3 904 * \ref RAIL_TimeMode_t documentation for more information. Note that in this
sahilmgandhi 18:6a4db94011d3 905 * API if you specify a \ref RAIL_TIME_DELAY it will be relative to the start
sahilmgandhi 18:6a4db94011d3 906 * time if given and relative to now if none is specified. Also, using \ref
sahilmgandhi 18:6a4db94011d3 907 * RAIL_TIME_DISABLED means that this window will not end unless you
sahilmgandhi 18:6a4db94011d3 908 * explicitly call RAIL_RfIdle() or add an end event through a future update
sahilmgandhi 18:6a4db94011d3 909 * to this configuration.
sahilmgandhi 18:6a4db94011d3 910 */
sahilmgandhi 18:6a4db94011d3 911 RAIL_TimeMode_t endMode;
sahilmgandhi 18:6a4db94011d3 912 /**
sahilmgandhi 18:6a4db94011d3 913 * While in scheduled Rx you are still able to control the radio state via
sahilmgandhi 18:6a4db94011d3 914 * state transitions. This option allows you to configure whether a transition
sahilmgandhi 18:6a4db94011d3 915 * to Rx goes back to scheduled Rx or to the normal Rx state. Once in the
sahilmgandhi 18:6a4db94011d3 916 * normal Rx state you will effectively end the scheduled Rx window and can
sahilmgandhi 18:6a4db94011d3 917 * continue to receive indefinitely depending on your state transitions. Set
sahilmgandhi 18:6a4db94011d3 918 * this to 1 to transition to normal Rx and 0 to stay in scheduled Rx.
sahilmgandhi 18:6a4db94011d3 919 */
sahilmgandhi 18:6a4db94011d3 920 uint8_t rxTransitionEndSchedule;
sahilmgandhi 18:6a4db94011d3 921 /**
sahilmgandhi 18:6a4db94011d3 922 * If set to 0 this will allow any packets being received when the window end
sahilmgandhi 18:6a4db94011d3 923 * event occurs to complete. If set to anything else we will force an abort of
sahilmgandhi 18:6a4db94011d3 924 * any packets being received when the window end occurs.
sahilmgandhi 18:6a4db94011d3 925 */
sahilmgandhi 18:6a4db94011d3 926 uint8_t hardWindowEnd;
sahilmgandhi 18:6a4db94011d3 927 } RAIL_ScheduleRxConfig_t;
sahilmgandhi 18:6a4db94011d3 928
sahilmgandhi 18:6a4db94011d3 929 /**
sahilmgandhi 18:6a4db94011d3 930 * @}
sahilmgandhi 18:6a4db94011d3 931 */
sahilmgandhi 18:6a4db94011d3 932
sahilmgandhi 18:6a4db94011d3 933 /**
sahilmgandhi 18:6a4db94011d3 934 * @addtogroup Auto_Ack
sahilmgandhi 18:6a4db94011d3 935 * @{
sahilmgandhi 18:6a4db94011d3 936 */
sahilmgandhi 18:6a4db94011d3 937 /**
sahilmgandhi 18:6a4db94011d3 938 * @struct RAIL_AutoAckConfig_t
sahilmgandhi 18:6a4db94011d3 939 * @brief This structure is used to configure the Auto Ack algorithm. The
sahilmgandhi 18:6a4db94011d3 940 * structure provides a defaultState for the radio to return to once an ack
sahilmgandhi 18:6a4db94011d3 941 * operation occurs (transmitting or attempting to receive an ack). Regardless
sahilmgandhi 18:6a4db94011d3 942 * if the ack operation was successful, the radio will return to the specified
sahilmgandhi 18:6a4db94011d3 943 * default state.
sahilmgandhi 18:6a4db94011d3 944 *
sahilmgandhi 18:6a4db94011d3 945 * The other parameters configure auto ack timing. The application can specify
sahilmgandhi 18:6a4db94011d3 946 * timing from when the radio is idle to TX/RX, the turnaround time from TX->RX
sahilmgandhi 18:6a4db94011d3 947 * and RX->TX, and finally the total amount of time to look for an ack. All of
sahilmgandhi 18:6a4db94011d3 948 * these timing parameters are in microseconds.
sahilmgandhi 18:6a4db94011d3 949 */
sahilmgandhi 18:6a4db94011d3 950 typedef struct RAIL_AutoAckConfig {
sahilmgandhi 18:6a4db94011d3 951 /**
sahilmgandhi 18:6a4db94011d3 952 * Default state once auto ack sequence completes or errors. Can only be
sahilmgandhi 18:6a4db94011d3 953 * RAIL_RF_STATE_RX or RAIL_RF_STATE_IDLE.
sahilmgandhi 18:6a4db94011d3 954 */
sahilmgandhi 18:6a4db94011d3 955 RAIL_RadioState_t defaultState;
sahilmgandhi 18:6a4db94011d3 956 /**
sahilmgandhi 18:6a4db94011d3 957 * Define the time from idleToTx and idleToRx in us. Limited to a max of
sahilmgandhi 18:6a4db94011d3 958 * 13ms.
sahilmgandhi 18:6a4db94011d3 959 */
sahilmgandhi 18:6a4db94011d3 960 uint16_t idleTiming;
sahilmgandhi 18:6a4db94011d3 961 /**
sahilmgandhi 18:6a4db94011d3 962 * Define the ack turnaround time in us. Limited to a max of 13ms.
sahilmgandhi 18:6a4db94011d3 963 */
sahilmgandhi 18:6a4db94011d3 964 uint16_t turnaroundTime;
sahilmgandhi 18:6a4db94011d3 965 /**
sahilmgandhi 18:6a4db94011d3 966 * Define the rx ack timeout duration in us. Limited to a max of 65.535ms.
sahilmgandhi 18:6a4db94011d3 967 */
sahilmgandhi 18:6a4db94011d3 968 uint16_t ackTimeout;
sahilmgandhi 18:6a4db94011d3 969 } RAIL_AutoAckConfig_t;
sahilmgandhi 18:6a4db94011d3 970
sahilmgandhi 18:6a4db94011d3 971 /**
sahilmgandhi 18:6a4db94011d3 972 * @struct RAIL_AutoAckData_t
sahilmgandhi 18:6a4db94011d3 973 * @brief This structure is used to define the data to use during auto
sahilmgandhi 18:6a4db94011d3 974 * acknowledgement. The data is copied into an RAIL space buffer so after
sahilmgandhi 18:6a4db94011d3 975 * RAIL_AutoAckLoadBuffer returns, the pointer can be deallocated or reused.
sahilmgandhi 18:6a4db94011d3 976 *
sahilmgandhi 18:6a4db94011d3 977 * Size limited to \ref RAIL_AUTOACK_MAX_LENGTH.
sahilmgandhi 18:6a4db94011d3 978 */
sahilmgandhi 18:6a4db94011d3 979 typedef struct RAIL_AutoAckData {
sahilmgandhi 18:6a4db94011d3 980 uint8_t *dataPtr; /**< Pointer to ack data to transmit */
sahilmgandhi 18:6a4db94011d3 981 uint8_t dataLength; /**< Number of ack bytes to transmit */
sahilmgandhi 18:6a4db94011d3 982 } RAIL_AutoAckData_t;
sahilmgandhi 18:6a4db94011d3 983
sahilmgandhi 18:6a4db94011d3 984 /// Acknowledgement packets cannot be longer than 64 bytes.
sahilmgandhi 18:6a4db94011d3 985 #define RAIL_AUTOACK_MAX_LENGTH 64
sahilmgandhi 18:6a4db94011d3 986 /**
sahilmgandhi 18:6a4db94011d3 987 * @}
sahilmgandhi 18:6a4db94011d3 988 * endofgroup AutoAck
sahilmgandhi 18:6a4db94011d3 989 */
sahilmgandhi 18:6a4db94011d3 990 /******************************************************************************
sahilmgandhi 18:6a4db94011d3 991 * Version
sahilmgandhi 18:6a4db94011d3 992 *****************************************************************************/
sahilmgandhi 18:6a4db94011d3 993 /**
sahilmgandhi 18:6a4db94011d3 994 * @addtogroup Diagnostic
sahilmgandhi 18:6a4db94011d3 995 * @{
sahilmgandhi 18:6a4db94011d3 996 */
sahilmgandhi 18:6a4db94011d3 997
sahilmgandhi 18:6a4db94011d3 998 /**
sahilmgandhi 18:6a4db94011d3 999 * @enum RAIL_StreamMode_t
sahilmgandhi 18:6a4db94011d3 1000 * @brief Possible stream output modes.
sahilmgandhi 18:6a4db94011d3 1001 */
sahilmgandhi 18:6a4db94011d3 1002 typedef enum RAIL_StreamMode {
sahilmgandhi 18:6a4db94011d3 1003 PSEUDO_RANDOM_STREAM, /**< Pseudo random stream of bytes */
sahilmgandhi 18:6a4db94011d3 1004 PN9_STREAM /**< PN9 byte sequence */
sahilmgandhi 18:6a4db94011d3 1005 } RAIL_StreamMode_t;
sahilmgandhi 18:6a4db94011d3 1006
sahilmgandhi 18:6a4db94011d3 1007 /**
sahilmgandhi 18:6a4db94011d3 1008 * @struct RAIL_BerConfig_t
sahilmgandhi 18:6a4db94011d3 1009 * @brief BER test parameters.
sahilmgandhi 18:6a4db94011d3 1010 */
sahilmgandhi 18:6a4db94011d3 1011 typedef struct RAIL_BerConfig
sahilmgandhi 18:6a4db94011d3 1012 {
sahilmgandhi 18:6a4db94011d3 1013 uint32_t bytesToTest; /**< Number of bytes to test */
sahilmgandhi 18:6a4db94011d3 1014 } RAIL_BerConfig_t;
sahilmgandhi 18:6a4db94011d3 1015
sahilmgandhi 18:6a4db94011d3 1016 /**
sahilmgandhi 18:6a4db94011d3 1017 * @struct RAIL_BerStatus_t
sahilmgandhi 18:6a4db94011d3 1018 * @brief The status of the latest bit error rate (BER) test.
sahilmgandhi 18:6a4db94011d3 1019 */
sahilmgandhi 18:6a4db94011d3 1020 typedef struct RAIL_BerStatus
sahilmgandhi 18:6a4db94011d3 1021 {
sahilmgandhi 18:6a4db94011d3 1022 uint32_t bitsTotal; /**< Number of bits to receive */
sahilmgandhi 18:6a4db94011d3 1023 uint32_t bitsTested; /**< Number of bits currently tested */
sahilmgandhi 18:6a4db94011d3 1024 uint32_t bitErrors; /**< Number of bits errors detected */
sahilmgandhi 18:6a4db94011d3 1025 int8_t rssi; /**< Latched RSSI value at pattern detect */
sahilmgandhi 18:6a4db94011d3 1026 } RAIL_BerStatus_t;
sahilmgandhi 18:6a4db94011d3 1027
sahilmgandhi 18:6a4db94011d3 1028 /**
sahilmgandhi 18:6a4db94011d3 1029 * @}
sahilmgandhi 18:6a4db94011d3 1030 */
sahilmgandhi 18:6a4db94011d3 1031
sahilmgandhi 18:6a4db94011d3 1032 #ifndef DOXYGEN_SHOULD_SKIP_THIS
sahilmgandhi 18:6a4db94011d3 1033
sahilmgandhi 18:6a4db94011d3 1034 /******************************************************************************
sahilmgandhi 18:6a4db94011d3 1035 * Debug
sahilmgandhi 18:6a4db94011d3 1036 *****************************************************************************/
sahilmgandhi 18:6a4db94011d3 1037 /**
sahilmgandhi 18:6a4db94011d3 1038 * @addtogroup Debug
sahilmgandhi 18:6a4db94011d3 1039 * @{
sahilmgandhi 18:6a4db94011d3 1040 */
sahilmgandhi 18:6a4db94011d3 1041
sahilmgandhi 18:6a4db94011d3 1042 // Debug Config Callback Defines
sahilmgandhi 18:6a4db94011d3 1043 /** Callback for radio state change */
sahilmgandhi 18:6a4db94011d3 1044 #define RAIL_DEBUG_CONFIG_STATE_CHANGE (0x01 << 1)
sahilmgandhi 18:6a4db94011d3 1045
sahilmgandhi 18:6a4db94011d3 1046 /**
sahilmgandhi 18:6a4db94011d3 1047 * @def RAIL_DEBUG_MODE_FREQ_OVERRIDE
sahilmgandhi 18:6a4db94011d3 1048 * @brief A bitmask to enable the frequency override debug mode where you can
sahilmgandhi 18:6a4db94011d3 1049 * manually tune to a specified frequency. Note that this should only be used
sahilmgandhi 18:6a4db94011d3 1050 * for testing and is not as tuned as frequencies from the calculator.
sahilmgandhi 18:6a4db94011d3 1051 */
sahilmgandhi 18:6a4db94011d3 1052 #define RAIL_DEBUG_MODE_FREQ_OVERRIDE 0x00000001UL
sahilmgandhi 18:6a4db94011d3 1053 /**
sahilmgandhi 18:6a4db94011d3 1054 * @def RAIL_DEBUG_MODE_VALID_MASK
sahilmgandhi 18:6a4db94011d3 1055 * @brief Any debug mode bits outside of this mask are invalid and ignored.
sahilmgandhi 18:6a4db94011d3 1056 */
sahilmgandhi 18:6a4db94011d3 1057 #define RAIL_DEBUG_MODE_VALID_MASK (!(RAIL_DEBUG_MODE_FREQ_OVERRIDE))
sahilmgandhi 18:6a4db94011d3 1058
sahilmgandhi 18:6a4db94011d3 1059 /**
sahilmgandhi 18:6a4db94011d3 1060 * @}
sahilmgandhi 18:6a4db94011d3 1061 */
sahilmgandhi 18:6a4db94011d3 1062 #endif
sahilmgandhi 18:6a4db94011d3 1063
sahilmgandhi 18:6a4db94011d3 1064 /**
sahilmgandhi 18:6a4db94011d3 1065 * @}
sahilmgandhi 18:6a4db94011d3 1066 * end of RAIL_API
sahilmgandhi 18:6a4db94011d3 1067 */
sahilmgandhi 18:6a4db94011d3 1068
sahilmgandhi 18:6a4db94011d3 1069 #endif // __RAIL_TYPES_H__