Mouse code for the MacroRat
mbed-dev/targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/efr32-rf-driver/rail/rail.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /***************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file rail.h |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @brief The main header file for the RAIL library. It describes the external |
sahilmgandhi | 18:6a4db94011d3 | 4 | * APIs available to a RAIL user |
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_H__ |
sahilmgandhi | 18:6a4db94011d3 | 9 | #define __RAIL_H__ |
sahilmgandhi | 18:6a4db94011d3 | 10 | |
sahilmgandhi | 18:6a4db94011d3 | 11 | // Get the standard include types |
sahilmgandhi | 18:6a4db94011d3 | 12 | #include <stdint.h> |
sahilmgandhi | 18:6a4db94011d3 | 13 | #include <stdbool.h> |
sahilmgandhi | 18:6a4db94011d3 | 14 | |
sahilmgandhi | 18:6a4db94011d3 | 15 | // Get the RAIL specific structures and types |
sahilmgandhi | 18:6a4db94011d3 | 16 | #include "rail_types.h" |
sahilmgandhi | 18:6a4db94011d3 | 17 | |
sahilmgandhi | 18:6a4db94011d3 | 18 | /** |
sahilmgandhi | 18:6a4db94011d3 | 19 | * @addtogroup RAIL_API |
sahilmgandhi | 18:6a4db94011d3 | 20 | * @brief This is the primary API layer for the Radio Abstraction Interface |
sahilmgandhi | 18:6a4db94011d3 | 21 | * Layer (RAIL) |
sahilmgandhi | 18:6a4db94011d3 | 22 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 23 | */ |
sahilmgandhi | 18:6a4db94011d3 | 24 | |
sahilmgandhi | 18:6a4db94011d3 | 25 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 26 | * General Radio Operation |
sahilmgandhi | 18:6a4db94011d3 | 27 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 28 | /** |
sahilmgandhi | 18:6a4db94011d3 | 29 | * @addtogroup General |
sahilmgandhi | 18:6a4db94011d3 | 30 | * @brief Basic APIs for setting up and interacting with the RAIL library |
sahilmgandhi | 18:6a4db94011d3 | 31 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 32 | */ |
sahilmgandhi | 18:6a4db94011d3 | 33 | |
sahilmgandhi | 18:6a4db94011d3 | 34 | /** |
sahilmgandhi | 18:6a4db94011d3 | 35 | * Get the version information for the compiled RAIL library. |
sahilmgandhi | 18:6a4db94011d3 | 36 | * |
sahilmgandhi | 18:6a4db94011d3 | 37 | * @param[in] version Pointer to \ref RAIL_Version_t struct to populate with version |
sahilmgandhi | 18:6a4db94011d3 | 38 | * information. |
sahilmgandhi | 18:6a4db94011d3 | 39 | * @param[in] verbose Populate \ref RAIL_Version_t struct with verbose information |
sahilmgandhi | 18:6a4db94011d3 | 40 | * |
sahilmgandhi | 18:6a4db94011d3 | 41 | * Version information contains a major version number, a minor version number, |
sahilmgandhi | 18:6a4db94011d3 | 42 | * and a rev (revision) number. |
sahilmgandhi | 18:6a4db94011d3 | 43 | */ |
sahilmgandhi | 18:6a4db94011d3 | 44 | void RAIL_VersionGet(RAIL_Version_t * version, bool verbose); |
sahilmgandhi | 18:6a4db94011d3 | 45 | |
sahilmgandhi | 18:6a4db94011d3 | 46 | /** |
sahilmgandhi | 18:6a4db94011d3 | 47 | * Initialize RAIL |
sahilmgandhi | 18:6a4db94011d3 | 48 | * |
sahilmgandhi | 18:6a4db94011d3 | 49 | * @param[in] railInit The initialization structure to be used for setting up |
sahilmgandhi | 18:6a4db94011d3 | 50 | * the library. This will contain memory and other options needed by RAIL. |
sahilmgandhi | 18:6a4db94011d3 | 51 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 52 | * |
sahilmgandhi | 18:6a4db94011d3 | 53 | * RF initialization sets the overall maximum packet length, the xtal frequency |
sahilmgandhi | 18:6a4db94011d3 | 54 | * of the radio, and the calibrations to perform. |
sahilmgandhi | 18:6a4db94011d3 | 55 | */ |
sahilmgandhi | 18:6a4db94011d3 | 56 | uint8_t RAIL_RfInit(const RAIL_Init_t *railInit); |
sahilmgandhi | 18:6a4db94011d3 | 57 | |
sahilmgandhi | 18:6a4db94011d3 | 58 | /** |
sahilmgandhi | 18:6a4db94011d3 | 59 | * Set protocol that RAIL outputs on PTI |
sahilmgandhi | 18:6a4db94011d3 | 60 | * |
sahilmgandhi | 18:6a4db94011d3 | 61 | * @param protocol The enum representing which protocol the node is using |
sahilmgandhi | 18:6a4db94011d3 | 62 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 63 | * |
sahilmgandhi | 18:6a4db94011d3 | 64 | * The protocol is output via the Packet Trace Interface (PTI) for each packet. |
sahilmgandhi | 18:6a4db94011d3 | 65 | * Before any protocol is set, the default value is \ref |
sahilmgandhi | 18:6a4db94011d3 | 66 | * RAIL_PTI_PROTOCOL_CUSTOM. One of the enum values should be used in order for |
sahilmgandhi | 18:6a4db94011d3 | 67 | * Network Analyzer to be able to decode the packet. |
sahilmgandhi | 18:6a4db94011d3 | 68 | */ |
sahilmgandhi | 18:6a4db94011d3 | 69 | RAIL_Status_t RAIL_SetPtiProtocol(RAIL_PtiProtocol_t protocol); |
sahilmgandhi | 18:6a4db94011d3 | 70 | |
sahilmgandhi | 18:6a4db94011d3 | 71 | /** |
sahilmgandhi | 18:6a4db94011d3 | 72 | * Callback for when the radio is finished initializing from \ref RAIL_RfInit |
sahilmgandhi | 18:6a4db94011d3 | 73 | * and is ready to be configured |
sahilmgandhi | 18:6a4db94011d3 | 74 | * |
sahilmgandhi | 18:6a4db94011d3 | 75 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 76 | * |
sahilmgandhi | 18:6a4db94011d3 | 77 | * Callback that notifies the application when the radio is finished |
sahilmgandhi | 18:6a4db94011d3 | 78 | * initializing and is ready for further configuration. This callback is |
sahilmgandhi | 18:6a4db94011d3 | 79 | * useful for potential transceiver products that require a power up sequence |
sahilmgandhi | 18:6a4db94011d3 | 80 | * before further configuration is available. After this callback fires, the |
sahilmgandhi | 18:6a4db94011d3 | 81 | * radio is ready for additional configuration before transmit and receive |
sahilmgandhi | 18:6a4db94011d3 | 82 | * operations. |
sahilmgandhi | 18:6a4db94011d3 | 83 | */ |
sahilmgandhi | 18:6a4db94011d3 | 84 | void RAILCb_RfReady(void); |
sahilmgandhi | 18:6a4db94011d3 | 85 | |
sahilmgandhi | 18:6a4db94011d3 | 86 | /** |
sahilmgandhi | 18:6a4db94011d3 | 87 | * Get the current radio state |
sahilmgandhi | 18:6a4db94011d3 | 88 | * |
sahilmgandhi | 18:6a4db94011d3 | 89 | * @return An enumeration for current radio state |
sahilmgandhi | 18:6a4db94011d3 | 90 | * |
sahilmgandhi | 18:6a4db94011d3 | 91 | * Returns the state of the radio as either TX, RX, or IDLE. There are |
sahilmgandhi | 18:6a4db94011d3 | 92 | * intermediate states that the radio can transistion through which are not |
sahilmgandhi | 18:6a4db94011d3 | 93 | * reported, but are instead bucketed into the state being transitioned |
sahilmgandhi | 18:6a4db94011d3 | 94 | * into. (Example: When the transmitter is in the process of shutting down, |
sahilmgandhi | 18:6a4db94011d3 | 95 | * this function will return TX, as if the shutdown process hadn't started yet) |
sahilmgandhi | 18:6a4db94011d3 | 96 | */ |
sahilmgandhi | 18:6a4db94011d3 | 97 | RAIL_RadioState_t RAIL_RfStateGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 98 | |
sahilmgandhi | 18:6a4db94011d3 | 99 | /** |
sahilmgandhi | 18:6a4db94011d3 | 100 | * Configure RAIL automatic state transitions after RX |
sahilmgandhi | 18:6a4db94011d3 | 101 | * |
sahilmgandhi | 18:6a4db94011d3 | 102 | * @param[in] success The next radio state to enter after a successful packet |
sahilmgandhi | 18:6a4db94011d3 | 103 | * reception. |
sahilmgandhi | 18:6a4db94011d3 | 104 | * @param[in] error The next radio state to enter after an error during packet |
sahilmgandhi | 18:6a4db94011d3 | 105 | * reception. |
sahilmgandhi | 18:6a4db94011d3 | 106 | * @param[in] ignoreErrors Define errors during packet handling to be ignored |
sahilmgandhi | 18:6a4db94011d3 | 107 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 108 | * |
sahilmgandhi | 18:6a4db94011d3 | 109 | * This function fails if unsupported transitions are passed in, or if the |
sahilmgandhi | 18:6a4db94011d3 | 110 | * radio is currently in the RX state. Success can transition to TX, RX, or |
sahilmgandhi | 18:6a4db94011d3 | 111 | * IDLE, while error can transition to RX or IDLE. The full list of options for |
sahilmgandhi | 18:6a4db94011d3 | 112 | * the ignoreErrors parameter is any define that starts with |
sahilmgandhi | 18:6a4db94011d3 | 113 | * \link RAIL_IGNORE_NO_ERRORS RAIL_IGNORE_\endlink. |
sahilmgandhi | 18:6a4db94011d3 | 114 | */ |
sahilmgandhi | 18:6a4db94011d3 | 115 | RAIL_Status_t RAIL_SetRxTransitions(RAIL_RadioState_t success, |
sahilmgandhi | 18:6a4db94011d3 | 116 | RAIL_RadioState_t error, |
sahilmgandhi | 18:6a4db94011d3 | 117 | uint8_t ignoreErrors); |
sahilmgandhi | 18:6a4db94011d3 | 118 | |
sahilmgandhi | 18:6a4db94011d3 | 119 | /** |
sahilmgandhi | 18:6a4db94011d3 | 120 | * Configure RAIL automatic state transitions after TX |
sahilmgandhi | 18:6a4db94011d3 | 121 | * |
sahilmgandhi | 18:6a4db94011d3 | 122 | * @param[in] success The next radio state to enter after a successful packet |
sahilmgandhi | 18:6a4db94011d3 | 123 | * transmission. |
sahilmgandhi | 18:6a4db94011d3 | 124 | * @param[in] error The next radio state to enter after an error during packet |
sahilmgandhi | 18:6a4db94011d3 | 125 | * transmission. |
sahilmgandhi | 18:6a4db94011d3 | 126 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 127 | * |
sahilmgandhi | 18:6a4db94011d3 | 128 | * This function fails if unsupported transitions are passed in, or if the |
sahilmgandhi | 18:6a4db94011d3 | 129 | * radio is currently the TX state. Success and error can each transition to RX |
sahilmgandhi | 18:6a4db94011d3 | 130 | * or IDLE. |
sahilmgandhi | 18:6a4db94011d3 | 131 | */ |
sahilmgandhi | 18:6a4db94011d3 | 132 | RAIL_Status_t RAIL_SetTxTransitions(RAIL_RadioState_t success, |
sahilmgandhi | 18:6a4db94011d3 | 133 | RAIL_RadioState_t error); |
sahilmgandhi | 18:6a4db94011d3 | 134 | |
sahilmgandhi | 18:6a4db94011d3 | 135 | /** |
sahilmgandhi | 18:6a4db94011d3 | 136 | * Configure RAIL automatic state transition timing |
sahilmgandhi | 18:6a4db94011d3 | 137 | * |
sahilmgandhi | 18:6a4db94011d3 | 138 | * @param[in] timings The timings used to configure the RAIL state machine. This |
sahilmgandhi | 18:6a4db94011d3 | 139 | * structure will be overwritten with the actual times that were set, in the |
sahilmgandhi | 18:6a4db94011d3 | 140 | * case of an input timing that is invalid. |
sahilmgandhi | 18:6a4db94011d3 | 141 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 142 | * |
sahilmgandhi | 18:6a4db94011d3 | 143 | * The timings given will be close to the actual transition time, but there is |
sahilmgandhi | 18:6a4db94011d3 | 144 | * some software overhead that is not yet characterized. Also, timings are not |
sahilmgandhi | 18:6a4db94011d3 | 145 | * always adhered to when using an automatic transition after an error, due to |
sahilmgandhi | 18:6a4db94011d3 | 146 | * the cleanup required to recover from the error. |
sahilmgandhi | 18:6a4db94011d3 | 147 | */ |
sahilmgandhi | 18:6a4db94011d3 | 148 | RAIL_Status_t RAIL_SetStateTiming(RAIL_StateTiming_t *timings); |
sahilmgandhi | 18:6a4db94011d3 | 149 | |
sahilmgandhi | 18:6a4db94011d3 | 150 | /** |
sahilmgandhi | 18:6a4db94011d3 | 151 | * Place the radio into an idle state |
sahilmgandhi | 18:6a4db94011d3 | 152 | * |
sahilmgandhi | 18:6a4db94011d3 | 153 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 154 | * |
sahilmgandhi | 18:6a4db94011d3 | 155 | * This function is used to remove the radio from TX and RX states. |
sahilmgandhi | 18:6a4db94011d3 | 156 | */ |
sahilmgandhi | 18:6a4db94011d3 | 157 | void RAIL_RfIdle(void); |
sahilmgandhi | 18:6a4db94011d3 | 158 | |
sahilmgandhi | 18:6a4db94011d3 | 159 | /** |
sahilmgandhi | 18:6a4db94011d3 | 160 | * Extended radio idle API |
sahilmgandhi | 18:6a4db94011d3 | 161 | * |
sahilmgandhi | 18:6a4db94011d3 | 162 | * @param[in] mode The method to use for shutting down the radio. |
sahilmgandhi | 18:6a4db94011d3 | 163 | * @param[in] wait Whether this function should wait for the radio to reach idle |
sahilmgandhi | 18:6a4db94011d3 | 164 | * before returning. |
sahilmgandhi | 18:6a4db94011d3 | 165 | * |
sahilmgandhi | 18:6a4db94011d3 | 166 | * This is an extended version of the simple RAIL_RfIdle() API which lets the |
sahilmgandhi | 18:6a4db94011d3 | 167 | * application specify how it reaches idle state and if the function should |
sahilmgandhi | 18:6a4db94011d3 | 168 | * busy wait. |
sahilmgandhi | 18:6a4db94011d3 | 169 | */ |
sahilmgandhi | 18:6a4db94011d3 | 170 | void RAIL_RfIdleExt(RAIL_RfIdleMode_t mode, bool wait); |
sahilmgandhi | 18:6a4db94011d3 | 171 | |
sahilmgandhi | 18:6a4db94011d3 | 172 | /** |
sahilmgandhi | 18:6a4db94011d3 | 173 | * Start/Stop RF Sense functionality for use during low-energy sleep modes. |
sahilmgandhi | 18:6a4db94011d3 | 174 | * |
sahilmgandhi | 18:6a4db94011d3 | 175 | * @param[in] band The frequency band(s) on which to sense RF energy. |
sahilmgandhi | 18:6a4db94011d3 | 176 | * To stop Rf Sense, specify \ref RAIL_RFSENSE_OFF. |
sahilmgandhi | 18:6a4db94011d3 | 177 | * @param[in] senseTime The time (in microseconds) RF energy must be |
sahilmgandhi | 18:6a4db94011d3 | 178 | * continually detected to be considered "sensed". |
sahilmgandhi | 18:6a4db94011d3 | 179 | * @param[in] enableCb Set true to enable \ref RAILCb_RxRadioStatus() callback |
sahilmgandhi | 18:6a4db94011d3 | 180 | * with status \ref RAIL_RX_CONFIG_RF_SENSED when Rf is sensed. Set false if |
sahilmgandhi | 18:6a4db94011d3 | 181 | * prefer to poll via \ref RAIL_RfSensed(). |
sahilmgandhi | 18:6a4db94011d3 | 182 | * |
sahilmgandhi | 18:6a4db94011d3 | 183 | * @return The actual senseTime utilized, which may be different than |
sahilmgandhi | 18:6a4db94011d3 | 184 | * requested due to limitations of the hardware. If 0, RF sense was |
sahilmgandhi | 18:6a4db94011d3 | 185 | * disabled or it could not be enabled (no callback will be issued). |
sahilmgandhi | 18:6a4db94011d3 | 186 | * |
sahilmgandhi | 18:6a4db94011d3 | 187 | * The EFR32 has the ability to sense the presence of RF Energy above -20 dBm |
sahilmgandhi | 18:6a4db94011d3 | 188 | * within either or both the 2.4 GHz and Sub-GHz bands, and trigger an event |
sahilmgandhi | 18:6a4db94011d3 | 189 | * if that energy is continuously present for certain durations of time. |
sahilmgandhi | 18:6a4db94011d3 | 190 | * |
sahilmgandhi | 18:6a4db94011d3 | 191 | * @note After RF energy has been sensed, RF Sense is automatically disabled, |
sahilmgandhi | 18:6a4db94011d3 | 192 | * and RAIL_RfSense() must be called again to reactivate it. |
sahilmgandhi | 18:6a4db94011d3 | 193 | * |
sahilmgandhi | 18:6a4db94011d3 | 194 | * @warning RF Sense functionality is only guaranteed from 0 to |
sahilmgandhi | 18:6a4db94011d3 | 195 | * 85 degrees Celsius. RF Sense should be disabled |
sahilmgandhi | 18:6a4db94011d3 | 196 | * outside this Temperature range. |
sahilmgandhi | 18:6a4db94011d3 | 197 | */ |
sahilmgandhi | 18:6a4db94011d3 | 198 | uint32_t RAIL_RfSense(RAIL_RfSenseBand_t band, uint32_t senseTime, bool enableCb); |
sahilmgandhi | 18:6a4db94011d3 | 199 | |
sahilmgandhi | 18:6a4db94011d3 | 200 | /** |
sahilmgandhi | 18:6a4db94011d3 | 201 | * Check if RF was sensed. |
sahilmgandhi | 18:6a4db94011d3 | 202 | * |
sahilmgandhi | 18:6a4db94011d3 | 203 | * @return true if RF was sensed since last call to \ref RAIL_RfSense; false |
sahilmgandhi | 18:6a4db94011d3 | 204 | * otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 205 | * |
sahilmgandhi | 18:6a4db94011d3 | 206 | * This function is useful if \ref RAIL_RfSense has been called with enableCb |
sahilmgandhi | 18:6a4db94011d3 | 207 | * set to false. It is generally used after EM4 reboot, but can be used any |
sahilmgandhi | 18:6a4db94011d3 | 208 | * time. |
sahilmgandhi | 18:6a4db94011d3 | 209 | */ |
sahilmgandhi | 18:6a4db94011d3 | 210 | bool RAIL_RfSensed(void); |
sahilmgandhi | 18:6a4db94011d3 | 211 | |
sahilmgandhi | 18:6a4db94011d3 | 212 | /** |
sahilmgandhi | 18:6a4db94011d3 | 213 | * Modify the currently configured fixed length |
sahilmgandhi | 18:6a4db94011d3 | 214 | * |
sahilmgandhi | 18:6a4db94011d3 | 215 | * @param[in] length Expected fixed length; 0 is infinite |
sahilmgandhi | 18:6a4db94011d3 | 216 | * @return Length configured; 0xFFFF if not in fixed length, 0 if in infinite |
sahilmgandhi | 18:6a4db94011d3 | 217 | * |
sahilmgandhi | 18:6a4db94011d3 | 218 | * Set the fixed length configuration for transmit and receive. Users should |
sahilmgandhi | 18:6a4db94011d3 | 219 | * be careful when using this function in receive and transmit. This function |
sahilmgandhi | 18:6a4db94011d3 | 220 | * returns \ref RAIL_SETFIXEDLENGTH_INVALID if the radio is not in fixed length |
sahilmgandhi | 18:6a4db94011d3 | 221 | * mode. The function returns 0 if in infinite length mode. Otherwise it will |
sahilmgandhi | 18:6a4db94011d3 | 222 | * return the length configured into the hardware. |
sahilmgandhi | 18:6a4db94011d3 | 223 | */ |
sahilmgandhi | 18:6a4db94011d3 | 224 | uint16_t RAIL_SetFixedLength(uint16_t length); |
sahilmgandhi | 18:6a4db94011d3 | 225 | |
sahilmgandhi | 18:6a4db94011d3 | 226 | /***************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 227 | * Collect entropy from the radio if available. |
sahilmgandhi | 18:6a4db94011d3 | 228 | * |
sahilmgandhi | 18:6a4db94011d3 | 229 | * @param buffer The buffer to write the collected entropy to. |
sahilmgandhi | 18:6a4db94011d3 | 230 | * @param bytes The number of bytes to fill in in the input buffer |
sahilmgandhi | 18:6a4db94011d3 | 231 | * @return Returns the number of bytes of entropy we were able to collect. For |
sahilmgandhi | 18:6a4db94011d3 | 232 | * chips that don't support entropy collection this will return 0. Values less |
sahilmgandhi | 18:6a4db94011d3 | 233 | * than the requested amount may also be returned on platforms that use entropy |
sahilmgandhi | 18:6a4db94011d3 | 234 | * pools to collect random data periodically. |
sahilmgandhi | 18:6a4db94011d3 | 235 | * |
sahilmgandhi | 18:6a4db94011d3 | 236 | * Attempts to fill up the provided buffer with the requested number of bytes of |
sahilmgandhi | 18:6a4db94011d3 | 237 | * entropy. If we cannot provide as many bytes as requested then we will fill in |
sahilmgandhi | 18:6a4db94011d3 | 238 | * whatever we can and return the number of bytes we were able to get. For chips |
sahilmgandhi | 18:6a4db94011d3 | 239 | * that do not support this function we will always return 0 bytes. For |
sahilmgandhi | 18:6a4db94011d3 | 240 | * information about the specific mechanism for gathering entropy consult the |
sahilmgandhi | 18:6a4db94011d3 | 241 | * documentation for the chip family you're using. |
sahilmgandhi | 18:6a4db94011d3 | 242 | ******************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 243 | uint16_t RAIL_GetRadioEntropy(uint8_t *buffer, uint16_t bytes); |
sahilmgandhi | 18:6a4db94011d3 | 244 | |
sahilmgandhi | 18:6a4db94011d3 | 245 | /** |
sahilmgandhi | 18:6a4db94011d3 | 246 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 247 | */ |
sahilmgandhi | 18:6a4db94011d3 | 248 | |
sahilmgandhi | 18:6a4db94011d3 | 249 | /** |
sahilmgandhi | 18:6a4db94011d3 | 250 | * @addtogroup Memory_Management |
sahilmgandhi | 18:6a4db94011d3 | 251 | * @brief Application callbacks to provide memory for RAIL actions. |
sahilmgandhi | 18:6a4db94011d3 | 252 | * |
sahilmgandhi | 18:6a4db94011d3 | 253 | * The RAIL library does not want to dictate how upper layers handle memory |
sahilmgandhi | 18:6a4db94011d3 | 254 | * allocation for packet receive data. At the same time we need to put the |
sahilmgandhi | 18:6a4db94011d3 | 255 | * packets somewhere to give them to the upper layers. To abstract this we |
sahilmgandhi | 18:6a4db94011d3 | 256 | * require the user application to implement the RAILCb_AllocateMemory(), |
sahilmgandhi | 18:6a4db94011d3 | 257 | * RAILCb_FreeMemory(), RAILCb_BeginWriteMemory(), and RAILCb_EndWriteMemory() |
sahilmgandhi | 18:6a4db94011d3 | 258 | * callbacks. These callbacks will be called from interrupt context to interact |
sahilmgandhi | 18:6a4db94011d3 | 259 | * with whatever memory allocation system your application uses. |
sahilmgandhi | 18:6a4db94011d3 | 260 | * |
sahilmgandhi | 18:6a4db94011d3 | 261 | * Memory will be allocated for receiving a packet whenever we think we need |
sahilmgandhi | 18:6a4db94011d3 | 262 | * it. This depends on the chip you're using and possibly the size of your |
sahilmgandhi | 18:6a4db94011d3 | 263 | * maximum packet. We will never ask for more memory than `MAX_PACKET_SIZE + |
sahilmgandhi | 18:6a4db94011d3 | 264 | * sizeof(\ref RAIL_RxPacketInfo_t)` where MAX_PACKET_SIZE is the maximum |
sahilmgandhi | 18:6a4db94011d3 | 265 | * packet your PHY is configured to receive over the air. Once you give us the |
sahilmgandhi | 18:6a4db94011d3 | 266 | * handle to this memory it must stay valid until we tell you we are done with |
sahilmgandhi | 18:6a4db94011d3 | 267 | * it using the RAILCb_FreeMemory() callback. Generally this will happen |
sahilmgandhi | 18:6a4db94011d3 | 268 | * immediately after we call the RAILCb_RxPacketReceived() function with that |
sahilmgandhi | 18:6a4db94011d3 | 269 | * handle. RAIL has no concept of an invalid handle so we will attempt to use |
sahilmgandhi | 18:6a4db94011d3 | 270 | * whatever you pass to us. This means that you will still receive all |
sahilmgandhi | 18:6a4db94011d3 | 271 | * callbacks for invalid handles even if we are forced to drop receive packet |
sahilmgandhi | 18:6a4db94011d3 | 272 | * bytes because they don't fit anywhere. |
sahilmgandhi | 18:6a4db94011d3 | 273 | * |
sahilmgandhi | 18:6a4db94011d3 | 274 | * If the handle is invalid you must make sure your callbacks do not |
sahilmgandhi | 18:6a4db94011d3 | 275 | * crash and that RAILCb_BeginWriteMemory() returns a NULL pointer or 0 bytes |
sahilmgandhi | 18:6a4db94011d3 | 276 | * available so that we do not try to write to this memory. In this case, the |
sahilmgandhi | 18:6a4db94011d3 | 277 | * packet data will be dropped. |
sahilmgandhi | 18:6a4db94011d3 | 278 | * |
sahilmgandhi | 18:6a4db94011d3 | 279 | * To actually write data to the handle you provide us we need to convert it |
sahilmgandhi | 18:6a4db94011d3 | 280 | * into an actual memory pointer. We will do this each time we need to access |
sahilmgandhi | 18:6a4db94011d3 | 281 | * the memory by calling RAILCb_BeginWriteMemory(). This function must return |
sahilmgandhi | 18:6a4db94011d3 | 282 | * a pointer to the requested offset in the memory buffer allocated. If you are |
sahilmgandhi | 18:6a4db94011d3 | 283 | * using non-contiguous memory buffers you can also return the number of bytes |
sahilmgandhi | 18:6a4db94011d3 | 284 | * available before we need to re-request a pointer with a new offset. Once the |
sahilmgandhi | 18:6a4db94011d3 | 285 | * access is complete we will call RAILCb_EndWriteMemory() with information |
sahilmgandhi | 18:6a4db94011d3 | 286 | * about exactly how many bytes were written at the specified offset. After this |
sahilmgandhi | 18:6a4db94011d3 | 287 | * call we will always call RAILCb_BeginWriteMemory() again before trying to |
sahilmgandhi | 18:6a4db94011d3 | 288 | * write any more data. In the event that you receive an invalid handle these |
sahilmgandhi | 18:6a4db94011d3 | 289 | * APIs must return NULL or set available bytes to 0 so that we do not attempt |
sahilmgandhi | 18:6a4db94011d3 | 290 | * to write packet data to the buffer. |
sahilmgandhi | 18:6a4db94011d3 | 291 | * |
sahilmgandhi | 18:6a4db94011d3 | 292 | * This system is fairly flexible and can tie into many higher level memory |
sahilmgandhi | 18:6a4db94011d3 | 293 | * allocation APIs. A simple example using one static buffer for memory |
sahilmgandhi | 18:6a4db94011d3 | 294 | * allocation is shown below. You will probably want a more advanced system |
sahilmgandhi | 18:6a4db94011d3 | 295 | * that can handle receiving multiple packets simultaneously. |
sahilmgandhi | 18:6a4db94011d3 | 296 | * |
sahilmgandhi | 18:6a4db94011d3 | 297 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 298 | * static uint8_t buffer[MAX_PACKET_SIZE + sizeof(RAIL_RxPacketInfo_t)]; |
sahilmgandhi | 18:6a4db94011d3 | 299 | * static bool isAllocated = false; |
sahilmgandhi | 18:6a4db94011d3 | 300 | * |
sahilmgandhi | 18:6a4db94011d3 | 301 | * void *RAILCb_AllocateMemory(uint32_t size) |
sahilmgandhi | 18:6a4db94011d3 | 302 | * { |
sahilmgandhi | 18:6a4db94011d3 | 303 | * int i = 0; |
sahilmgandhi | 18:6a4db94011d3 | 304 | * void *ptr = NULL; |
sahilmgandhi | 18:6a4db94011d3 | 305 | * CORE_DECLARE_IRQ_STATE; |
sahilmgandhi | 18:6a4db94011d3 | 306 | * |
sahilmgandhi | 18:6a4db94011d3 | 307 | * // We can't support sizes greater than the maximum buffer size |
sahilmgandhi | 18:6a4db94011d3 | 308 | * if(size > (MAX_PACKET_SIZE + sizeof(RAIL_RxPacketInfo_t))) { |
sahilmgandhi | 18:6a4db94011d3 | 309 | * return NULL; |
sahilmgandhi | 18:6a4db94011d3 | 310 | * } |
sahilmgandhi | 18:6a4db94011d3 | 311 | * |
sahilmgandhi | 18:6a4db94011d3 | 312 | * // Disable interrupts and attempt to grab the buffer |
sahilmgandhi | 18:6a4db94011d3 | 313 | * CORE_ENTER_CRITICAL(); |
sahilmgandhi | 18:6a4db94011d3 | 314 | * if (isAllocated) { |
sahilmgandhi | 18:6a4db94011d3 | 315 | * ptr = NULL; |
sahilmgandhi | 18:6a4db94011d3 | 316 | * } else { |
sahilmgandhi | 18:6a4db94011d3 | 317 | * isAllocated = true; |
sahilmgandhi | 18:6a4db94011d3 | 318 | * ptr = buffer; |
sahilmgandhi | 18:6a4db94011d3 | 319 | * } |
sahilmgandhi | 18:6a4db94011d3 | 320 | * CORE_EXIT_CRITICAL(); |
sahilmgandhi | 18:6a4db94011d3 | 321 | * |
sahilmgandhi | 18:6a4db94011d3 | 322 | * return ptr; |
sahilmgandhi | 18:6a4db94011d3 | 323 | * } |
sahilmgandhi | 18:6a4db94011d3 | 324 | * |
sahilmgandhi | 18:6a4db94011d3 | 325 | * void RAILCb_FreeMemory(void *ptr) |
sahilmgandhi | 18:6a4db94011d3 | 326 | * { |
sahilmgandhi | 18:6a4db94011d3 | 327 | * CORE_CRITICAL_SECTION( |
sahilmgandhi | 18:6a4db94011d3 | 328 | * isAllocated = false; |
sahilmgandhi | 18:6a4db94011d3 | 329 | * ); |
sahilmgandhi | 18:6a4db94011d3 | 330 | * } |
sahilmgandhi | 18:6a4db94011d3 | 331 | * |
sahilmgandhi | 18:6a4db94011d3 | 332 | * void *RAILCb_BeginWriteMemory(void *handle, |
sahilmgandhi | 18:6a4db94011d3 | 333 | * uint32_t offset, |
sahilmgandhi | 18:6a4db94011d3 | 334 | * uint32_t *available) |
sahilmgandhi | 18:6a4db94011d3 | 335 | * { |
sahilmgandhi | 18:6a4db94011d3 | 336 | * return ((uint8_t*)handle) + offset; |
sahilmgandhi | 18:6a4db94011d3 | 337 | * } |
sahilmgandhi | 18:6a4db94011d3 | 338 | * |
sahilmgandhi | 18:6a4db94011d3 | 339 | * void RAILCb_EndWriteMemory(void *handle, uint32_t offset, uint32_t size) |
sahilmgandhi | 18:6a4db94011d3 | 340 | * { |
sahilmgandhi | 18:6a4db94011d3 | 341 | * // Do nothing |
sahilmgandhi | 18:6a4db94011d3 | 342 | * } |
sahilmgandhi | 18:6a4db94011d3 | 343 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 344 | * |
sahilmgandhi | 18:6a4db94011d3 | 345 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 346 | */ |
sahilmgandhi | 18:6a4db94011d3 | 347 | |
sahilmgandhi | 18:6a4db94011d3 | 348 | /** |
sahilmgandhi | 18:6a4db94011d3 | 349 | * Callback function used by RAIL to request memory. |
sahilmgandhi | 18:6a4db94011d3 | 350 | * |
sahilmgandhi | 18:6a4db94011d3 | 351 | * @param[in] size The amount of memory in bytes that we need for this packet |
sahilmgandhi | 18:6a4db94011d3 | 352 | * @return A handle to memory in your storage system. |
sahilmgandhi | 18:6a4db94011d3 | 353 | * |
sahilmgandhi | 18:6a4db94011d3 | 354 | * This is used to allocate memory for receive packets and must be implemented |
sahilmgandhi | 18:6a4db94011d3 | 355 | * by the application. |
sahilmgandhi | 18:6a4db94011d3 | 356 | */ |
sahilmgandhi | 18:6a4db94011d3 | 357 | void *RAILCb_AllocateMemory(uint32_t size); |
sahilmgandhi | 18:6a4db94011d3 | 358 | |
sahilmgandhi | 18:6a4db94011d3 | 359 | /** |
sahilmgandhi | 18:6a4db94011d3 | 360 | * Callback function used by RAIL to free memory. |
sahilmgandhi | 18:6a4db94011d3 | 361 | * |
sahilmgandhi | 18:6a4db94011d3 | 362 | * @param[in] handle A handle to a memory block allocated with the |
sahilmgandhi | 18:6a4db94011d3 | 363 | * RAILCb_AllocateMemory() API above. |
sahilmgandhi | 18:6a4db94011d3 | 364 | * |
sahilmgandhi | 18:6a4db94011d3 | 365 | * This is used to free memory that was allocated with the |
sahilmgandhi | 18:6a4db94011d3 | 366 | * RAILCb_AllocateMemory() function when RAIL is done using it. |
sahilmgandhi | 18:6a4db94011d3 | 367 | */ |
sahilmgandhi | 18:6a4db94011d3 | 368 | void RAILCb_FreeMemory(void *handle); |
sahilmgandhi | 18:6a4db94011d3 | 369 | |
sahilmgandhi | 18:6a4db94011d3 | 370 | /** |
sahilmgandhi | 18:6a4db94011d3 | 371 | * Called to begin copying received data into the current memory handle. |
sahilmgandhi | 18:6a4db94011d3 | 372 | * |
sahilmgandhi | 18:6a4db94011d3 | 373 | * @param[in] handle A handle to the current memory block for packet data. |
sahilmgandhi | 18:6a4db94011d3 | 374 | * @param[in] offset The offset in bytes from the start of the handle that we |
sahilmgandhi | 18:6a4db94011d3 | 375 | * need a pointer for. |
sahilmgandhi | 18:6a4db94011d3 | 376 | * @param[out] available The number of bytes available to be written to this |
sahilmgandhi | 18:6a4db94011d3 | 377 | * return pointer. If this is zero the receive will terminate. This parameter |
sahilmgandhi | 18:6a4db94011d3 | 378 | * will default to all spaces allocated to handle contiguous allocators. If your |
sahilmgandhi | 18:6a4db94011d3 | 379 | * allocator is different you *must* set this appropriately. |
sahilmgandhi | 18:6a4db94011d3 | 380 | * @return A pointer to the address to write data for this handle. |
sahilmgandhi | 18:6a4db94011d3 | 381 | * |
sahilmgandhi | 18:6a4db94011d3 | 382 | * This function is called before every memory write to a handle so that we can |
sahilmgandhi | 18:6a4db94011d3 | 383 | * get the actual address this handle references in the system. When we're done |
sahilmgandhi | 18:6a4db94011d3 | 384 | * writing there will be a corresponding call to RAILCb_EndWriteMemory(). |
sahilmgandhi | 18:6a4db94011d3 | 385 | * |
sahilmgandhi | 18:6a4db94011d3 | 386 | * @note You must have at least `sizeof(RAIL_RxPacketInfo_t)` contiguous bytes at |
sahilmgandhi | 18:6a4db94011d3 | 387 | * offset 0 or the appended info will not be written. |
sahilmgandhi | 18:6a4db94011d3 | 388 | */ |
sahilmgandhi | 18:6a4db94011d3 | 389 | void *RAILCb_BeginWriteMemory(void *handle, |
sahilmgandhi | 18:6a4db94011d3 | 390 | uint32_t offset, |
sahilmgandhi | 18:6a4db94011d3 | 391 | uint32_t *available); |
sahilmgandhi | 18:6a4db94011d3 | 392 | |
sahilmgandhi | 18:6a4db94011d3 | 393 | /** |
sahilmgandhi | 18:6a4db94011d3 | 394 | * Called to complete the write memory transaction. |
sahilmgandhi | 18:6a4db94011d3 | 395 | * |
sahilmgandhi | 18:6a4db94011d3 | 396 | * @param handle The handle to the current memory block we're modifying. |
sahilmgandhi | 18:6a4db94011d3 | 397 | * @param offset The offset in bytes from the start of the handle that this data |
sahilmgandhi | 18:6a4db94011d3 | 398 | * was written to. |
sahilmgandhi | 18:6a4db94011d3 | 399 | * @param size The number of bytes that were written. |
sahilmgandhi | 18:6a4db94011d3 | 400 | * |
sahilmgandhi | 18:6a4db94011d3 | 401 | * This callback indicates the completeion of a write memory transaction. It |
sahilmgandhi | 18:6a4db94011d3 | 402 | * can be used to store information about how many bytes were written or |
sahilmgandhi | 18:6a4db94011d3 | 403 | * anything else needed. Once this is called the pointer returned by |
sahilmgandhi | 18:6a4db94011d3 | 404 | * RAILCb_BeginWriteMemory() will no longer be assumed to be valid and we will |
sahilmgandhi | 18:6a4db94011d3 | 405 | * call that function again for any future writes. |
sahilmgandhi | 18:6a4db94011d3 | 406 | */ |
sahilmgandhi | 18:6a4db94011d3 | 407 | void RAILCb_EndWriteMemory(void *handle, uint32_t offset, uint32_t size); |
sahilmgandhi | 18:6a4db94011d3 | 408 | |
sahilmgandhi | 18:6a4db94011d3 | 409 | /** |
sahilmgandhi | 18:6a4db94011d3 | 410 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 411 | */ |
sahilmgandhi | 18:6a4db94011d3 | 412 | |
sahilmgandhi | 18:6a4db94011d3 | 413 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 414 | * Data Management |
sahilmgandhi | 18:6a4db94011d3 | 415 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 416 | /** |
sahilmgandhi | 18:6a4db94011d3 | 417 | * @addtogroup Data_Management |
sahilmgandhi | 18:6a4db94011d3 | 418 | * @brief Data management functions |
sahilmgandhi | 18:6a4db94011d3 | 419 | * |
sahilmgandhi | 18:6a4db94011d3 | 420 | * These functions allow the application to choose how data is presented to the |
sahilmgandhi | 18:6a4db94011d3 | 421 | * application. There are two methods for RAIL to provide data, in a packet |
sahilmgandhi | 18:6a4db94011d3 | 422 | * based method leveraging \ref Memory_Management callbacks or in a FIFO based |
sahilmgandhi | 18:6a4db94011d3 | 423 | * method which gives the application more granularity and responsibility in |
sahilmgandhi | 18:6a4db94011d3 | 424 | * managing transmit and receive data. |
sahilmgandhi | 18:6a4db94011d3 | 425 | * |
sahilmgandhi | 18:6a4db94011d3 | 426 | * The application can configure RAIL data mangement through RAIL_DataConfig(); |
sahilmgandhi | 18:6a4db94011d3 | 427 | * this function allows the application to specify the type of radio data (\ref |
sahilmgandhi | 18:6a4db94011d3 | 428 | * RAIL_TxDataSource_t and \ref RAIL_RxDataSource_t) and the method of |
sahilmgandhi | 18:6a4db94011d3 | 429 | * interacting with this data (\ref RAIL_DataMethod_t). By default, RAIL |
sahilmgandhi | 18:6a4db94011d3 | 430 | * configures Tx and Rx both with packet data source and packet mode. |
sahilmgandhi | 18:6a4db94011d3 | 431 | * |
sahilmgandhi | 18:6a4db94011d3 | 432 | * In packet based data management: |
sahilmgandhi | 18:6a4db94011d3 | 433 | * - Load transmit data with RAIL_TxDataLoad() |
sahilmgandhi | 18:6a4db94011d3 | 434 | * - Received data is returned in RAILCb_RxPacketReceived() |
sahilmgandhi | 18:6a4db94011d3 | 435 | * - Packet lengths are determined from the Radio Configurator configuration |
sahilmgandhi | 18:6a4db94011d3 | 436 | * - \ref Memory_Management callbacks will fire to ask for pointers to store |
sahilmgandhi | 18:6a4db94011d3 | 437 | * data |
sahilmgandhi | 18:6a4db94011d3 | 438 | * |
sahilmgandhi | 18:6a4db94011d3 | 439 | * In FIFO based data management: |
sahilmgandhi | 18:6a4db94011d3 | 440 | * - Load transmit data with RAIL_WriteTxFifo() |
sahilmgandhi | 18:6a4db94011d3 | 441 | * - Received data is retrieved through RAIL_ReadRxFifo() |
sahilmgandhi | 18:6a4db94011d3 | 442 | * - Packet Lengths are determined from the Radio Configurator configuration |
sahilmgandhi | 18:6a4db94011d3 | 443 | * - Set fifo thresholds through RAIL_SetTxFifoThreshold() and |
sahilmgandhi | 18:6a4db94011d3 | 444 | * RAIL_SetRxFifoThreshold() which fires RAILCb_RxFifoAlmostFull() and |
sahilmgandhi | 18:6a4db94011d3 | 445 | * RAILCb_TxFifoAlmostEmpty(). |
sahilmgandhi | 18:6a4db94011d3 | 446 | * - Get fifo count information through RAIL_GetRxFifoBytesAvailable() |
sahilmgandhi | 18:6a4db94011d3 | 447 | * and RAIL_GetTxFifoSpaceAvailable() |
sahilmgandhi | 18:6a4db94011d3 | 448 | * - Reset fifos with RAIL_ResetFifo() |
sahilmgandhi | 18:6a4db94011d3 | 449 | * - CRC Error acceptance is on by default |
sahilmgandhi | 18:6a4db94011d3 | 450 | * |
sahilmgandhi | 18:6a4db94011d3 | 451 | * Both transmit and receive fifos are the same size; when trying to determine |
sahilmgandhi | 18:6a4db94011d3 | 452 | * an appropriate threshold, the application can use |
sahilmgandhi | 18:6a4db94011d3 | 453 | * RAIL_GetTxFifoSpaceAvailable() to query the size of the fifo if it is empty |
sahilmgandhi | 18:6a4db94011d3 | 454 | * and use that as the size of the receive fifo as well. The transmit fifo is edge |
sahilmgandhi | 18:6a4db94011d3 | 455 | * based where it only provides an interrupt once when the threshold is |
sahilmgandhi | 18:6a4db94011d3 | 456 | * crossed. The receive fifo is level based where the interrupt will constantly |
sahilmgandhi | 18:6a4db94011d3 | 457 | * pend if the threshold is exceeded. This normally means that inside |
sahilmgandhi | 18:6a4db94011d3 | 458 | * RAILCb_RxFifoAlmostFull(), the application should empty enough of the fifo |
sahilmgandhi | 18:6a4db94011d3 | 459 | * to go under the threshold. If the application wishes to defer reading the |
sahilmgandhi | 18:6a4db94011d3 | 460 | * fifo to main, it can disable the receive fifo threshold interrupt via |
sahilmgandhi | 18:6a4db94011d3 | 461 | * RAIL_DisableRxFifoThreshold(). The application can reenable the interrupt |
sahilmgandhi | 18:6a4db94011d3 | 462 | * via RAIL_EnableRxFifoThreshold(). |
sahilmgandhi | 18:6a4db94011d3 | 463 | * |
sahilmgandhi | 18:6a4db94011d3 | 464 | * In fifo mode, the fifos can store multiple packets. Depending on traffic, |
sahilmgandhi | 18:6a4db94011d3 | 465 | * RAIL can receive multiple packets into the receive fifo before the |
sahilmgandhi | 18:6a4db94011d3 | 466 | * application gets around to reading out the received data from the fifo. If |
sahilmgandhi | 18:6a4db94011d3 | 467 | * appended info is enabled, make sure to read out the appended info with |
sahilmgandhi | 18:6a4db94011d3 | 468 | * RAIL_ReadRxFifoAppendedInfo() before attempting to read out the next packet. |
sahilmgandhi | 18:6a4db94011d3 | 469 | * If the application aborts during packet reception, appended info will not be |
sahilmgandhi | 18:6a4db94011d3 | 470 | * present in the receive fifo. If a frame error occurs in fifo mode, the |
sahilmgandhi | 18:6a4db94011d3 | 471 | * contents of the receive fifo is unreliable and should be flushed. |
sahilmgandhi | 18:6a4db94011d3 | 472 | * |
sahilmgandhi | 18:6a4db94011d3 | 473 | * When calling RAIL_DataConfig() for fifo mode, RAIL will set \ref |
sahilmgandhi | 18:6a4db94011d3 | 474 | * RAIL_IGNORE_CRC_ERRORS. Otherwise for packet mode, RAIL will set \ref |
sahilmgandhi | 18:6a4db94011d3 | 475 | * RAIL_IGNORE_NO_ERRORS. It is highly suggested that the application maintains |
sahilmgandhi | 18:6a4db94011d3 | 476 | * \ref RAIL_IGNORE_CRC_ERRORS in fifo mode if using hardware crc checking. |
sahilmgandhi | 18:6a4db94011d3 | 477 | * |
sahilmgandhi | 18:6a4db94011d3 | 478 | * While RAIL defaults to packet mode, the application can explicitly |
sahilmgandhi | 18:6a4db94011d3 | 479 | * initialize RAIL for packet mode in the following manner: |
sahilmgandhi | 18:6a4db94011d3 | 480 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 481 | * static const RAIL_DataConfig_t railDataConfig = { |
sahilmgandhi | 18:6a4db94011d3 | 482 | * .txSource = TX_PACKET_DATA, |
sahilmgandhi | 18:6a4db94011d3 | 483 | * .rxSource = RX_PACKET_DATA, |
sahilmgandhi | 18:6a4db94011d3 | 484 | * .txMethod = PACKET_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 485 | * .rxMethod = PACKET_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 486 | * }; |
sahilmgandhi | 18:6a4db94011d3 | 487 | * |
sahilmgandhi | 18:6a4db94011d3 | 488 | * status = RAIL_DataConfig(&railDataConfig); |
sahilmgandhi | 18:6a4db94011d3 | 489 | * |
sahilmgandhi | 18:6a4db94011d3 | 490 | * // Callbacks that occur in Packet Mode |
sahilmgandhi | 18:6a4db94011d3 | 491 | * void RAILCb_TxPacketSent(RAIL_TxPacketInfo_t *txPacketInfo); |
sahilmgandhi | 18:6a4db94011d3 | 492 | * void RAILCb_RxPacketReceived(void *rxPacketHandle); |
sahilmgandhi | 18:6a4db94011d3 | 493 | * void *RAILCb_AllocateMemory(uint32_t size); |
sahilmgandhi | 18:6a4db94011d3 | 494 | * void RAILCb_FreeMemory(void *handle); |
sahilmgandhi | 18:6a4db94011d3 | 495 | * void *RAILCb_BeginWriteMemory(void *handle, |
sahilmgandhi | 18:6a4db94011d3 | 496 | * uint32_t offset, |
sahilmgandhi | 18:6a4db94011d3 | 497 | * uint32_t *available); |
sahilmgandhi | 18:6a4db94011d3 | 498 | * void RAILCb_EndWriteMemory(void *handle, uint32_t offset, uint32_t size); |
sahilmgandhi | 18:6a4db94011d3 | 499 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 500 | * |
sahilmgandhi | 18:6a4db94011d3 | 501 | * Initializing RAIL for Fifo Mode requires a few more function calls: |
sahilmgandhi | 18:6a4db94011d3 | 502 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 503 | * static const RAIL_DataConfig_t railDataConfig = { |
sahilmgandhi | 18:6a4db94011d3 | 504 | * .txSource = TX_PACKET_DATA, |
sahilmgandhi | 18:6a4db94011d3 | 505 | * .rxSource = RX_PACKET_DATA, |
sahilmgandhi | 18:6a4db94011d3 | 506 | * .txMethod = FIFO_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 507 | * .rxMethod = FIFO_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 508 | * }; |
sahilmgandhi | 18:6a4db94011d3 | 509 | * |
sahilmgandhi | 18:6a4db94011d3 | 510 | * status = RAIL_DataConfig(&railDataConfig); |
sahilmgandhi | 18:6a4db94011d3 | 511 | * |
sahilmgandhi | 18:6a4db94011d3 | 512 | * // Get the size of the fifos |
sahilmgandhi | 18:6a4db94011d3 | 513 | * // The transmit and receive fifos are the same size |
sahilmgandhi | 18:6a4db94011d3 | 514 | * uint16_t fifoSize = RAIL_GetTxFifoSpaceAvailable(); |
sahilmgandhi | 18:6a4db94011d3 | 515 | * |
sahilmgandhi | 18:6a4db94011d3 | 516 | * // Set the transmit and receive fifo thresholds |
sahilmgandhi | 18:6a4db94011d3 | 517 | * // For this example, set the threshold in the middle of each fifo |
sahilmgandhi | 18:6a4db94011d3 | 518 | * RAIL_SetRxFifoThreshold(fifoSize / 2); |
sahilmgandhi | 18:6a4db94011d3 | 519 | * RAIL_SetTxFifoThreshold(fifoSize / 2); |
sahilmgandhi | 18:6a4db94011d3 | 520 | * |
sahilmgandhi | 18:6a4db94011d3 | 521 | * //Callbacks that occur in Fifo mode |
sahilmgandhi | 18:6a4db94011d3 | 522 | * void RAILCb_TxPacketSent(RAIL_TxPacketInfo_t *txPacketInfo); |
sahilmgandhi | 18:6a4db94011d3 | 523 | * void RAILCb_RxPacketReceived(void *rxPacketHandle); |
sahilmgandhi | 18:6a4db94011d3 | 524 | * void RAILCb_TxFifoAlmostEmpty(uint16_t spaceAvailable); |
sahilmgandhi | 18:6a4db94011d3 | 525 | * void RAILCb_RxFifoAlmostFull(uint16_t bytesAvailable); |
sahilmgandhi | 18:6a4db94011d3 | 526 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 527 | * |
sahilmgandhi | 18:6a4db94011d3 | 528 | * On receive, there are multiple data sources that an application can use that |
sahilmgandhi | 18:6a4db94011d3 | 529 | * are only compatible with the fifo method of data delivery. All that differs |
sahilmgandhi | 18:6a4db94011d3 | 530 | * from the fifo mode example above is the RAIL_DataConfig_t::rxSource setting. |
sahilmgandhi | 18:6a4db94011d3 | 531 | * IQ data samples are taken at the hardware's oversample rate and the amount |
sahilmgandhi | 18:6a4db94011d3 | 532 | * of data can easily overwhelm CPU processing time. The sample rate depends on |
sahilmgandhi | 18:6a4db94011d3 | 533 | * the chosen PHY as is determined by the data rate as well as the decimation |
sahilmgandhi | 18:6a4db94011d3 | 534 | * chain. It is <b>not</b> recommended to use the IQ data source with sample |
sahilmgandhi | 18:6a4db94011d3 | 535 | * rates above 300k samples/second as the CPU might not be able to keep up with |
sahilmgandhi | 18:6a4db94011d3 | 536 | * the data. Depending on the application and needed CPU bandwidth, slower |
sahilmgandhi | 18:6a4db94011d3 | 537 | * data rates may be required. |
sahilmgandhi | 18:6a4db94011d3 | 538 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 539 | * // IQ data is provided into the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 540 | * static const RAIL_DataConfig_t railDataConfig = { |
sahilmgandhi | 18:6a4db94011d3 | 541 | * .txSource = TX_PACKET_DATA, |
sahilmgandhi | 18:6a4db94011d3 | 542 | * .rxSource = RX_IQDATA_FILTLSB, |
sahilmgandhi | 18:6a4db94011d3 | 543 | * .txMethod = FIFO_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 544 | * .rxMethod = FIFO_MODE, |
sahilmgandhi | 18:6a4db94011d3 | 545 | * }; |
sahilmgandhi | 18:6a4db94011d3 | 546 | * |
sahilmgandhi | 18:6a4db94011d3 | 547 | * // When reading IQ data out of the fifo, it comes in the following format: |
sahilmgandhi | 18:6a4db94011d3 | 548 | * //------------------------------------ |
sahilmgandhi | 18:6a4db94011d3 | 549 | * // I[LSB] | I[MSB] | Q[LSB] | Q[MSB] | |
sahilmgandhi | 18:6a4db94011d3 | 550 | * //------------------------------------ |
sahilmgandhi | 18:6a4db94011d3 | 551 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 552 | * |
sahilmgandhi | 18:6a4db94011d3 | 553 | * @note \ref RAIL_DataConfig_t.txMethod and \ref RAIL_DataConfig_t.rxMethod |
sahilmgandhi | 18:6a4db94011d3 | 554 | * must have the same \ref RAIL_DataMethod_t configuration. |
sahilmgandhi | 18:6a4db94011d3 | 555 | * |
sahilmgandhi | 18:6a4db94011d3 | 556 | * @warning Do not call RAIL fifo functions while in \ref |
sahilmgandhi | 18:6a4db94011d3 | 557 | * RAIL_DataMethod_t::PACKET_MODE. |
sahilmgandhi | 18:6a4db94011d3 | 558 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 559 | */ |
sahilmgandhi | 18:6a4db94011d3 | 560 | |
sahilmgandhi | 18:6a4db94011d3 | 561 | /** |
sahilmgandhi | 18:6a4db94011d3 | 562 | * RAIL data management configuration |
sahilmgandhi | 18:6a4db94011d3 | 563 | * |
sahilmgandhi | 18:6a4db94011d3 | 564 | * @param[in] dataConfig RAIL data configuration structure |
sahilmgandhi | 18:6a4db94011d3 | 565 | * @return RAIL Status of configuration |
sahilmgandhi | 18:6a4db94011d3 | 566 | * |
sahilmgandhi | 18:6a4db94011d3 | 567 | * This function configures how RAIL manages data. The application can |
sahilmgandhi | 18:6a4db94011d3 | 568 | * configure RAIL to receive data in a packet based or FIFO based format. When |
sahilmgandhi | 18:6a4db94011d3 | 569 | * configuring tx or rx for fifo mode, this function will reset the configured |
sahilmgandhi | 18:6a4db94011d3 | 570 | * fifos. |
sahilmgandhi | 18:6a4db94011d3 | 571 | * |
sahilmgandhi | 18:6a4db94011d3 | 572 | * If \ref RAIL_DataConfig_t.rxMethod is set to \ref |
sahilmgandhi | 18:6a4db94011d3 | 573 | * RAIL_DataMethod_t.PACKET_MODE, the radio will filter packets with invalid |
sahilmgandhi | 18:6a4db94011d3 | 574 | * CRCs by default. This is similar to setting the <b>ignoreErrors</b> |
sahilmgandhi | 18:6a4db94011d3 | 575 | * parameter in RAIL_SetRxTransitions() to \ref RAIL_IGNORE_NO_ERRORS. |
sahilmgandhi | 18:6a4db94011d3 | 576 | * |
sahilmgandhi | 18:6a4db94011d3 | 577 | * If \ref RAIL_DataConfig_t.rxMethod is set to \ref |
sahilmgandhi | 18:6a4db94011d3 | 578 | * RAIL_DataMethod_t.FIFO_MODE, the radio will accept packets with CRCs as |
sahilmgandhi | 18:6a4db94011d3 | 579 | * 'valid' packets by default. This is meant to treat 'fully received' packets |
sahilmgandhi | 18:6a4db94011d3 | 580 | * the same way regardless if CRC passes or fails. The application can parse |
sahilmgandhi | 18:6a4db94011d3 | 581 | * CRC errors via appended info obtained from RAIL_ReadRxFifoAppendedInfo(). |
sahilmgandhi | 18:6a4db94011d3 | 582 | * This is similar to setting the <b>ignoreErrors</b> parameter in |
sahilmgandhi | 18:6a4db94011d3 | 583 | * RAIL_SetRxTransitions() to \ref RAIL_IGNORE_CRC_ERRORS. |
sahilmgandhi | 18:6a4db94011d3 | 584 | * |
sahilmgandhi | 18:6a4db94011d3 | 585 | * In either situation, the application can set <b>ignoreErrors</b> as needed; |
sahilmgandhi | 18:6a4db94011d3 | 586 | * in fifo mode, appended info will not be present for frame errors. The |
sahilmgandhi | 18:6a4db94011d3 | 587 | * defaults defined above are the recommended setting. |
sahilmgandhi | 18:6a4db94011d3 | 588 | */ |
sahilmgandhi | 18:6a4db94011d3 | 589 | RAIL_Status_t RAIL_DataConfig(RAIL_DataConfig_t *dataConfig); |
sahilmgandhi | 18:6a4db94011d3 | 590 | |
sahilmgandhi | 18:6a4db94011d3 | 591 | /** |
sahilmgandhi | 18:6a4db94011d3 | 592 | * Write data to the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 593 | * |
sahilmgandhi | 18:6a4db94011d3 | 594 | * @param[in] dataPtr Application provided pointer to transmit data |
sahilmgandhi | 18:6a4db94011d3 | 595 | * @param[in] writeLength Number of bytes to write to the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 596 | * |
sahilmgandhi | 18:6a4db94011d3 | 597 | * @return The number of bytes written to the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 598 | * |
sahilmgandhi | 18:6a4db94011d3 | 599 | * This function reads data from the provided dataPtr and writes it to the TX |
sahilmgandhi | 18:6a4db94011d3 | 600 | * Fifo. If the requested writeLength exceeds the current number of bytes open |
sahilmgandhi | 18:6a4db94011d3 | 601 | * in the transmit fifo, the function will only write until the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 602 | * is full. The function returns the number of bytes written to the transmit |
sahilmgandhi | 18:6a4db94011d3 | 603 | * fifo. |
sahilmgandhi | 18:6a4db94011d3 | 604 | * |
sahilmgandhi | 18:6a4db94011d3 | 605 | * @note This function does not create a critical section but depending on the |
sahilmgandhi | 18:6a4db94011d3 | 606 | * application a critical section could be appropriate. |
sahilmgandhi | 18:6a4db94011d3 | 607 | */ |
sahilmgandhi | 18:6a4db94011d3 | 608 | uint16_t RAIL_WriteTxFifo(uint8_t *dataPtr, uint16_t writeLength); |
sahilmgandhi | 18:6a4db94011d3 | 609 | |
sahilmgandhi | 18:6a4db94011d3 | 610 | /** |
sahilmgandhi | 18:6a4db94011d3 | 611 | * Read data from the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 612 | * |
sahilmgandhi | 18:6a4db94011d3 | 613 | * @param[out] dataPtr Application provided pointer to store data |
sahilmgandhi | 18:6a4db94011d3 | 614 | * @param[in] readLength Number of bytes to read from the fifo |
sahilmgandhi | 18:6a4db94011d3 | 615 | * |
sahilmgandhi | 18:6a4db94011d3 | 616 | * @return The number of bytes read from the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 617 | * |
sahilmgandhi | 18:6a4db94011d3 | 618 | * This function reads data from the receive fifo and writes it to the provided |
sahilmgandhi | 18:6a4db94011d3 | 619 | * dataPtr. If the requested readLength exceeds the current number of bytes in |
sahilmgandhi | 18:6a4db94011d3 | 620 | * the receive fifo, the function will only read the current amount of bytes |
sahilmgandhi | 18:6a4db94011d3 | 621 | * available. |
sahilmgandhi | 18:6a4db94011d3 | 622 | * |
sahilmgandhi | 18:6a4db94011d3 | 623 | * This function does not have a critical section, so either use it only in one |
sahilmgandhi | 18:6a4db94011d3 | 624 | * context or make sure function calls are protected to prevent buffer |
sahilmgandhi | 18:6a4db94011d3 | 625 | * corruption. |
sahilmgandhi | 18:6a4db94011d3 | 626 | */ |
sahilmgandhi | 18:6a4db94011d3 | 627 | uint16_t RAIL_ReadRxFifo(uint8_t *dataPtr, uint16_t readLength); |
sahilmgandhi | 18:6a4db94011d3 | 628 | |
sahilmgandhi | 18:6a4db94011d3 | 629 | /** |
sahilmgandhi | 18:6a4db94011d3 | 630 | * Read appended info from the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 631 | * |
sahilmgandhi | 18:6a4db94011d3 | 632 | * @param[out] appendedInfo Application provided pointer to store RAIL_AppendedInfo_t |
sahilmgandhi | 18:6a4db94011d3 | 633 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 634 | * |
sahilmgandhi | 18:6a4db94011d3 | 635 | * This function reads appended info from the receive fifo and writes it to the |
sahilmgandhi | 18:6a4db94011d3 | 636 | * provided pointer; appended info is added to the receive fifo once a packet is |
sahilmgandhi | 18:6a4db94011d3 | 637 | * received. Using this function while not at the end of a packet can corrupt |
sahilmgandhi | 18:6a4db94011d3 | 638 | * your buffer by processing receive data as appended info. |
sahilmgandhi | 18:6a4db94011d3 | 639 | * |
sahilmgandhi | 18:6a4db94011d3 | 640 | * @note The following fields in appended info are not implemented in fifo mode and |
sahilmgandhi | 18:6a4db94011d3 | 641 | * do not contain valid info: |
sahilmgandhi | 18:6a4db94011d3 | 642 | * - RAIL_AppendedInfo_t.isAck |
sahilmgandhi | 18:6a4db94011d3 | 643 | * - RAIL_AppendedInfo_t.lqi |
sahilmgandhi | 18:6a4db94011d3 | 644 | * - RAIL_AppendedInfo_t.frameCodingStatus (will reflect the last received packet) |
sahilmgandhi | 18:6a4db94011d3 | 645 | */ |
sahilmgandhi | 18:6a4db94011d3 | 646 | void RAIL_ReadRxFifoAppendedInfo(RAIL_AppendedInfo_t *appendedInfo); |
sahilmgandhi | 18:6a4db94011d3 | 647 | |
sahilmgandhi | 18:6a4db94011d3 | 648 | /** |
sahilmgandhi | 18:6a4db94011d3 | 649 | * Configure the RAIL transmit fifo almost empty threshold |
sahilmgandhi | 18:6a4db94011d3 | 650 | * |
sahilmgandhi | 18:6a4db94011d3 | 651 | * @param[in] txThreshold Threshold once fallen under |
sahilmgandhi | 18:6a4db94011d3 | 652 | * will fire RAILCb_TxFifoAlmostEmpty() |
sahilmgandhi | 18:6a4db94011d3 | 653 | * @return Configured transmit fifo threshold value |
sahilmgandhi | 18:6a4db94011d3 | 654 | * |
sahilmgandhi | 18:6a4db94011d3 | 655 | * This function configures the threshold for the transmit fifo. When the count |
sahilmgandhi | 18:6a4db94011d3 | 656 | * of the transmit fifo is less than the configured threshold, |
sahilmgandhi | 18:6a4db94011d3 | 657 | * RAILCb_TxFifoAlmostEmpty() will fire. A value of 0 is invalid and will not |
sahilmgandhi | 18:6a4db94011d3 | 658 | * change the current configuration. |
sahilmgandhi | 18:6a4db94011d3 | 659 | */ |
sahilmgandhi | 18:6a4db94011d3 | 660 | uint16_t RAIL_SetTxFifoThreshold(uint16_t txThreshold); |
sahilmgandhi | 18:6a4db94011d3 | 661 | |
sahilmgandhi | 18:6a4db94011d3 | 662 | /** |
sahilmgandhi | 18:6a4db94011d3 | 663 | * Configure the RAIL receive fifo almost full threshold |
sahilmgandhi | 18:6a4db94011d3 | 664 | * |
sahilmgandhi | 18:6a4db94011d3 | 665 | * @param[in] rxThreshold Threshold once exceeded will fire |
sahilmgandhi | 18:6a4db94011d3 | 666 | * RAILCb_RxFifoAlmostFull() |
sahilmgandhi | 18:6a4db94011d3 | 667 | * @return Configured receive fifo threshold value |
sahilmgandhi | 18:6a4db94011d3 | 668 | * |
sahilmgandhi | 18:6a4db94011d3 | 669 | * This function configures the threshold for the transmit fifo. When the count |
sahilmgandhi | 18:6a4db94011d3 | 670 | * of the receive fifo is greater than the configured threshold, |
sahilmgandhi | 18:6a4db94011d3 | 671 | * RAILCb_RxFifoAlmostFull() will fire. A value of 0xFFFF is invalid and will |
sahilmgandhi | 18:6a4db94011d3 | 672 | * not change the current configuration. Depending on the hardware the maximum |
sahilmgandhi | 18:6a4db94011d3 | 673 | * value can vary. If the rxThreshold value exceeds the capability of the |
sahilmgandhi | 18:6a4db94011d3 | 674 | * hardware, the rx threshold will be configured so that it fires only when the |
sahilmgandhi | 18:6a4db94011d3 | 675 | * FIFO is one byte away from being full. |
sahilmgandhi | 18:6a4db94011d3 | 676 | * |
sahilmgandhi | 18:6a4db94011d3 | 677 | */ |
sahilmgandhi | 18:6a4db94011d3 | 678 | uint16_t RAIL_SetRxFifoThreshold(uint16_t rxThreshold); |
sahilmgandhi | 18:6a4db94011d3 | 679 | |
sahilmgandhi | 18:6a4db94011d3 | 680 | /** |
sahilmgandhi | 18:6a4db94011d3 | 681 | * Get the RAIL transmit fifo almost empty threshold value |
sahilmgandhi | 18:6a4db94011d3 | 682 | * |
sahilmgandhi | 18:6a4db94011d3 | 683 | * @return Configured Tx Threshold value |
sahilmgandhi | 18:6a4db94011d3 | 684 | * |
sahilmgandhi | 18:6a4db94011d3 | 685 | * Retrieve the configured tx threshold value |
sahilmgandhi | 18:6a4db94011d3 | 686 | */ |
sahilmgandhi | 18:6a4db94011d3 | 687 | uint16_t RAIL_GetTxFifoThreshold(void); |
sahilmgandhi | 18:6a4db94011d3 | 688 | |
sahilmgandhi | 18:6a4db94011d3 | 689 | /** |
sahilmgandhi | 18:6a4db94011d3 | 690 | * Get the RAIL receive fifo almost full threshold value |
sahilmgandhi | 18:6a4db94011d3 | 691 | * |
sahilmgandhi | 18:6a4db94011d3 | 692 | * @return Configured Rx Threshold value |
sahilmgandhi | 18:6a4db94011d3 | 693 | * |
sahilmgandhi | 18:6a4db94011d3 | 694 | * Retrieve the configured rx threshold value |
sahilmgandhi | 18:6a4db94011d3 | 695 | */ |
sahilmgandhi | 18:6a4db94011d3 | 696 | uint16_t RAIL_GetRxFifoThreshold(void); |
sahilmgandhi | 18:6a4db94011d3 | 697 | |
sahilmgandhi | 18:6a4db94011d3 | 698 | /** |
sahilmgandhi | 18:6a4db94011d3 | 699 | * Enable the RAIL receive fifo threshold interrupt |
sahilmgandhi | 18:6a4db94011d3 | 700 | * |
sahilmgandhi | 18:6a4db94011d3 | 701 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 702 | * |
sahilmgandhi | 18:6a4db94011d3 | 703 | * Enable the RAIL receive fifo threshold interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 704 | */ |
sahilmgandhi | 18:6a4db94011d3 | 705 | void RAIL_EnableRxFifoThreshold(void); |
sahilmgandhi | 18:6a4db94011d3 | 706 | |
sahilmgandhi | 18:6a4db94011d3 | 707 | /** |
sahilmgandhi | 18:6a4db94011d3 | 708 | * Disable the RAIL receive fifo threshold interrupt |
sahilmgandhi | 18:6a4db94011d3 | 709 | * |
sahilmgandhi | 18:6a4db94011d3 | 710 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 711 | * |
sahilmgandhi | 18:6a4db94011d3 | 712 | * Disable the RAIL receive fifo threshold interrupt. This is useful if the |
sahilmgandhi | 18:6a4db94011d3 | 713 | * application wishes to defer reading the receive fifo into another context. |
sahilmgandhi | 18:6a4db94011d3 | 714 | */ |
sahilmgandhi | 18:6a4db94011d3 | 715 | void RAIL_DisableRxFifoThreshold(void); |
sahilmgandhi | 18:6a4db94011d3 | 716 | |
sahilmgandhi | 18:6a4db94011d3 | 717 | /** |
sahilmgandhi | 18:6a4db94011d3 | 718 | * Reset the RAIL Fifos |
sahilmgandhi | 18:6a4db94011d3 | 719 | * |
sahilmgandhi | 18:6a4db94011d3 | 720 | * @param[in] txFifo If true, reset the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 721 | * @param[in] rxFifo If true, reset the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 722 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 723 | * |
sahilmgandhi | 18:6a4db94011d3 | 724 | * This function can reset each fifo. The application should not reset the Rx |
sahilmgandhi | 18:6a4db94011d3 | 725 | * Fifo while receiving a frame. |
sahilmgandhi | 18:6a4db94011d3 | 726 | */ |
sahilmgandhi | 18:6a4db94011d3 | 727 | //@TODO interrupt protect when clearing; need to check race conditions with hw team |
sahilmgandhi | 18:6a4db94011d3 | 728 | void RAIL_ResetFifo(bool txFifo, bool rxFifo); |
sahilmgandhi | 18:6a4db94011d3 | 729 | |
sahilmgandhi | 18:6a4db94011d3 | 730 | /** |
sahilmgandhi | 18:6a4db94011d3 | 731 | * Get the number of bytes in the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 732 | * |
sahilmgandhi | 18:6a4db94011d3 | 733 | * @return Number of bytes in the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 734 | * |
sahilmgandhi | 18:6a4db94011d3 | 735 | * Get the number of bytes in the receive fifo |
sahilmgandhi | 18:6a4db94011d3 | 736 | */ |
sahilmgandhi | 18:6a4db94011d3 | 737 | uint16_t RAIL_GetRxFifoBytesAvailable(void); |
sahilmgandhi | 18:6a4db94011d3 | 738 | |
sahilmgandhi | 18:6a4db94011d3 | 739 | /** |
sahilmgandhi | 18:6a4db94011d3 | 740 | * Get the number of bytes open in the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 741 | * |
sahilmgandhi | 18:6a4db94011d3 | 742 | * @return Number of bytes open in the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 743 | * |
sahilmgandhi | 18:6a4db94011d3 | 744 | * Get the number of bytes open in the transmit fifo |
sahilmgandhi | 18:6a4db94011d3 | 745 | */ |
sahilmgandhi | 18:6a4db94011d3 | 746 | uint16_t RAIL_GetTxFifoSpaceAvailable(void); |
sahilmgandhi | 18:6a4db94011d3 | 747 | |
sahilmgandhi | 18:6a4db94011d3 | 748 | /** |
sahilmgandhi | 18:6a4db94011d3 | 749 | * Callback that fires when the receive fifo exceeds the configured threshold |
sahilmgandhi | 18:6a4db94011d3 | 750 | * value |
sahilmgandhi | 18:6a4db94011d3 | 751 | * |
sahilmgandhi | 18:6a4db94011d3 | 752 | * @param[in] bytesAvailable Number of bytes available in the receive fifo at |
sahilmgandhi | 18:6a4db94011d3 | 753 | * the time of the callback dispatch |
sahilmgandhi | 18:6a4db94011d3 | 754 | * |
sahilmgandhi | 18:6a4db94011d3 | 755 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 756 | * @warning You must implement a stub for this in your RAIL application. |
sahilmgandhi | 18:6a4db94011d3 | 757 | * |
sahilmgandhi | 18:6a4db94011d3 | 758 | * Callback that fires when the receive fifo exceeds the configured threshold |
sahilmgandhi | 18:6a4db94011d3 | 759 | * value. Provides the number of bytes available in the receive fifo at the |
sahilmgandhi | 18:6a4db94011d3 | 760 | * time of the callback dispatch. |
sahilmgandhi | 18:6a4db94011d3 | 761 | */ |
sahilmgandhi | 18:6a4db94011d3 | 762 | void RAILCb_RxFifoAlmostFull(uint16_t bytesAvailable); |
sahilmgandhi | 18:6a4db94011d3 | 763 | |
sahilmgandhi | 18:6a4db94011d3 | 764 | /** |
sahilmgandhi | 18:6a4db94011d3 | 765 | * Callback that fires when the transmit fifo falls under the configured |
sahilmgandhi | 18:6a4db94011d3 | 766 | * threshold value |
sahilmgandhi | 18:6a4db94011d3 | 767 | * |
sahilmgandhi | 18:6a4db94011d3 | 768 | * @param[in] spaceAvailable Number of bytes open in the transmit fifo at the |
sahilmgandhi | 18:6a4db94011d3 | 769 | * time of the callback dispatch |
sahilmgandhi | 18:6a4db94011d3 | 770 | * |
sahilmgandhi | 18:6a4db94011d3 | 771 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 772 | * @warning You must implement a stub for this in your RAIL application. |
sahilmgandhi | 18:6a4db94011d3 | 773 | * |
sahilmgandhi | 18:6a4db94011d3 | 774 | * Callback that fires when the transmit fifo falls under the configured |
sahilmgandhi | 18:6a4db94011d3 | 775 | * threshold value. It only fires if a rising edge occurs across this |
sahilmgandhi | 18:6a4db94011d3 | 776 | * threshold. This callback will not fire on initailization nor after resetting |
sahilmgandhi | 18:6a4db94011d3 | 777 | * the transmit fifo with RAIL_ResetFifo(). |
sahilmgandhi | 18:6a4db94011d3 | 778 | * |
sahilmgandhi | 18:6a4db94011d3 | 779 | * Provides the number of bytes open in the transmit fifo at the time of the |
sahilmgandhi | 18:6a4db94011d3 | 780 | * callback dispatch. |
sahilmgandhi | 18:6a4db94011d3 | 781 | */ |
sahilmgandhi | 18:6a4db94011d3 | 782 | void RAILCb_TxFifoAlmostEmpty(uint16_t spaceAvailable); |
sahilmgandhi | 18:6a4db94011d3 | 783 | /** |
sahilmgandhi | 18:6a4db94011d3 | 784 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 785 | */ |
sahilmgandhi | 18:6a4db94011d3 | 786 | |
sahilmgandhi | 18:6a4db94011d3 | 787 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 788 | * Timing Information |
sahilmgandhi | 18:6a4db94011d3 | 789 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 790 | /** |
sahilmgandhi | 18:6a4db94011d3 | 791 | * @addtogroup System_Timing |
sahilmgandhi | 18:6a4db94011d3 | 792 | * @brief Functionality related to the RAIL timer and general system time. |
sahilmgandhi | 18:6a4db94011d3 | 793 | * |
sahilmgandhi | 18:6a4db94011d3 | 794 | * These functions can be used to get information about the current system time |
sahilmgandhi | 18:6a4db94011d3 | 795 | * or to manipulate the RAIL timer. |
sahilmgandhi | 18:6a4db94011d3 | 796 | * |
sahilmgandhi | 18:6a4db94011d3 | 797 | * The system time returned by RAIL_GetTime() is in the same timebase that is |
sahilmgandhi | 18:6a4db94011d3 | 798 | * used throughout RAIL. Any callbacks that return a timestamp (like |
sahilmgandhi | 18:6a4db94011d3 | 799 | * RAILCb_RxPacketReceived()) will use this same timebase as will any APIs that |
sahilmgandhi | 18:6a4db94011d3 | 800 | * accept an absolute time for scheduling their action. Throughout this |
sahilmgandhi | 18:6a4db94011d3 | 801 | * documentation the timebase used for this will be referred to as the RAIL |
sahilmgandhi | 18:6a4db94011d3 | 802 | * timebase. This is currently a value in microseconds from chip boot time. This |
sahilmgandhi | 18:6a4db94011d3 | 803 | * means that it will wrap every 1.19 hours |
sahilmgandhi | 18:6a4db94011d3 | 804 | * (`(2^32 - 1) / (3600 sec/hr * 1000000 us/sec)`). |
sahilmgandhi | 18:6a4db94011d3 | 805 | * |
sahilmgandhi | 18:6a4db94011d3 | 806 | * The provided timer is hardware backed and interrupt driven. It can be used |
sahilmgandhi | 18:6a4db94011d3 | 807 | * for timing any event in your system, but will be especially helpful for |
sahilmgandhi | 18:6a4db94011d3 | 808 | * timing protocol based state machines and other systems that interact with |
sahilmgandhi | 18:6a4db94011d3 | 809 | * the radio. If you do not want to process the expiration in interrupt context |
sahilmgandhi | 18:6a4db94011d3 | 810 | * you can leave the RAILCb_TimerExpired() callback empty and poll for |
sahilmgandhi | 18:6a4db94011d3 | 811 | * expiration with the RAIL_TimerExpired() function. |
sahilmgandhi | 18:6a4db94011d3 | 812 | * |
sahilmgandhi | 18:6a4db94011d3 | 813 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 814 | */ |
sahilmgandhi | 18:6a4db94011d3 | 815 | |
sahilmgandhi | 18:6a4db94011d3 | 816 | /** |
sahilmgandhi | 18:6a4db94011d3 | 817 | * Get the current RAIL time |
sahilmgandhi | 18:6a4db94011d3 | 818 | * |
sahilmgandhi | 18:6a4db94011d3 | 819 | * @return Returns the RAIL timebase in microseconds. Note that this wraps after |
sahilmgandhi | 18:6a4db94011d3 | 820 | * around 1.19 hours since it's stored in a 32bit value. |
sahilmgandhi | 18:6a4db94011d3 | 821 | * |
sahilmgandhi | 18:6a4db94011d3 | 822 | * Return the current time in the RAIL timebase (microseconds). This can be |
sahilmgandhi | 18:6a4db94011d3 | 823 | * used to compare with packet timestamps or to schedule transmits. |
sahilmgandhi | 18:6a4db94011d3 | 824 | */ |
sahilmgandhi | 18:6a4db94011d3 | 825 | uint32_t RAIL_GetTime(void); |
sahilmgandhi | 18:6a4db94011d3 | 826 | |
sahilmgandhi | 18:6a4db94011d3 | 827 | /** |
sahilmgandhi | 18:6a4db94011d3 | 828 | * Set the current RAIL time |
sahilmgandhi | 18:6a4db94011d3 | 829 | * |
sahilmgandhi | 18:6a4db94011d3 | 830 | * @param[in] time Set the RAIL timebase to this value in microseconds. |
sahilmgandhi | 18:6a4db94011d3 | 831 | * @return Returns RAIL_STATUS_NO_ERROR on success and |
sahilmgandhi | 18:6a4db94011d3 | 832 | * RAIL_STATUS_INVALID_STATE if the time could not be set. |
sahilmgandhi | 18:6a4db94011d3 | 833 | * |
sahilmgandhi | 18:6a4db94011d3 | 834 | * Set the current time in the RAIL timebase in microseconds. |
sahilmgandhi | 18:6a4db94011d3 | 835 | */ |
sahilmgandhi | 18:6a4db94011d3 | 836 | RAIL_Status_t RAIL_SetTime(uint32_t time); |
sahilmgandhi | 18:6a4db94011d3 | 837 | |
sahilmgandhi | 18:6a4db94011d3 | 838 | /** |
sahilmgandhi | 18:6a4db94011d3 | 839 | * Set a timer via the RAIL timebase |
sahilmgandhi | 18:6a4db94011d3 | 840 | * |
sahilmgandhi | 18:6a4db94011d3 | 841 | * @param[in] time The time to delay for in the RAIL timebase. |
sahilmgandhi | 18:6a4db94011d3 | 842 | * @param[in] mode The timer mode can be relative to now or an absolute time. |
sahilmgandhi | 18:6a4db94011d3 | 843 | * @return Returns RAIL_STATUS_NO_ERROR on success and |
sahilmgandhi | 18:6a4db94011d3 | 844 | * RAIL_STATUS_INVALID_PARAMETER if the timer could not be scheduled. |
sahilmgandhi | 18:6a4db94011d3 | 845 | * |
sahilmgandhi | 18:6a4db94011d3 | 846 | * Configure a timer to fire after some period in the RAIL timebase. This timer |
sahilmgandhi | 18:6a4db94011d3 | 847 | * can be used to implement low level protocol features. |
sahilmgandhi | 18:6a4db94011d3 | 848 | */ |
sahilmgandhi | 18:6a4db94011d3 | 849 | RAIL_Status_t RAIL_TimerSet(uint32_t time, RAIL_TimeMode_t mode); |
sahilmgandhi | 18:6a4db94011d3 | 850 | |
sahilmgandhi | 18:6a4db94011d3 | 851 | /** |
sahilmgandhi | 18:6a4db94011d3 | 852 | * Return the absolute time that the RAIL timer is configured to fire at. |
sahilmgandhi | 18:6a4db94011d3 | 853 | * |
sahilmgandhi | 18:6a4db94011d3 | 854 | * @return The absolute time that this timer is set to go off at. |
sahilmgandhi | 18:6a4db94011d3 | 855 | * |
sahilmgandhi | 18:6a4db94011d3 | 856 | * This will give the absolute time regardless of the \ref RAIL_TimeMode_t that |
sahilmgandhi | 18:6a4db94011d3 | 857 | * was passed into \ref RAIL_TimerSet. The return value is undefined if the |
sahilmgandhi | 18:6a4db94011d3 | 858 | * timer was never set. |
sahilmgandhi | 18:6a4db94011d3 | 859 | */ |
sahilmgandhi | 18:6a4db94011d3 | 860 | uint32_t RAIL_TimerGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 861 | |
sahilmgandhi | 18:6a4db94011d3 | 862 | /** |
sahilmgandhi | 18:6a4db94011d3 | 863 | * Stop the currently scheduled RAIL timer. |
sahilmgandhi | 18:6a4db94011d3 | 864 | * |
sahilmgandhi | 18:6a4db94011d3 | 865 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 866 | * |
sahilmgandhi | 18:6a4db94011d3 | 867 | * Cancels the timer. If this is called before the timer fires, then |
sahilmgandhi | 18:6a4db94011d3 | 868 | * RAILCb_TimerExpired will never be called. |
sahilmgandhi | 18:6a4db94011d3 | 869 | */ |
sahilmgandhi | 18:6a4db94011d3 | 870 | void RAIL_TimerCancel(void); |
sahilmgandhi | 18:6a4db94011d3 | 871 | |
sahilmgandhi | 18:6a4db94011d3 | 872 | /** |
sahilmgandhi | 18:6a4db94011d3 | 873 | * Check to see if the RAIL timer has expired |
sahilmgandhi | 18:6a4db94011d3 | 874 | * |
sahilmgandhi | 18:6a4db94011d3 | 875 | * @return True if the previously scheduled timer has fired and false otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 876 | * |
sahilmgandhi | 18:6a4db94011d3 | 877 | * This is cleared on RAIL_TimerSet() and will be set when the delay expires. |
sahilmgandhi | 18:6a4db94011d3 | 878 | * This function can be used as an alternative to RAILCb_TimerExpired using |
sahilmgandhi | 18:6a4db94011d3 | 879 | * polling. If this is the case, implement RAILCb_TimerExpired as a stub. |
sahilmgandhi | 18:6a4db94011d3 | 880 | */ |
sahilmgandhi | 18:6a4db94011d3 | 881 | bool RAIL_TimerExpired(void); |
sahilmgandhi | 18:6a4db94011d3 | 882 | |
sahilmgandhi | 18:6a4db94011d3 | 883 | /** |
sahilmgandhi | 18:6a4db94011d3 | 884 | * See if the RAIL timer is currently running |
sahilmgandhi | 18:6a4db94011d3 | 885 | * |
sahilmgandhi | 18:6a4db94011d3 | 886 | * @return Returns true if the timer is running and false otherwise |
sahilmgandhi | 18:6a4db94011d3 | 887 | * |
sahilmgandhi | 18:6a4db94011d3 | 888 | * Will return false if the timer was never set or has expired. |
sahilmgandhi | 18:6a4db94011d3 | 889 | */ |
sahilmgandhi | 18:6a4db94011d3 | 890 | bool RAIL_TimerIsRunning(void); |
sahilmgandhi | 18:6a4db94011d3 | 891 | |
sahilmgandhi | 18:6a4db94011d3 | 892 | /** |
sahilmgandhi | 18:6a4db94011d3 | 893 | * This function is called when the RAIL timer expires |
sahilmgandhi | 18:6a4db94011d3 | 894 | * |
sahilmgandhi | 18:6a4db94011d3 | 895 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 896 | * |
sahilmgandhi | 18:6a4db94011d3 | 897 | * You must implement a stub for this in your RAIL application even if you |
sahilmgandhi | 18:6a4db94011d3 | 898 | * don't use the timer. You can use this callback for low-level protocol |
sahilmgandhi | 18:6a4db94011d3 | 899 | * features. |
sahilmgandhi | 18:6a4db94011d3 | 900 | */ |
sahilmgandhi | 18:6a4db94011d3 | 901 | void RAILCb_TimerExpired(void); |
sahilmgandhi | 18:6a4db94011d3 | 902 | |
sahilmgandhi | 18:6a4db94011d3 | 903 | /** |
sahilmgandhi | 18:6a4db94011d3 | 904 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 905 | */ |
sahilmgandhi | 18:6a4db94011d3 | 906 | |
sahilmgandhi | 18:6a4db94011d3 | 907 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 908 | * Radio Configuration |
sahilmgandhi | 18:6a4db94011d3 | 909 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 910 | /** |
sahilmgandhi | 18:6a4db94011d3 | 911 | * @addtogroup Radio_Configuration |
sahilmgandhi | 18:6a4db94011d3 | 912 | * @brief Routines for setting up and querying radio configuration information. |
sahilmgandhi | 18:6a4db94011d3 | 913 | * |
sahilmgandhi | 18:6a4db94011d3 | 914 | * All of these routines allow for runtime flexibility in your radio |
sahilmgandhi | 18:6a4db94011d3 | 915 | * configuration. Some of the parameters, however, are meant to be generated |
sahilmgandhi | 18:6a4db94011d3 | 916 | * from the radio calculator in Simplicity Studio. The basic code to configure |
sahilmgandhi | 18:6a4db94011d3 | 917 | * the radio from this calculator output looks like the example below. |
sahilmgandhi | 18:6a4db94011d3 | 918 | * |
sahilmgandhi | 18:6a4db94011d3 | 919 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 920 | * // Apply the selected RADIO configuration |
sahilmgandhi | 18:6a4db94011d3 | 921 | * if (RAIL_RadioConfig((void*)configList[0])) { |
sahilmgandhi | 18:6a4db94011d3 | 922 | * // Error: Could not apply the radio configuration |
sahilmgandhi | 18:6a4db94011d3 | 923 | * while(1); |
sahilmgandhi | 18:6a4db94011d3 | 924 | * } |
sahilmgandhi | 18:6a4db94011d3 | 925 | * |
sahilmgandhi | 18:6a4db94011d3 | 926 | * // Configure the packet configuration for this PHY |
sahilmgandhi | 18:6a4db94011d3 | 927 | * RAIL_PacketLengthConfigFrameType(frameTypeConfigList[0]); |
sahilmgandhi | 18:6a4db94011d3 | 928 | * |
sahilmgandhi | 18:6a4db94011d3 | 929 | * // Set up the channel configuration for this PHY |
sahilmgandhi | 18:6a4db94011d3 | 930 | * RAIL_ChannelConfig(channelConfigs[0]); |
sahilmgandhi | 18:6a4db94011d3 | 931 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 932 | * |
sahilmgandhi | 18:6a4db94011d3 | 933 | * For more information about the types of parameters that can be changed in |
sahilmgandhi | 18:6a4db94011d3 | 934 | * the other functions and how to use them see their individual documentation. |
sahilmgandhi | 18:6a4db94011d3 | 935 | * |
sahilmgandhi | 18:6a4db94011d3 | 936 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 937 | */ |
sahilmgandhi | 18:6a4db94011d3 | 938 | |
sahilmgandhi | 18:6a4db94011d3 | 939 | /** |
sahilmgandhi | 18:6a4db94011d3 | 940 | * Load a static radio configuration |
sahilmgandhi | 18:6a4db94011d3 | 941 | * |
sahilmgandhi | 18:6a4db94011d3 | 942 | * @param[in] radioConfig Pointer to a radio configuration array |
sahilmgandhi | 18:6a4db94011d3 | 943 | * @return A non-zero value on failure and zero on success |
sahilmgandhi | 18:6a4db94011d3 | 944 | * |
sahilmgandhi | 18:6a4db94011d3 | 945 | * The radioConfig passed into this function should be generated for you, and |
sahilmgandhi | 18:6a4db94011d3 | 946 | * not created or edited by hand. |
sahilmgandhi | 18:6a4db94011d3 | 947 | */ |
sahilmgandhi | 18:6a4db94011d3 | 948 | uint8_t RAIL_RadioConfig(void *radioConfig); |
sahilmgandhi | 18:6a4db94011d3 | 949 | |
sahilmgandhi | 18:6a4db94011d3 | 950 | /** |
sahilmgandhi | 18:6a4db94011d3 | 951 | * Configure the length to use for received packets to be variable based on an |
sahilmgandhi | 18:6a4db94011d3 | 952 | * implicit length field in payload bytes |
sahilmgandhi | 18:6a4db94011d3 | 953 | * |
sahilmgandhi | 18:6a4db94011d3 | 954 | * @param[in] frameType Frame type configuration structure. |
sahilmgandhi | 18:6a4db94011d3 | 955 | * |
sahilmgandhi | 18:6a4db94011d3 | 956 | * Currently the frame type passed in only handles packet length decoding. If |
sahilmgandhi | 18:6a4db94011d3 | 957 | * NULL is passed into this function, it will clear any currently configured |
sahilmgandhi | 18:6a4db94011d3 | 958 | * frame type settings. |
sahilmgandhi | 18:6a4db94011d3 | 959 | */ |
sahilmgandhi | 18:6a4db94011d3 | 960 | void RAIL_PacketLengthConfigFrameType(const RAIL_FrameType_t *frameType); |
sahilmgandhi | 18:6a4db94011d3 | 961 | |
sahilmgandhi | 18:6a4db94011d3 | 962 | /** |
sahilmgandhi | 18:6a4db94011d3 | 963 | * Configure the channels supported by this device |
sahilmgandhi | 18:6a4db94011d3 | 964 | * |
sahilmgandhi | 18:6a4db94011d3 | 965 | * @param[in] config A pointer to the channel configuration for your device. |
sahilmgandhi | 18:6a4db94011d3 | 966 | * This pointer will be cached in the library so it must be something that |
sahilmgandhi | 18:6a4db94011d3 | 967 | * will exist for the runtime of the application. Typically this should be |
sahilmgandhi | 18:6a4db94011d3 | 968 | * what is stored in Flash by the configuration tool. |
sahilmgandhi | 18:6a4db94011d3 | 969 | * @return Returns first available channel in config. |
sahilmgandhi | 18:6a4db94011d3 | 970 | * |
sahilmgandhi | 18:6a4db94011d3 | 971 | * When configuring channels on the EFR32, the Synth will be reconfigured based |
sahilmgandhi | 18:6a4db94011d3 | 972 | * on the frequency and channel spacing in config. |
sahilmgandhi | 18:6a4db94011d3 | 973 | */ |
sahilmgandhi | 18:6a4db94011d3 | 974 | uint8_t RAIL_ChannelConfig(const RAIL_ChannelConfig_t * config); |
sahilmgandhi | 18:6a4db94011d3 | 975 | |
sahilmgandhi | 18:6a4db94011d3 | 976 | /** |
sahilmgandhi | 18:6a4db94011d3 | 977 | * Check to see if the channel exists in RAIL |
sahilmgandhi | 18:6a4db94011d3 | 978 | * |
sahilmgandhi | 18:6a4db94011d3 | 979 | * @param[in] channel Channel number to check |
sahilmgandhi | 18:6a4db94011d3 | 980 | * @return Returns 1 on failure, returns 0 on channel exists |
sahilmgandhi | 18:6a4db94011d3 | 981 | * |
sahilmgandhi | 18:6a4db94011d3 | 982 | * Will return 1 if the given channel does not exist in the channel config |
sahilmgandhi | 18:6a4db94011d3 | 983 | * currently being used, and 0 if the channel is valid. |
sahilmgandhi | 18:6a4db94011d3 | 984 | */ |
sahilmgandhi | 18:6a4db94011d3 | 985 | RAIL_Status_t RAIL_ChannelExists(uint8_t channel); |
sahilmgandhi | 18:6a4db94011d3 | 986 | |
sahilmgandhi | 18:6a4db94011d3 | 987 | /** |
sahilmgandhi | 18:6a4db94011d3 | 988 | * Return the symbol rate for the current PHY |
sahilmgandhi | 18:6a4db94011d3 | 989 | * |
sahilmgandhi | 18:6a4db94011d3 | 990 | * @return The symbol rate in symbols per second |
sahilmgandhi | 18:6a4db94011d3 | 991 | * |
sahilmgandhi | 18:6a4db94011d3 | 992 | * The symbol rate is the rate of symbol changes over the air. For non-DSSS |
sahilmgandhi | 18:6a4db94011d3 | 993 | * PHYs this is the same as the baudrate. For DSSS PHYs it is the baudrate |
sahilmgandhi | 18:6a4db94011d3 | 994 | * divided by the length of a chipping sequence. For more information on this |
sahilmgandhi | 18:6a4db94011d3 | 995 | * consult the modem calculator documentation. |
sahilmgandhi | 18:6a4db94011d3 | 996 | */ |
sahilmgandhi | 18:6a4db94011d3 | 997 | uint32_t RAIL_SymbolRateGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 998 | |
sahilmgandhi | 18:6a4db94011d3 | 999 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1000 | * Return the bit rate for the current PHY |
sahilmgandhi | 18:6a4db94011d3 | 1001 | * |
sahilmgandhi | 18:6a4db94011d3 | 1002 | * @return The bit rate in bits per second |
sahilmgandhi | 18:6a4db94011d3 | 1003 | * |
sahilmgandhi | 18:6a4db94011d3 | 1004 | * The bit rate is the effective over the air data rate. It does not account |
sahilmgandhi | 18:6a4db94011d3 | 1005 | * for extra spreading you may do for things like forward error correction, but |
sahilmgandhi | 18:6a4db94011d3 | 1006 | * will account for modulation schemes, DSSS, and other configurations. For more |
sahilmgandhi | 18:6a4db94011d3 | 1007 | * information on this consult the modem calculator documentation. |
sahilmgandhi | 18:6a4db94011d3 | 1008 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1009 | uint32_t RAIL_BitRateGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 1010 | |
sahilmgandhi | 18:6a4db94011d3 | 1011 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1012 | * Set the PA capacitor tune value for transmit and receive |
sahilmgandhi | 18:6a4db94011d3 | 1013 | * |
sahilmgandhi | 18:6a4db94011d3 | 1014 | * @param[in] txPaCtuneValue PA Ctune value for TX mode |
sahilmgandhi | 18:6a4db94011d3 | 1015 | * @param[in] rxPaCtuneValue PA Ctune value for RX mode |
sahilmgandhi | 18:6a4db94011d3 | 1016 | * |
sahilmgandhi | 18:6a4db94011d3 | 1017 | * @return returns RAIL_STATUS_NO_ERROR if successful |
sahilmgandhi | 18:6a4db94011d3 | 1018 | * |
sahilmgandhi | 18:6a4db94011d3 | 1019 | * Provides the ability to tune the impedance of the transmit |
sahilmgandhi | 18:6a4db94011d3 | 1020 | * and receive modes by changing the amount of capacitance at |
sahilmgandhi | 18:6a4db94011d3 | 1021 | * the PA output. |
sahilmgandhi | 18:6a4db94011d3 | 1022 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1023 | RAIL_Status_t RAIL_PaCtuneSet(uint8_t txPaCtuneValue, uint8_t rxPaCtuneValue); |
sahilmgandhi | 18:6a4db94011d3 | 1024 | |
sahilmgandhi | 18:6a4db94011d3 | 1025 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1026 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 1027 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1028 | |
sahilmgandhi | 18:6a4db94011d3 | 1029 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1030 | * Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1031 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1032 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1033 | * @addtogroup Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1034 | * @brief APIs related to transmitting data packets |
sahilmgandhi | 18:6a4db94011d3 | 1035 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1036 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1037 | |
sahilmgandhi | 18:6a4db94011d3 | 1038 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1039 | * Set the radio transmit power level |
sahilmgandhi | 18:6a4db94011d3 | 1040 | * |
sahilmgandhi | 18:6a4db94011d3 | 1041 | * @param[in] powerLevel TX Power Level defined in deci dBm (10 * dBm) |
sahilmgandhi | 18:6a4db94011d3 | 1042 | * @return TX Power Level in deci dBm (10 * dBm) |
sahilmgandhi | 18:6a4db94011d3 | 1043 | * |
sahilmgandhi | 18:6a4db94011d3 | 1044 | * Not all values of powerLevel are achievable, but this function will set the |
sahilmgandhi | 18:6a4db94011d3 | 1045 | * power output to be close to the given powerLevel, and return the value that |
sahilmgandhi | 18:6a4db94011d3 | 1046 | * was set as the power. |
sahilmgandhi | 18:6a4db94011d3 | 1047 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1048 | int32_t RAIL_TxPowerSet(int32_t powerLevel); |
sahilmgandhi | 18:6a4db94011d3 | 1049 | |
sahilmgandhi | 18:6a4db94011d3 | 1050 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1051 | * Get the radio transmit power level |
sahilmgandhi | 18:6a4db94011d3 | 1052 | * |
sahilmgandhi | 18:6a4db94011d3 | 1053 | * @return TX Power Level defined in deci dBm (10 * dBm) |
sahilmgandhi | 18:6a4db94011d3 | 1054 | * |
sahilmgandhi | 18:6a4db94011d3 | 1055 | * This will return what the power output was actually set to, not just the |
sahilmgandhi | 18:6a4db94011d3 | 1056 | * value passed into RAIL_TxPowerSet. |
sahilmgandhi | 18:6a4db94011d3 | 1057 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1058 | int32_t RAIL_TxPowerGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 1059 | |
sahilmgandhi | 18:6a4db94011d3 | 1060 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1061 | * Configure which radio transmit actions trigger callbacks |
sahilmgandhi | 18:6a4db94011d3 | 1062 | * |
sahilmgandhi | 18:6a4db94011d3 | 1063 | * @param[in] cbToEnable Define which callbacks to trigger for transmit events. |
sahilmgandhi | 18:6a4db94011d3 | 1064 | * The full list of available callabcks can be found by looking at the |
sahilmgandhi | 18:6a4db94011d3 | 1065 | * RAIL_TX_CONFIG_* set of defines. |
sahilmgandhi | 18:6a4db94011d3 | 1066 | * @return Return 0 for success or an error code |
sahilmgandhi | 18:6a4db94011d3 | 1067 | * |
sahilmgandhi | 18:6a4db94011d3 | 1068 | * Setup which receive interrupts will generate a RAILCb_TxRadioStatus() |
sahilmgandhi | 18:6a4db94011d3 | 1069 | * callback. The full list of options is any define that starts with |
sahilmgandhi | 18:6a4db94011d3 | 1070 | * RAIL_TX_CONFIG_. Before this function is called, the actions which will |
sahilmgandhi | 18:6a4db94011d3 | 1071 | * generate callbacks are: |
sahilmgandhi | 18:6a4db94011d3 | 1072 | * - \ref RAIL_TX_CONFIG_BUFFER_UNDERFLOW |
sahilmgandhi | 18:6a4db94011d3 | 1073 | * - \ref RAIL_TX_CONFIG_CHANNEL_BUSY |
sahilmgandhi | 18:6a4db94011d3 | 1074 | * - \ref RAIL_TX_CONFIG_TX_ABORTED |
sahilmgandhi | 18:6a4db94011d3 | 1075 | * - \ref RAIL_TX_CONFIG_TX_BLOCKED |
sahilmgandhi | 18:6a4db94011d3 | 1076 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1077 | RAIL_Status_t RAIL_TxConfig(uint32_t cbToEnable); |
sahilmgandhi | 18:6a4db94011d3 | 1078 | |
sahilmgandhi | 18:6a4db94011d3 | 1079 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1080 | * Load payload to transmit. |
sahilmgandhi | 18:6a4db94011d3 | 1081 | * |
sahilmgandhi | 18:6a4db94011d3 | 1082 | * @param[in] txData Pointer to a RAIL_TxData_t structure which defines the |
sahilmgandhi | 18:6a4db94011d3 | 1083 | * payload bytes and the number of bytes to write into the transmit buffer. |
sahilmgandhi | 18:6a4db94011d3 | 1084 | * @return Returns 0 on success and an error code on fail. |
sahilmgandhi | 18:6a4db94011d3 | 1085 | * |
sahilmgandhi | 18:6a4db94011d3 | 1086 | * This function will overwrite current TX data held by RAIL, and will return |
sahilmgandhi | 18:6a4db94011d3 | 1087 | * an error if called during transmit operations. RAIL_TxData_t.dataLength |
sahilmgandhi | 18:6a4db94011d3 | 1088 | * defines the number of bytes to load into the transmit buffer from |
sahilmgandhi | 18:6a4db94011d3 | 1089 | * RAIL_TxData_t.dataPtr while the number of bytes transmitted is determined by |
sahilmgandhi | 18:6a4db94011d3 | 1090 | * the packet configuration defined in the radio configuration. |
sahilmgandhi | 18:6a4db94011d3 | 1091 | * |
sahilmgandhi | 18:6a4db94011d3 | 1092 | * @note This function creates a critical section while writing to the transmit |
sahilmgandhi | 18:6a4db94011d3 | 1093 | * buffer. |
sahilmgandhi | 18:6a4db94011d3 | 1094 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1095 | uint8_t RAIL_TxDataLoad(RAIL_TxData_t *txData); |
sahilmgandhi | 18:6a4db94011d3 | 1096 | |
sahilmgandhi | 18:6a4db94011d3 | 1097 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1098 | * Non-blocking Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1099 | * |
sahilmgandhi | 18:6a4db94011d3 | 1100 | * @param[in] channel Define the channel to transmit on. |
sahilmgandhi | 18:6a4db94011d3 | 1101 | * @param[in] preTxOp Function to use for any pre-transmit operation (e.g. for |
sahilmgandhi | 18:6a4db94011d3 | 1102 | * scheduled transmit, CSMA, LBT, etc.), or NULL for an immediate transmit. |
sahilmgandhi | 18:6a4db94011d3 | 1103 | * @param[in] preTxOpParams Pointer to the pre-transmit operation's |
sahilmgandhi | 18:6a4db94011d3 | 1104 | * configuration parameters, or NULL if none. |
sahilmgandhi | 18:6a4db94011d3 | 1105 | * @return Returns 0 on successfully initiating the transmit process, or an |
sahilmgandhi | 18:6a4db94011d3 | 1106 | * error code on failure. If successfully initiated, transmit completion |
sahilmgandhi | 18:6a4db94011d3 | 1107 | * or failure will be reported by later callbacks RAILCb_TxPacketSent() |
sahilmgandhi | 18:6a4db94011d3 | 1108 | * (success) or RAILCb_TxRadioStatus() (failure). |
sahilmgandhi | 18:6a4db94011d3 | 1109 | * |
sahilmgandhi | 18:6a4db94011d3 | 1110 | * Begins transmission of the payload previously loaded via RAIL_TxDataLoad(). |
sahilmgandhi | 18:6a4db94011d3 | 1111 | * Will begin transmitting after a received packet if currently receiving a |
sahilmgandhi | 18:6a4db94011d3 | 1112 | * packet. Returns error if the radio is active and the channel needs to be |
sahilmgandhi | 18:6a4db94011d3 | 1113 | * changed. |
sahilmgandhi | 18:6a4db94011d3 | 1114 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1115 | uint8_t RAIL_TxStart(uint8_t channel, |
sahilmgandhi | 18:6a4db94011d3 | 1116 | RAIL_PreTxOp_t preTxOp, |
sahilmgandhi | 18:6a4db94011d3 | 1117 | void *preTxOpParams); |
sahilmgandhi | 18:6a4db94011d3 | 1118 | |
sahilmgandhi | 18:6a4db94011d3 | 1119 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1120 | * Non-blocking Transmit with options |
sahilmgandhi | 18:6a4db94011d3 | 1121 | * |
sahilmgandhi | 18:6a4db94011d3 | 1122 | * @param[in] channel Define the channel to transmit on. |
sahilmgandhi | 18:6a4db94011d3 | 1123 | * @param[in] options Defines options that apply for this transmit |
sahilmgandhi | 18:6a4db94011d3 | 1124 | * @param[in] preTxOp Function to use for any pre-transmit operation (e.g. for |
sahilmgandhi | 18:6a4db94011d3 | 1125 | * scheduled transmit, CSMA, LBT, etc.), or NULL for an immediate transmit. |
sahilmgandhi | 18:6a4db94011d3 | 1126 | * @param[in] preTxOpParams Pointer to the pre-transmit operation's |
sahilmgandhi | 18:6a4db94011d3 | 1127 | * configuration parameters, or NULL if none. |
sahilmgandhi | 18:6a4db94011d3 | 1128 | * @return Returns 0 on successfully initiating the transmit process, or an |
sahilmgandhi | 18:6a4db94011d3 | 1129 | * error code on failure. If successfully initiated, transmit completion |
sahilmgandhi | 18:6a4db94011d3 | 1130 | * or failure will be reported by later callbacks RAILCb_TxPacketSent() |
sahilmgandhi | 18:6a4db94011d3 | 1131 | * (success) or RAILCb_TxRadioStatus() (failure). |
sahilmgandhi | 18:6a4db94011d3 | 1132 | * |
sahilmgandhi | 18:6a4db94011d3 | 1133 | * This is an extension of RAIL_TxStart where the transmit is modified by the |
sahilmgandhi | 18:6a4db94011d3 | 1134 | * options defined in RAIL_TxOptions_t. If using a pre-tx operation, the |
sahilmgandhi | 18:6a4db94011d3 | 1135 | * transmit options will only be configured if the preTxOp is successful. |
sahilmgandhi | 18:6a4db94011d3 | 1136 | * |
sahilmgandhi | 18:6a4db94011d3 | 1137 | * Begins transmission of the payload previously loaded via RAIL_TxDataLoad(). |
sahilmgandhi | 18:6a4db94011d3 | 1138 | * Will begin transmitting after a received packet if currently receiving a |
sahilmgandhi | 18:6a4db94011d3 | 1139 | * packet. Returns error if the radio is active and the channel needs to be |
sahilmgandhi | 18:6a4db94011d3 | 1140 | * changed. |
sahilmgandhi | 18:6a4db94011d3 | 1141 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1142 | uint8_t RAIL_TxStartWithOptions(uint8_t channel, |
sahilmgandhi | 18:6a4db94011d3 | 1143 | RAIL_TxOptions_t *options, |
sahilmgandhi | 18:6a4db94011d3 | 1144 | RAIL_PreTxOp_t preTxOp, |
sahilmgandhi | 18:6a4db94011d3 | 1145 | void *preTxOpParams); |
sahilmgandhi | 18:6a4db94011d3 | 1146 | |
sahilmgandhi | 18:6a4db94011d3 | 1147 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1148 | * Interrupt level callback to signify when the packet was sent |
sahilmgandhi | 18:6a4db94011d3 | 1149 | * |
sahilmgandhi | 18:6a4db94011d3 | 1150 | * @param txPacketInfo Information about the packet that was transmitted. |
sahilmgandhi | 18:6a4db94011d3 | 1151 | * @note that this structure is only valid during the timeframe of the |
sahilmgandhi | 18:6a4db94011d3 | 1152 | * callback. |
sahilmgandhi | 18:6a4db94011d3 | 1153 | * |
sahilmgandhi | 18:6a4db94011d3 | 1154 | * Currently the RAIL_TxPacketInfo_t only contains the time when the packet |
sahilmgandhi | 18:6a4db94011d3 | 1155 | * was transmitted. |
sahilmgandhi | 18:6a4db94011d3 | 1156 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1157 | void RAILCb_TxPacketSent(RAIL_TxPacketInfo_t *txPacketInfo); |
sahilmgandhi | 18:6a4db94011d3 | 1158 | |
sahilmgandhi | 18:6a4db94011d3 | 1159 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1160 | * Callback to indicate an error with a transmission |
sahilmgandhi | 18:6a4db94011d3 | 1161 | * |
sahilmgandhi | 18:6a4db94011d3 | 1162 | * @param[in] status A bit field that defines what event caused the callback |
sahilmgandhi | 18:6a4db94011d3 | 1163 | * |
sahilmgandhi | 18:6a4db94011d3 | 1164 | * This interrupt level callback allows the user finer granularity in handling |
sahilmgandhi | 18:6a4db94011d3 | 1165 | * TX radio errors. |
sahilmgandhi | 18:6a4db94011d3 | 1166 | * |
sahilmgandhi | 18:6a4db94011d3 | 1167 | * Radio Statuses: |
sahilmgandhi | 18:6a4db94011d3 | 1168 | * - \ref RAIL_TX_CONFIG_BUFFER_UNDERFLOW |
sahilmgandhi | 18:6a4db94011d3 | 1169 | * - \ref RAIL_TX_CONFIG_CHANNEL_BUSY |
sahilmgandhi | 18:6a4db94011d3 | 1170 | * - \ref RAIL_TX_CONFIG_TX_ABORTED |
sahilmgandhi | 18:6a4db94011d3 | 1171 | * - \ref RAIL_TX_CONFIG_TX_BLOCKED |
sahilmgandhi | 18:6a4db94011d3 | 1172 | * - \ref RAIL_TX_CONFIG_CHANNEL_CLEAR |
sahilmgandhi | 18:6a4db94011d3 | 1173 | * - \ref RAIL_TX_CONFIG_CCA_RETRY |
sahilmgandhi | 18:6a4db94011d3 | 1174 | * - \ref RAIL_TX_CONFIG_START_CCA |
sahilmgandhi | 18:6a4db94011d3 | 1175 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1176 | void RAILCb_TxRadioStatus(uint8_t status); |
sahilmgandhi | 18:6a4db94011d3 | 1177 | |
sahilmgandhi | 18:6a4db94011d3 | 1178 | |
sahilmgandhi | 18:6a4db94011d3 | 1179 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1180 | * Pre-Transmit Operations |
sahilmgandhi | 18:6a4db94011d3 | 1181 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1182 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1183 | * @addtogroup Pre-Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1184 | * @brief APIs for pre-transmit operations (Scheduling, CSMA, LBT, ...) |
sahilmgandhi | 18:6a4db94011d3 | 1185 | * |
sahilmgandhi | 18:6a4db94011d3 | 1186 | * There are many operation that you can want to happen before a transmit. In |
sahilmgandhi | 18:6a4db94011d3 | 1187 | * RAIL these are configurable via Pre-Transmit hooks. You are free to use your |
sahilmgandhi | 18:6a4db94011d3 | 1188 | * own custom hooks, but there are several provided hooks to help with common |
sahilmgandhi | 18:6a4db94011d3 | 1189 | * use cases. The provided hooks will use the hardware as efficiently as |
sahilmgandhi | 18:6a4db94011d3 | 1190 | * possible which typically means that they do not introduce any software |
sahilmgandhi | 18:6a4db94011d3 | 1191 | * time overhead. |
sahilmgandhi | 18:6a4db94011d3 | 1192 | * |
sahilmgandhi | 18:6a4db94011d3 | 1193 | * Here's a simple example of how to use a scheduled transmit to send a packet |
sahilmgandhi | 18:6a4db94011d3 | 1194 | * 1 ms after right now. |
sahilmgandhi | 18:6a4db94011d3 | 1195 | * |
sahilmgandhi | 18:6a4db94011d3 | 1196 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 1197 | * RAIL_ScheduleTxConfig_t nextPacketTxTime = { 1000, RAIL_TIME_DELAY }; |
sahilmgandhi | 18:6a4db94011d3 | 1198 | * txStatus = RAIL_TxStart(channel, &RAIL_ScheduleTx, &nextPacketTxTime); |
sahilmgandhi | 18:6a4db94011d3 | 1199 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 1200 | * |
sahilmgandhi | 18:6a4db94011d3 | 1201 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1202 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1203 | |
sahilmgandhi | 18:6a4db94011d3 | 1204 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1205 | * Send a packet on a schedule, instead of immediately |
sahilmgandhi | 18:6a4db94011d3 | 1206 | * |
sahilmgandhi | 18:6a4db94011d3 | 1207 | * @param[in] params A pointer to the RAIL_ScheduleTxConfig_t |
sahilmgandhi | 18:6a4db94011d3 | 1208 | * structure containing when the transmit should occur. |
sahilmgandhi | 18:6a4db94011d3 | 1209 | * @return - Returns 0 on success and anything else on error. |
sahilmgandhi | 18:6a4db94011d3 | 1210 | * |
sahilmgandhi | 18:6a4db94011d3 | 1211 | * A RAIL_PreTxOp_t function that schedules the transmit to occur at the |
sahilmgandhi | 18:6a4db94011d3 | 1212 | * specified absolute or relative time within a RAIL_TxStart() transmit |
sahilmgandhi | 18:6a4db94011d3 | 1213 | * operation. If RAIL is receiving a packet at the scheduled time, the transmit |
sahilmgandhi | 18:6a4db94011d3 | 1214 | * will be delayed until after the packet is received. To guarantee the time of |
sahilmgandhi | 18:6a4db94011d3 | 1215 | * the outgoing transmit, only call this function while the radio is idle. |
sahilmgandhi | 18:6a4db94011d3 | 1216 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1217 | uint8_t RAIL_ScheduleTx(void *params); |
sahilmgandhi | 18:6a4db94011d3 | 1218 | |
sahilmgandhi | 18:6a4db94011d3 | 1219 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1220 | * Use CSMA instead of ignoring current usage of the channel |
sahilmgandhi | 18:6a4db94011d3 | 1221 | * |
sahilmgandhi | 18:6a4db94011d3 | 1222 | * @param[in] params A pointer to the RAIL_CsmaConfig_t structure containing |
sahilmgandhi | 18:6a4db94011d3 | 1223 | * the CSMA parameters to use. |
sahilmgandhi | 18:6a4db94011d3 | 1224 | * @return - Returns 0 on success and anything else on error. |
sahilmgandhi | 18:6a4db94011d3 | 1225 | * |
sahilmgandhi | 18:6a4db94011d3 | 1226 | * A RAIL_PreTxOp_t function that performs the CSMA algorithm when specified |
sahilmgandhi | 18:6a4db94011d3 | 1227 | * within a RAIL_TxStart() transmit operation. Packets can be received during |
sahilmgandhi | 18:6a4db94011d3 | 1228 | * CSMA backoff periods if receive is active throughout the CSMA process. This |
sahilmgandhi | 18:6a4db94011d3 | 1229 | * will happen either by starting the CSMA process while receive is already |
sahilmgandhi | 18:6a4db94011d3 | 1230 | * active, or if the ccaBackoff time in the RAIL_CsmaConfig_t is less than the |
sahilmgandhi | 18:6a4db94011d3 | 1231 | * idleToRx time (set by RAIL_SetStateTimings). If the ccaBackoff time is |
sahilmgandhi | 18:6a4db94011d3 | 1232 | * greater than the idleToRx time, then receive will only be active during the |
sahilmgandhi | 18:6a4db94011d3 | 1233 | * clear channel assessments. |
sahilmgandhi | 18:6a4db94011d3 | 1234 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1235 | |
sahilmgandhi | 18:6a4db94011d3 | 1236 | uint8_t RAIL_CcaCsma(void *params); |
sahilmgandhi | 18:6a4db94011d3 | 1237 | |
sahilmgandhi | 18:6a4db94011d3 | 1238 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1239 | * Listen to the channel before sending a message |
sahilmgandhi | 18:6a4db94011d3 | 1240 | * |
sahilmgandhi | 18:6a4db94011d3 | 1241 | * @param[in] params A pointer to the RAIL_LbtConfig_t structure containing |
sahilmgandhi | 18:6a4db94011d3 | 1242 | * the LBT parameters to use. |
sahilmgandhi | 18:6a4db94011d3 | 1243 | * @return Returns 0 on success and anything else on error. |
sahilmgandhi | 18:6a4db94011d3 | 1244 | * |
sahilmgandhi | 18:6a4db94011d3 | 1245 | * A RAIL_PreTxOp_t function that performs the LBT algorithm when specified |
sahilmgandhi | 18:6a4db94011d3 | 1246 | * within a RAIL_TxStart() transmit operation. Packets can be received during |
sahilmgandhi | 18:6a4db94011d3 | 1247 | * CSMA backoff periods if receive is active throughout the LBT process. This |
sahilmgandhi | 18:6a4db94011d3 | 1248 | * will happen either by starting the LBT process while receive is already |
sahilmgandhi | 18:6a4db94011d3 | 1249 | * active, or if the lbtBackoff time in the RAIL_LbtConfig_t is less than the |
sahilmgandhi | 18:6a4db94011d3 | 1250 | * idleToRx time (set by RAIL_SetStateTimings). If the lbtBackoff time is |
sahilmgandhi | 18:6a4db94011d3 | 1251 | * greater than the idleToRx time, then receive will only be active during the |
sahilmgandhi | 18:6a4db94011d3 | 1252 | * clear channel assessments. |
sahilmgandhi | 18:6a4db94011d3 | 1253 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1254 | uint8_t RAIL_CcaLbt(void *params); |
sahilmgandhi | 18:6a4db94011d3 | 1255 | |
sahilmgandhi | 18:6a4db94011d3 | 1256 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1257 | * Sets the CCA threshold in dBm |
sahilmgandhi | 18:6a4db94011d3 | 1258 | * |
sahilmgandhi | 18:6a4db94011d3 | 1259 | * @param[in] ccaThresholdDbm CCA threshold in dBm. |
sahilmgandhi | 18:6a4db94011d3 | 1260 | * @return \ref RAIL_STATUS_NO_ERROR on success. |
sahilmgandhi | 18:6a4db94011d3 | 1261 | * |
sahilmgandhi | 18:6a4db94011d3 | 1262 | * A RAIL_PreTxOp_t function will normally set CCA threshold, assuming it is |
sahilmgandhi | 18:6a4db94011d3 | 1263 | * enabled either in LBT or CSMA mode. Unlike RAIL_CcaCsma and RAIL_CcaLbt, |
sahilmgandhi | 18:6a4db94011d3 | 1264 | * which are called as RAIL_PreTxOp_t functions, this function only modifies |
sahilmgandhi | 18:6a4db94011d3 | 1265 | * CCA threshold. A possible usecase for this function is to set CCA threshold |
sahilmgandhi | 18:6a4db94011d3 | 1266 | * to invalid RSSI of -128 which disables transmission by canceling |
sahilmgandhi | 18:6a4db94011d3 | 1267 | * the current CCA check. |
sahilmgandhi | 18:6a4db94011d3 | 1268 | * |
sahilmgandhi | 18:6a4db94011d3 | 1269 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1270 | RAIL_Status_t RAIL_SetCcaThreshold(int8_t ccaThresholdDbm); |
sahilmgandhi | 18:6a4db94011d3 | 1271 | |
sahilmgandhi | 18:6a4db94011d3 | 1272 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1273 | * end of group Pre-Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1274 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 1275 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1276 | |
sahilmgandhi | 18:6a4db94011d3 | 1277 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1278 | * end of group Transmit |
sahilmgandhi | 18:6a4db94011d3 | 1279 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 1280 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1281 | |
sahilmgandhi | 18:6a4db94011d3 | 1282 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1283 | * Receive |
sahilmgandhi | 18:6a4db94011d3 | 1284 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1285 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1286 | * @addtogroup Receive |
sahilmgandhi | 18:6a4db94011d3 | 1287 | * @brief APIs related to packet receive |
sahilmgandhi | 18:6a4db94011d3 | 1288 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1289 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1290 | |
sahilmgandhi | 18:6a4db94011d3 | 1291 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1292 | * Configure radio receive actions |
sahilmgandhi | 18:6a4db94011d3 | 1293 | * |
sahilmgandhi | 18:6a4db94011d3 | 1294 | * @param[in] cbToEnable Define which callbacks to trigger for receive events. |
sahilmgandhi | 18:6a4db94011d3 | 1295 | * The full list of available callabcks can be found by looking at the |
sahilmgandhi | 18:6a4db94011d3 | 1296 | * RAIL_RX_CONFIG_* set of defines. |
sahilmgandhi | 18:6a4db94011d3 | 1297 | * @param[in] appendedInfoEnable Enable/Disable appended info (not implemented) |
sahilmgandhi | 18:6a4db94011d3 | 1298 | * @return Return 0 for success or an error code |
sahilmgandhi | 18:6a4db94011d3 | 1299 | * |
sahilmgandhi | 18:6a4db94011d3 | 1300 | * Setup which receive interrupts will generate a RAILCb_RxRadioStatus() |
sahilmgandhi | 18:6a4db94011d3 | 1301 | * callback. The full list of options is any define that starts with |
sahilmgandhi | 18:6a4db94011d3 | 1302 | * RAIL_RX_CONFIG_. |
sahilmgandhi | 18:6a4db94011d3 | 1303 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1304 | uint8_t RAIL_RxConfig(uint32_t cbToEnable, bool appendedInfoEnable); |
sahilmgandhi | 18:6a4db94011d3 | 1305 | |
sahilmgandhi | 18:6a4db94011d3 | 1306 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1307 | * Configure receive options |
sahilmgandhi | 18:6a4db94011d3 | 1308 | * |
sahilmgandhi | 18:6a4db94011d3 | 1309 | * @param[in] options Bitfield of options which affect recieve. The available |
sahilmgandhi | 18:6a4db94011d3 | 1310 | * options begin with RAIL_RX_OPTION. |
sahilmgandhi | 18:6a4db94011d3 | 1311 | * @return Return 0 for success or an error code |
sahilmgandhi | 18:6a4db94011d3 | 1312 | * |
sahilmgandhi | 18:6a4db94011d3 | 1313 | * Configure the radio receive flow, based on the list of available options. |
sahilmgandhi | 18:6a4db94011d3 | 1314 | * This will fail with RAIL_STATUS_INVALID_STATE if a packet is being received |
sahilmgandhi | 18:6a4db94011d3 | 1315 | * during this configuration. |
sahilmgandhi | 18:6a4db94011d3 | 1316 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1317 | RAIL_Status_t RAIL_SetRxOptions(uint32_t options); |
sahilmgandhi | 18:6a4db94011d3 | 1318 | |
sahilmgandhi | 18:6a4db94011d3 | 1319 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1320 | * Listen on a channel for a packet |
sahilmgandhi | 18:6a4db94011d3 | 1321 | * |
sahilmgandhi | 18:6a4db94011d3 | 1322 | * @param[in] channel Channel to listen on |
sahilmgandhi | 18:6a4db94011d3 | 1323 | * @return Return 0 for success or an error code |
sahilmgandhi | 18:6a4db94011d3 | 1324 | * |
sahilmgandhi | 18:6a4db94011d3 | 1325 | * This is a non-blocking function. RAILCb_RxPacketReceived() will be called |
sahilmgandhi | 18:6a4db94011d3 | 1326 | * when a packet has been received. Returns an error if currently transmitting |
sahilmgandhi | 18:6a4db94011d3 | 1327 | * or receiving. |
sahilmgandhi | 18:6a4db94011d3 | 1328 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1329 | uint8_t RAIL_RxStart(uint8_t channel); |
sahilmgandhi | 18:6a4db94011d3 | 1330 | |
sahilmgandhi | 18:6a4db94011d3 | 1331 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1332 | * Schedule a receive window for some time in the future. |
sahilmgandhi | 18:6a4db94011d3 | 1333 | * |
sahilmgandhi | 18:6a4db94011d3 | 1334 | * @param[in] channel Channel to listen on |
sahilmgandhi | 18:6a4db94011d3 | 1335 | * @param[in] cfg The configuation struct to define the receive window. |
sahilmgandhi | 18:6a4db94011d3 | 1336 | * @return Return 0 on success or an error code |
sahilmgandhi | 18:6a4db94011d3 | 1337 | * |
sahilmgandhi | 18:6a4db94011d3 | 1338 | * This API will immediately change your channel and schedule receive to start |
sahilmgandhi | 18:6a4db94011d3 | 1339 | * at the specified time and end at the given end time. If you do not specify an |
sahilmgandhi | 18:6a4db94011d3 | 1340 | * end time then you may call this API later with an end time as long as you set |
sahilmgandhi | 18:6a4db94011d3 | 1341 | * the start time to disabled. You can also terminate the whole receive |
sahilmgandhi | 18:6a4db94011d3 | 1342 | * operation immediately using the RAIL_RfIdle() function. Note that relative |
sahilmgandhi | 18:6a4db94011d3 | 1343 | * end times are always relative to the start unless there is no start time |
sahilmgandhi | 18:6a4db94011d3 | 1344 | * specified. |
sahilmgandhi | 18:6a4db94011d3 | 1345 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1346 | uint8_t RAIL_ScheduleRx(uint8_t channel, RAIL_ScheduleRxConfig_t *cfg); |
sahilmgandhi | 18:6a4db94011d3 | 1347 | |
sahilmgandhi | 18:6a4db94011d3 | 1348 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1349 | * Return the current raw RSSI |
sahilmgandhi | 18:6a4db94011d3 | 1350 | * |
sahilmgandhi | 18:6a4db94011d3 | 1351 | * @return Return \ref RAIL_RSSI_INVALID if the receiver is disabled and we are |
sahilmgandhi | 18:6a4db94011d3 | 1352 | * unable to get an RSSI value, otherwise, return the RSSI in quarter dBm, |
sahilmgandhi | 18:6a4db94011d3 | 1353 | * dbm*4. |
sahilmgandhi | 18:6a4db94011d3 | 1354 | * |
sahilmgandhi | 18:6a4db94011d3 | 1355 | * Get the current RSSI value. This value represents the current energy of the |
sahilmgandhi | 18:6a4db94011d3 | 1356 | * channel, so it can change rapidly, and will be low if there is no RF energy |
sahilmgandhi | 18:6a4db94011d3 | 1357 | * in your current channel. The function from the value reported to dBm is an |
sahilmgandhi | 18:6a4db94011d3 | 1358 | * offset dependent on the PHY and the PCB layout. Users should characterize the |
sahilmgandhi | 18:6a4db94011d3 | 1359 | * RSSI received on their hardware and apply an offset in the application to |
sahilmgandhi | 18:6a4db94011d3 | 1360 | * account for board and PHY parameters. |
sahilmgandhi | 18:6a4db94011d3 | 1361 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1362 | int16_t RAIL_RxGetRSSI(void); |
sahilmgandhi | 18:6a4db94011d3 | 1363 | |
sahilmgandhi | 18:6a4db94011d3 | 1364 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1365 | * Compute the average RSSI over a specified time in us |
sahilmgandhi | 18:6a4db94011d3 | 1366 | * |
sahilmgandhi | 18:6a4db94011d3 | 1367 | * @param[in] averageTimeUs Averaging time in microseconds. |
sahilmgandhi | 18:6a4db94011d3 | 1368 | * @return Return \ref RAIL_RSSI_INVALID if the receiver is disabled and we are |
sahilmgandhi | 18:6a4db94011d3 | 1369 | * unable to get an RSSI value, otherwise, return the RSSI in quarter dBm, |
sahilmgandhi | 18:6a4db94011d3 | 1370 | * dbm*4. |
sahilmgandhi | 18:6a4db94011d3 | 1371 | * |
sahilmgandhi | 18:6a4db94011d3 | 1372 | * This blocking function will poll the hardware for RSSI values and compute |
sahilmgandhi | 18:6a4db94011d3 | 1373 | * the average RSSI over the requested time period. If no valid readings have |
sahilmgandhi | 18:6a4db94011d3 | 1374 | * been made function will return \ref RAIL_RSSI_INVALID reading. Receiving a |
sahilmgandhi | 18:6a4db94011d3 | 1375 | * packet during the averaging will cause invalid reading(s). However, invalid |
sahilmgandhi | 18:6a4db94011d3 | 1376 | * readings during the averaging will not be included in the average. Number of |
sahilmgandhi | 18:6a4db94011d3 | 1377 | * RSSI readings per baud depends on the phy. |
sahilmgandhi | 18:6a4db94011d3 | 1378 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1379 | int16_t RAIL_PollAverageRSSI(uint32_t averageTimeUs); |
sahilmgandhi | 18:6a4db94011d3 | 1380 | |
sahilmgandhi | 18:6a4db94011d3 | 1381 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1382 | * Start the RSSI averaging over specified time in us |
sahilmgandhi | 18:6a4db94011d3 | 1383 | * |
sahilmgandhi | 18:6a4db94011d3 | 1384 | * @param[in] channel The physical channel to set |
sahilmgandhi | 18:6a4db94011d3 | 1385 | * @param[in] averagingTimeUs Averaging time in microseconds. |
sahilmgandhi | 18:6a4db94011d3 | 1386 | * @return Returns 0 on success, error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 1387 | * |
sahilmgandhi | 18:6a4db94011d3 | 1388 | * Start a non-blocking hardware based RSSI averaging mechanism. Only a single |
sahilmgandhi | 18:6a4db94011d3 | 1389 | * instance of RSSI averaging can be run at any time and the radio must be idle |
sahilmgandhi | 18:6a4db94011d3 | 1390 | * to start. |
sahilmgandhi | 18:6a4db94011d3 | 1391 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1392 | RAIL_Status_t RAIL_StartAverageRSSI(uint8_t channel, uint32_t averagingTimeUs); |
sahilmgandhi | 18:6a4db94011d3 | 1393 | |
sahilmgandhi | 18:6a4db94011d3 | 1394 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1395 | * Queries whether the RSSI averaging is done |
sahilmgandhi | 18:6a4db94011d3 | 1396 | * |
sahilmgandhi | 18:6a4db94011d3 | 1397 | * @return Returns true if done and false otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 1398 | * |
sahilmgandhi | 18:6a4db94011d3 | 1399 | * This function can be used to poll for completion of the RSSI averaging so |
sahilmgandhi | 18:6a4db94011d3 | 1400 | * that you do not have to rely on an interrupt based callback. |
sahilmgandhi | 18:6a4db94011d3 | 1401 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1402 | bool RAIL_AverageRSSIReady(void); |
sahilmgandhi | 18:6a4db94011d3 | 1403 | |
sahilmgandhi | 18:6a4db94011d3 | 1404 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1405 | * Get the RSSI averaged over specified time in us |
sahilmgandhi | 18:6a4db94011d3 | 1406 | * |
sahilmgandhi | 18:6a4db94011d3 | 1407 | * @return Return \ref RAIL_RSSI_INVALID if the receiver is disabled and we are |
sahilmgandhi | 18:6a4db94011d3 | 1408 | * unable to get an RSSI value, otherwise, return the RSSI in quarter dBm, |
sahilmgandhi | 18:6a4db94011d3 | 1409 | * dbm*4. |
sahilmgandhi | 18:6a4db94011d3 | 1410 | * |
sahilmgandhi | 18:6a4db94011d3 | 1411 | * Get the hardware RSSI average after issuing RAIL_StartAverageRSSI. Should be |
sahilmgandhi | 18:6a4db94011d3 | 1412 | * used after RAIL_StartAverageRSSI. |
sahilmgandhi | 18:6a4db94011d3 | 1413 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1414 | int16_t RAIL_GetAverageRSSI(void); |
sahilmgandhi | 18:6a4db94011d3 | 1415 | |
sahilmgandhi | 18:6a4db94011d3 | 1416 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1417 | * Callback for when AGC averaged RSSI is done |
sahilmgandhi | 18:6a4db94011d3 | 1418 | * |
sahilmgandhi | 18:6a4db94011d3 | 1419 | * @param avgRssi Contains the the RSSI in quarter dBm (dbm*4) on success and |
sahilmgandhi | 18:6a4db94011d3 | 1420 | * returns \ref RAIL_RSSI_INVALID if there was a problem computing the result. |
sahilmgandhi | 18:6a4db94011d3 | 1421 | * |
sahilmgandhi | 18:6a4db94011d3 | 1422 | * Called in response to RAIL_StartAverageRSSI() to indicate that the hardware |
sahilmgandhi | 18:6a4db94011d3 | 1423 | * has completed averaging. If you would like you can instead use the |
sahilmgandhi | 18:6a4db94011d3 | 1424 | * RAIL_AverageRSSIReady() to wait for completion and RAIL_GetAverageRSSI() to |
sahilmgandhi | 18:6a4db94011d3 | 1425 | * get the result. |
sahilmgandhi | 18:6a4db94011d3 | 1426 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1427 | void RAILCb_RssiAverageDone(int16_t avgRssi); |
sahilmgandhi | 18:6a4db94011d3 | 1428 | |
sahilmgandhi | 18:6a4db94011d3 | 1429 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1430 | * Receive packet callback. |
sahilmgandhi | 18:6a4db94011d3 | 1431 | * |
sahilmgandhi | 18:6a4db94011d3 | 1432 | * @param[in] rxPacketHandle Contains a handle that points to the memory that |
sahilmgandhi | 18:6a4db94011d3 | 1433 | * the packet was stored in. This handle will be the same as something |
sahilmgandhi | 18:6a4db94011d3 | 1434 | * returned by the RAILCb_AllocateMemory() API. This handle will hold a |
sahilmgandhi | 18:6a4db94011d3 | 1435 | * RAIL_RxPacketInfo_t structure starting at offset 0 in the buffer. |
sahilmgandhi | 18:6a4db94011d3 | 1436 | * |
sahilmgandhi | 18:6a4db94011d3 | 1437 | * This function is called whenever a packet is received and returns to you the |
sahilmgandhi | 18:6a4db94011d3 | 1438 | * memory handle for where this received packet and its appended information was |
sahilmgandhi | 18:6a4db94011d3 | 1439 | * stored. After this callback is done we will release the memory handle so you |
sahilmgandhi | 18:6a4db94011d3 | 1440 | * must somehow increment a reference count or copy the data out within this |
sahilmgandhi | 18:6a4db94011d3 | 1441 | * function. |
sahilmgandhi | 18:6a4db94011d3 | 1442 | * |
sahilmgandhi | 18:6a4db94011d3 | 1443 | * If \ref RAIL_IGNORE_CRC_ERRORS is set, this callback will fire for packets |
sahilmgandhi | 18:6a4db94011d3 | 1444 | * with crc errors as well. |
sahilmgandhi | 18:6a4db94011d3 | 1445 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1446 | void RAILCb_RxPacketReceived(void *rxPacketHandle); |
sahilmgandhi | 18:6a4db94011d3 | 1447 | |
sahilmgandhi | 18:6a4db94011d3 | 1448 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1449 | * Called whenever an enabled radio status event occurs |
sahilmgandhi | 18:6a4db94011d3 | 1450 | * |
sahilmgandhi | 18:6a4db94011d3 | 1451 | * @param[in] status The event that triggered this callback |
sahilmgandhi | 18:6a4db94011d3 | 1452 | * |
sahilmgandhi | 18:6a4db94011d3 | 1453 | * The triggers that cause this function to be called can be enabled using the |
sahilmgandhi | 18:6a4db94011d3 | 1454 | * RAIL_RxConfig() function. |
sahilmgandhi | 18:6a4db94011d3 | 1455 | * |
sahilmgandhi | 18:6a4db94011d3 | 1456 | * @note This function will return only the first 8 of all possible triggers. |
sahilmgandhi | 18:6a4db94011d3 | 1457 | * For accessing all triggers see the new RAILCb_RxRadioStatusExt() API. If you |
sahilmgandhi | 18:6a4db94011d3 | 1458 | * implement RAILCb_RxRadioStatusExt() this callback will no longer be used by |
sahilmgandhi | 18:6a4db94011d3 | 1459 | * the RAIL library. In RAIL 2.0 this API will be merged with the |
sahilmgandhi | 18:6a4db94011d3 | 1460 | * RAILCb_RxRadioStatusExt() for one clean interface. |
sahilmgandhi | 18:6a4db94011d3 | 1461 | * |
sahilmgandhi | 18:6a4db94011d3 | 1462 | * Triggers: |
sahilmgandhi | 18:6a4db94011d3 | 1463 | * - \ref RAIL_RX_CONFIG_PREAMBLE_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1464 | * - \ref RAIL_RX_CONFIG_SYNC1_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1465 | * - \ref RAIL_RX_CONFIG_SYNC2_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1466 | * - \ref RAIL_RX_CONFIG_FRAME_ERROR |
sahilmgandhi | 18:6a4db94011d3 | 1467 | * - \ref RAIL_RX_CONFIG_BUFFER_OVERFLOW |
sahilmgandhi | 18:6a4db94011d3 | 1468 | * - \ref RAIL_RX_CONFIG_ADDRESS_FILTERED |
sahilmgandhi | 18:6a4db94011d3 | 1469 | * - \ref RAIL_RX_CONFIG_RF_SENSED |
sahilmgandhi | 18:6a4db94011d3 | 1470 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1471 | void RAILCb_RxRadioStatus(uint8_t status); |
sahilmgandhi | 18:6a4db94011d3 | 1472 | |
sahilmgandhi | 18:6a4db94011d3 | 1473 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1474 | * Called whenever an enabled radio status event occurs |
sahilmgandhi | 18:6a4db94011d3 | 1475 | * |
sahilmgandhi | 18:6a4db94011d3 | 1476 | * @param[in] status The event or events that triggered this callback |
sahilmgandhi | 18:6a4db94011d3 | 1477 | * |
sahilmgandhi | 18:6a4db94011d3 | 1478 | * The triggers that cause this function to be called can be enabled using the |
sahilmgandhi | 18:6a4db94011d3 | 1479 | * RAIL_RxConfig() function. This function is the same as RAILCb_RxRadioStatus() |
sahilmgandhi | 18:6a4db94011d3 | 1480 | * with an extended set of triggers. For backwards compatibility this function |
sahilmgandhi | 18:6a4db94011d3 | 1481 | * is weakly defined in the RAIL library to call RAILCb_RxRadioStatus() with the |
sahilmgandhi | 18:6a4db94011d3 | 1482 | * subset of valid events. If you need more events you must implement this |
sahilmgandhi | 18:6a4db94011d3 | 1483 | * version which will stop the old one from being called. |
sahilmgandhi | 18:6a4db94011d3 | 1484 | * |
sahilmgandhi | 18:6a4db94011d3 | 1485 | * @note In RAIL 2.0 this API will be merged with the RAILCb_RxRadioStatus() for |
sahilmgandhi | 18:6a4db94011d3 | 1486 | * one clean interface. |
sahilmgandhi | 18:6a4db94011d3 | 1487 | * |
sahilmgandhi | 18:6a4db94011d3 | 1488 | * Triggers: |
sahilmgandhi | 18:6a4db94011d3 | 1489 | * - \ref RAIL_RX_CONFIG_PREAMBLE_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1490 | * - \ref RAIL_RX_CONFIG_SYNC1_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1491 | * - \ref RAIL_RX_CONFIG_SYNC2_DETECT |
sahilmgandhi | 18:6a4db94011d3 | 1492 | * - \ref RAIL_RX_CONFIG_FRAME_ERROR |
sahilmgandhi | 18:6a4db94011d3 | 1493 | * - \ref RAIL_RX_CONFIG_BUFFER_OVERFLOW |
sahilmgandhi | 18:6a4db94011d3 | 1494 | * - \ref RAIL_RX_CONFIG_ADDRESS_FILTERED |
sahilmgandhi | 18:6a4db94011d3 | 1495 | * - \ref RAIL_RX_CONFIG_RF_SENSED |
sahilmgandhi | 18:6a4db94011d3 | 1496 | * - \ref RAIL_RX_CONFIG_TIMEOUT |
sahilmgandhi | 18:6a4db94011d3 | 1497 | * - \ref RAIL_RX_CONFIG_SCHEDULED_RX_END |
sahilmgandhi | 18:6a4db94011d3 | 1498 | * - \ref RAIL_RX_CONFIG_PACKET_ABORTED |
sahilmgandhi | 18:6a4db94011d3 | 1499 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1500 | void RAILCb_RxRadioStatusExt(uint32_t status); |
sahilmgandhi | 18:6a4db94011d3 | 1501 | |
sahilmgandhi | 18:6a4db94011d3 | 1502 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1503 | * Address Filtering (Rx) |
sahilmgandhi | 18:6a4db94011d3 | 1504 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1505 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1506 | * @addtogroup Address_Filtering |
sahilmgandhi | 18:6a4db94011d3 | 1507 | * @brief Configuration APIs for receive packet address filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1508 | * |
sahilmgandhi | 18:6a4db94011d3 | 1509 | * The address filtering code examines the packet as follows. |
sahilmgandhi | 18:6a4db94011d3 | 1510 | * |
sahilmgandhi | 18:6a4db94011d3 | 1511 | * | `Bytes: 0 - 255` | `0 - 8` | `0 - 255` | `0 - 8` | `Variable` | |
sahilmgandhi | 18:6a4db94011d3 | 1512 | * |:----------------:|---------:|----------:|---------:|:----------:| |
sahilmgandhi | 18:6a4db94011d3 | 1513 | * | `Data0` | `Field0` | `Data1` | `Field1` | `Data2` | |
sahilmgandhi | 18:6a4db94011d3 | 1514 | * |
sahilmgandhi | 18:6a4db94011d3 | 1515 | * In the above structure, anything listed as DataN is an optional section of |
sahilmgandhi | 18:6a4db94011d3 | 1516 | * bytes that RAIL will not process for address filtering. The FieldN segments |
sahilmgandhi | 18:6a4db94011d3 | 1517 | * reference the specific sections in the packet that will each be interpreted |
sahilmgandhi | 18:6a4db94011d3 | 1518 | * as an address during address filtering. The application may submit up to four |
sahilmgandhi | 18:6a4db94011d3 | 1519 | * addresses to attempt to match each field segment and each address may have a |
sahilmgandhi | 18:6a4db94011d3 | 1520 | * size of up to 8 bytes. To setup |
sahilmgandhi | 18:6a4db94011d3 | 1521 | * address filtering you must first configure where the addresses are in your |
sahilmgandhi | 18:6a4db94011d3 | 1522 | * packet and how long they are. Next, you need to configure what combinations |
sahilmgandhi | 18:6a4db94011d3 | 1523 | * of matches in Field0 and Field1 should constitute an address match. Lastly, |
sahilmgandhi | 18:6a4db94011d3 | 1524 | * you need to enter addresses into the tables for each field and enable them. |
sahilmgandhi | 18:6a4db94011d3 | 1525 | * The first two of these are part of the RAIL_AddrConfig_t structure while the |
sahilmgandhi | 18:6a4db94011d3 | 1526 | * second part is configured at runtime using the RAIL_AddressFilterSetAddress() |
sahilmgandhi | 18:6a4db94011d3 | 1527 | * API. A brief description of each of these configurations is listed below. |
sahilmgandhi | 18:6a4db94011d3 | 1528 | * |
sahilmgandhi | 18:6a4db94011d3 | 1529 | * For the first piece of configuration, the offsets and sizes of the fields are |
sahilmgandhi | 18:6a4db94011d3 | 1530 | * assumed to be fixed for the RAIL address filter. To set them you must specify |
sahilmgandhi | 18:6a4db94011d3 | 1531 | * arrays for these values in the sizes and offsets entries in the |
sahilmgandhi | 18:6a4db94011d3 | 1532 | * RAIL_AddrConfig_t struct. A size of zero will indicate that a field is |
sahilmgandhi | 18:6a4db94011d3 | 1533 | * disabled. The start offset for a field is relative to the previous start |
sahilmgandhi | 18:6a4db94011d3 | 1534 | * offset and if you're using FrameType decoding the first start offset is |
sahilmgandhi | 18:6a4db94011d3 | 1535 | * relative to the end of the byte containing the frame type. |
sahilmgandhi | 18:6a4db94011d3 | 1536 | * |
sahilmgandhi | 18:6a4db94011d3 | 1537 | * Configuring which combinations of Field0 and Field1 constitute a match is the |
sahilmgandhi | 18:6a4db94011d3 | 1538 | * most complex portion of the address filter. The easiest way to think about |
sahilmgandhi | 18:6a4db94011d3 | 1539 | * this is with a truth table. If you consider each of the four possible address |
sahilmgandhi | 18:6a4db94011d3 | 1540 | * entries in a field then you can have a match on any one of those or a match |
sahilmgandhi | 18:6a4db94011d3 | 1541 | * for none of them. We can represent this as a 4 bit mask where a 1 indicates a |
sahilmgandhi | 18:6a4db94011d3 | 1542 | * match and a 0 indicates no match. If we then show the Field0 match options as |
sahilmgandhi | 18:6a4db94011d3 | 1543 | * rows and the Field1 options as columns we get a truth table like the one |
sahilmgandhi | 18:6a4db94011d3 | 1544 | * shown below. |
sahilmgandhi | 18:6a4db94011d3 | 1545 | * |
sahilmgandhi | 18:6a4db94011d3 | 1546 | * | | 0000 | 0001 | 0010 | 0100 | 1000 | |
sahilmgandhi | 18:6a4db94011d3 | 1547 | * |----------|------|------|------|------|------| |
sahilmgandhi | 18:6a4db94011d3 | 1548 | * | __0000__ | bit0 | bit1 | bit2 | bit3 | bit4 | |
sahilmgandhi | 18:6a4db94011d3 | 1549 | * | __0001__ | bit5 | bit6 | bit7 | bit8 | bit9 | |
sahilmgandhi | 18:6a4db94011d3 | 1550 | * | __0010__ | bit10| bit11| bit12| bit13| bit14| |
sahilmgandhi | 18:6a4db94011d3 | 1551 | * | __0100__ | bit15| bit16| bit17| bit18| bit19| |
sahilmgandhi | 18:6a4db94011d3 | 1552 | * | __1000__ | bit20| bit21| bit22| bit23| bit24| |
sahilmgandhi | 18:6a4db94011d3 | 1553 | * |
sahilmgandhi | 18:6a4db94011d3 | 1554 | * Since this is only 25 bits it can be represented in one 32bit integer where a |
sahilmgandhi | 18:6a4db94011d3 | 1555 | * 1 indicates filter pass and a 0 indicates filter fail. This is the matchTable |
sahilmgandhi | 18:6a4db94011d3 | 1556 | * parameter in the configuration struct and it is what's used during filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1557 | * For common simple configurations we provide two defines, the truth tables for |
sahilmgandhi | 18:6a4db94011d3 | 1558 | * which are shown below. The first is \ref |
sahilmgandhi | 18:6a4db94011d3 | 1559 | * ADDRCONFIG_MATCH_TABLE_SINGLE_FIELD and it can be used if you're only using |
sahilmgandhi | 18:6a4db94011d3 | 1560 | * one address field (either field). If you're using two fields and want to |
sahilmgandhi | 18:6a4db94011d3 | 1561 | * force in the same address entry in each field you can use second define: \ref |
sahilmgandhi | 18:6a4db94011d3 | 1562 | * ADDRCONFIG_MATCH_TABLE_DOUBLE_FIELD. For more complex systems you'll have to |
sahilmgandhi | 18:6a4db94011d3 | 1563 | * create a valid table on your own. |
sahilmgandhi | 18:6a4db94011d3 | 1564 | * |
sahilmgandhi | 18:6a4db94011d3 | 1565 | * @note Address filtering does not function properly with PHYs that use a data |
sahilmgandhi | 18:6a4db94011d3 | 1566 | * rate greater than 500kbps. If you require this you must filter in software |
sahilmgandhi | 18:6a4db94011d3 | 1567 | * for the time being. |
sahilmgandhi | 18:6a4db94011d3 | 1568 | * |
sahilmgandhi | 18:6a4db94011d3 | 1569 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1570 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1571 | |
sahilmgandhi | 18:6a4db94011d3 | 1572 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1573 | * Configure address filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1574 | * |
sahilmgandhi | 18:6a4db94011d3 | 1575 | * @param addrConfig The configuration structure which defines how addresses |
sahilmgandhi | 18:6a4db94011d3 | 1576 | * are setup in your packets. |
sahilmgandhi | 18:6a4db94011d3 | 1577 | * @return True if we were able to configure address filtering and false |
sahilmgandhi | 18:6a4db94011d3 | 1578 | * otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 1579 | * |
sahilmgandhi | 18:6a4db94011d3 | 1580 | * This function must be called to setup address filtering. You may call this |
sahilmgandhi | 18:6a4db94011d3 | 1581 | * multiple times, but all previous information is wiped out each time you call |
sahilmgandhi | 18:6a4db94011d3 | 1582 | * it so any configured addresses must be reset. |
sahilmgandhi | 18:6a4db94011d3 | 1583 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1584 | bool RAIL_AddressFilterConfig(RAIL_AddrConfig_t *addrConfig); |
sahilmgandhi | 18:6a4db94011d3 | 1585 | |
sahilmgandhi | 18:6a4db94011d3 | 1586 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1587 | * Enable address filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1588 | * |
sahilmgandhi | 18:6a4db94011d3 | 1589 | * @return True if address filtering was enabled to start with and false |
sahilmgandhi | 18:6a4db94011d3 | 1590 | * otherwise |
sahilmgandhi | 18:6a4db94011d3 | 1591 | * |
sahilmgandhi | 18:6a4db94011d3 | 1592 | * Only allow packets through that pass the current address filtering |
sahilmgandhi | 18:6a4db94011d3 | 1593 | * configuration. This will not reset or change the configuration so you can |
sahilmgandhi | 18:6a4db94011d3 | 1594 | * set that up before turning this feature on. |
sahilmgandhi | 18:6a4db94011d3 | 1595 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1596 | bool RAIL_AddressFilterEnable(void); |
sahilmgandhi | 18:6a4db94011d3 | 1597 | |
sahilmgandhi | 18:6a4db94011d3 | 1598 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1599 | * Disable address filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1600 | * |
sahilmgandhi | 18:6a4db94011d3 | 1601 | * @return True if address filtering was enabled to start with and false |
sahilmgandhi | 18:6a4db94011d3 | 1602 | * otherwise |
sahilmgandhi | 18:6a4db94011d3 | 1603 | * |
sahilmgandhi | 18:6a4db94011d3 | 1604 | * Allow all packets through regardless of addressing information. This will not |
sahilmgandhi | 18:6a4db94011d3 | 1605 | * reset or change the current configuration. |
sahilmgandhi | 18:6a4db94011d3 | 1606 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1607 | bool RAIL_AddressFilterDisable(void); |
sahilmgandhi | 18:6a4db94011d3 | 1608 | |
sahilmgandhi | 18:6a4db94011d3 | 1609 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1610 | * Return whether address filtering is currently enabled. |
sahilmgandhi | 18:6a4db94011d3 | 1611 | * |
sahilmgandhi | 18:6a4db94011d3 | 1612 | * @return True if address filtering is enabled and false otherwise |
sahilmgandhi | 18:6a4db94011d3 | 1613 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1614 | bool RAIL_AddressFilterIsEnabled(void); |
sahilmgandhi | 18:6a4db94011d3 | 1615 | |
sahilmgandhi | 18:6a4db94011d3 | 1616 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1617 | * Reset the address filtering configuration. |
sahilmgandhi | 18:6a4db94011d3 | 1618 | * |
sahilmgandhi | 18:6a4db94011d3 | 1619 | * Reset all structures related to address filtering. This will not disable |
sahilmgandhi | 18:6a4db94011d3 | 1620 | * address fitlering. It will leave the radio in a state where no packets will |
sahilmgandhi | 18:6a4db94011d3 | 1621 | * pass filtering. |
sahilmgandhi | 18:6a4db94011d3 | 1622 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1623 | void RAIL_AddressFilterReset(void); |
sahilmgandhi | 18:6a4db94011d3 | 1624 | |
sahilmgandhi | 18:6a4db94011d3 | 1625 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1626 | * Set an address for filtering in hardware. |
sahilmgandhi | 18:6a4db94011d3 | 1627 | * |
sahilmgandhi | 18:6a4db94011d3 | 1628 | * @param field Which address field you want to use for this address |
sahilmgandhi | 18:6a4db94011d3 | 1629 | * @param index Which match entry you want to place this address in for the |
sahilmgandhi | 18:6a4db94011d3 | 1630 | * given field. |
sahilmgandhi | 18:6a4db94011d3 | 1631 | * @param value A pointer to the address data. This must be at least as long |
sahilmgandhi | 18:6a4db94011d3 | 1632 | * as the size specified in RAIL_AddressFilterConfig(). |
sahilmgandhi | 18:6a4db94011d3 | 1633 | * @param enable A boolean to indicate whether this address should be enabled |
sahilmgandhi | 18:6a4db94011d3 | 1634 | * immediately. |
sahilmgandhi | 18:6a4db94011d3 | 1635 | * @return True if we were able to set this address and false otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 1636 | * |
sahilmgandhi | 18:6a4db94011d3 | 1637 | * This function will load the given address into hardware for filtering and |
sahilmgandhi | 18:6a4db94011d3 | 1638 | * start filtering on it if you set the enable parameter to true. Otherwise, |
sahilmgandhi | 18:6a4db94011d3 | 1639 | * you must call RAIL_AddressFilterEnableAddress() to turn it on later. |
sahilmgandhi | 18:6a4db94011d3 | 1640 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1641 | bool RAIL_AddressFilterSetAddress(uint8_t field, |
sahilmgandhi | 18:6a4db94011d3 | 1642 | uint8_t index, |
sahilmgandhi | 18:6a4db94011d3 | 1643 | uint8_t *value, |
sahilmgandhi | 18:6a4db94011d3 | 1644 | bool enable); |
sahilmgandhi | 18:6a4db94011d3 | 1645 | |
sahilmgandhi | 18:6a4db94011d3 | 1646 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1647 | * Enable address filtering for the specified address |
sahilmgandhi | 18:6a4db94011d3 | 1648 | * |
sahilmgandhi | 18:6a4db94011d3 | 1649 | * @param field Which address field you want to enable the address within |
sahilmgandhi | 18:6a4db94011d3 | 1650 | * @param index Which match entry in the given field you want to enable |
sahilmgandhi | 18:6a4db94011d3 | 1651 | * @return True if we were able to enable filtering for this address and false |
sahilmgandhi | 18:6a4db94011d3 | 1652 | * otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 1653 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1654 | bool RAIL_AddressFilterEnableAddress(uint8_t field, uint8_t index); |
sahilmgandhi | 18:6a4db94011d3 | 1655 | |
sahilmgandhi | 18:6a4db94011d3 | 1656 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1657 | * Disable address filtering for the specified address |
sahilmgandhi | 18:6a4db94011d3 | 1658 | * |
sahilmgandhi | 18:6a4db94011d3 | 1659 | * @param field Which address field you want to disable the address within |
sahilmgandhi | 18:6a4db94011d3 | 1660 | * @param index Which match entry in the given field you want to disable |
sahilmgandhi | 18:6a4db94011d3 | 1661 | * @return True if this address disabled successfully and false otherwise. |
sahilmgandhi | 18:6a4db94011d3 | 1662 | * |
sahilmgandhi | 18:6a4db94011d3 | 1663 | * This will clear the matchMask set in the RAIL_AddressFilterEnableAddress() |
sahilmgandhi | 18:6a4db94011d3 | 1664 | * function and make sure that this address is marked as valid. To use it in |
sahilmgandhi | 18:6a4db94011d3 | 1665 | * filtering again you must enable this address again. |
sahilmgandhi | 18:6a4db94011d3 | 1666 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1667 | bool RAIL_AddressFilterDisableAddress(uint8_t field, uint8_t index); |
sahilmgandhi | 18:6a4db94011d3 | 1668 | |
sahilmgandhi | 18:6a4db94011d3 | 1669 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1670 | * Configure address filtering based on frame type |
sahilmgandhi | 18:6a4db94011d3 | 1671 | * |
sahilmgandhi | 18:6a4db94011d3 | 1672 | * @param validFrames The frames on which to enable address filtering. Each bit |
sahilmgandhi | 18:6a4db94011d3 | 1673 | * corresponds to a frame, where a 1 means to enable address filtering during |
sahilmgandhi | 18:6a4db94011d3 | 1674 | * that frame, and a 0 means to ignore addresses during that frame. The least |
sahilmgandhi | 18:6a4db94011d3 | 1675 | * significant bit corresponds to frame 0, and the most significant bit to |
sahilmgandhi | 18:6a4db94011d3 | 1676 | * frame 7. |
sahilmgandhi | 18:6a4db94011d3 | 1677 | * @return True if configuration was set properly, false otherwise |
sahilmgandhi | 18:6a4db94011d3 | 1678 | * |
sahilmgandhi | 18:6a4db94011d3 | 1679 | * This function only takes effect if frame type length decoding and address |
sahilmgandhi | 18:6a4db94011d3 | 1680 | * filtering are both being used. In that case, this function gives the ability |
sahilmgandhi | 18:6a4db94011d3 | 1681 | * to only enable address filtering on certain types of frames. |
sahilmgandhi | 18:6a4db94011d3 | 1682 | * |
sahilmgandhi | 18:6a4db94011d3 | 1683 | * @note This function must be called after RAIL_AddressFilterConfig for it to |
sahilmgandhi | 18:6a4db94011d3 | 1684 | * take effect. |
sahilmgandhi | 18:6a4db94011d3 | 1685 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1686 | bool RAIL_AddressFilterByFrameType(uint8_t validFrames); |
sahilmgandhi | 18:6a4db94011d3 | 1687 | |
sahilmgandhi | 18:6a4db94011d3 | 1688 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1689 | * end of group Address_Filtering |
sahilmgandhi | 18:6a4db94011d3 | 1690 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 1691 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1692 | |
sahilmgandhi | 18:6a4db94011d3 | 1693 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1694 | * end of group Receive |
sahilmgandhi | 18:6a4db94011d3 | 1695 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 1696 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1697 | |
sahilmgandhi | 18:6a4db94011d3 | 1698 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1699 | * Auto Acking |
sahilmgandhi | 18:6a4db94011d3 | 1700 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1701 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1702 | * @addtogroup Auto_Ack |
sahilmgandhi | 18:6a4db94011d3 | 1703 | * @brief APIs for configuring Auto-Ack functionality |
sahilmgandhi | 18:6a4db94011d3 | 1704 | * |
sahilmgandhi | 18:6a4db94011d3 | 1705 | * These APIs are used to configure the radio for auto acknowledgement |
sahilmgandhi | 18:6a4db94011d3 | 1706 | * features. Auto ack inherently changes how the underlying state machine |
sahilmgandhi | 18:6a4db94011d3 | 1707 | * behaves so users should not modify RAIL_SetRxTransitions() and |
sahilmgandhi | 18:6a4db94011d3 | 1708 | * RAIL_SetTxTransitions() while using auto ack features. |
sahilmgandhi | 18:6a4db94011d3 | 1709 | * |
sahilmgandhi | 18:6a4db94011d3 | 1710 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 1711 | * // Go to RX after ack operation, 100 us idle->rx/tx, |
sahilmgandhi | 18:6a4db94011d3 | 1712 | * // 192 us rx->tx/tx->rx, 1000 us ack timeout |
sahilmgandhi | 18:6a4db94011d3 | 1713 | * RAIL_AutoAckConfig_t autoAckConfig = { RAIL_RF_STATE_RX, 100, 192, 1000}; |
sahilmgandhi | 18:6a4db94011d3 | 1714 | * |
sahilmgandhi | 18:6a4db94011d3 | 1715 | * RAIL_Status_t status = RAIL_AutoAckConfig(&autoAckConfig); |
sahilmgandhi | 18:6a4db94011d3 | 1716 | * |
sahilmgandhi | 18:6a4db94011d3 | 1717 | * uint8_t ackPayload[] = {0x05, 0x02, 0x10, 0x00}; |
sahilmgandhi | 18:6a4db94011d3 | 1718 | * RAIL_AutoAckData_t ackData = {ackPayload, sizeof(ackPayload)}; |
sahilmgandhi | 18:6a4db94011d3 | 1719 | * |
sahilmgandhi | 18:6a4db94011d3 | 1720 | * RAIL_Status_t status = RAIL_AutoAckLoadBuffer(&ackData); |
sahilmgandhi | 18:6a4db94011d3 | 1721 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 1722 | * |
sahilmgandhi | 18:6a4db94011d3 | 1723 | * The acknowledgement will transmit based on the frame format configured via |
sahilmgandhi | 18:6a4db94011d3 | 1724 | * the Radio Configurator. For example, if the frame format is using a variable |
sahilmgandhi | 18:6a4db94011d3 | 1725 | * length scheme, the ack will be sent according to that scheme. If a 10 byte |
sahilmgandhi | 18:6a4db94011d3 | 1726 | * packet is loaded into the ack, but the variable length field of the ack |
sahilmgandhi | 18:6a4db94011d3 | 1727 | * payload specifies a length of 5, only 5 bytes will transmit for the ack. |
sahilmgandhi | 18:6a4db94011d3 | 1728 | * The converse is also true, if the frame length is configured to be a fixed |
sahilmgandhi | 18:6a4db94011d3 | 1729 | * 10 byte packet but only 5 bytes are loaded into the ack buffer then a TX |
sahilmgandhi | 18:6a4db94011d3 | 1730 | * underflow will occur during the ack transmit. |
sahilmgandhi | 18:6a4db94011d3 | 1731 | * |
sahilmgandhi | 18:6a4db94011d3 | 1732 | * When auto ack is enabled, the default operation is to transmit the ack after |
sahilmgandhi | 18:6a4db94011d3 | 1733 | * a receive and wait for an ack after a transmit. After the ack operation |
sahilmgandhi | 18:6a4db94011d3 | 1734 | * completes, the radio will transition to the configured defaultState. If |
sahilmgandhi | 18:6a4db94011d3 | 1735 | * there is a desire to not auto acknowledge a series of packets after transmit |
sahilmgandhi | 18:6a4db94011d3 | 1736 | * or receive, call RAIL_AutoAckTxPause() and RAIL_AutoAckRxPause(). When |
sahilmgandhi | 18:6a4db94011d3 | 1737 | * auto acking is paused, after successfully receiving or transmitting a |
sahilmgandhi | 18:6a4db94011d3 | 1738 | * packet, the radio will transition to the defaultState. To get out of a |
sahilmgandhi | 18:6a4db94011d3 | 1739 | * paused state and resume auto acking, call RAIL_AutoAckTxResume() or |
sahilmgandhi | 18:6a4db94011d3 | 1740 | * RAIL_AutoAckRxResume(). |
sahilmgandhi | 18:6a4db94011d3 | 1741 | * |
sahilmgandhi | 18:6a4db94011d3 | 1742 | * Applications can cancel the transmission of an ack with |
sahilmgandhi | 18:6a4db94011d3 | 1743 | * RAIL_AutoAckCancelAck(). Conversly, applications can control if a transmit |
sahilmgandhi | 18:6a4db94011d3 | 1744 | * operation should wait for an ack after transmitting by using |
sahilmgandhi | 18:6a4db94011d3 | 1745 | * RAIL_TxStartWithOptions() and populating the waitForAck field in |
sahilmgandhi | 18:6a4db94011d3 | 1746 | * \ref RAIL_TxOptions_t. |
sahilmgandhi | 18:6a4db94011d3 | 1747 | * |
sahilmgandhi | 18:6a4db94011d3 | 1748 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 1749 | * void RAILCb_RxPacketReceived(void *rxPacketHandle) |
sahilmgandhi | 18:6a4db94011d3 | 1750 | * { |
sahilmgandhi | 18:6a4db94011d3 | 1751 | * RAIL_RxPacketInfo_t rxPacketInfo = (RAIL_RxPacketInfo_t)rxPacketHandle; |
sahilmgandhi | 18:6a4db94011d3 | 1752 | * |
sahilmgandhi | 18:6a4db94011d3 | 1753 | * // If we have just received an ACK, don't respond with an ACK |
sahilmgandhi | 18:6a4db94011d3 | 1754 | * if (rxPacketInfo->dataPtr[2] == 0xF1) |
sahilmgandhi | 18:6a4db94011d3 | 1755 | * { |
sahilmgandhi | 18:6a4db94011d3 | 1756 | * RAIL_AutoAckCancelAck(); |
sahilmgandhi | 18:6a4db94011d3 | 1757 | * } |
sahilmgandhi | 18:6a4db94011d3 | 1758 | * } |
sahilmgandhi | 18:6a4db94011d3 | 1759 | * |
sahilmgandhi | 18:6a4db94011d3 | 1760 | * void transmitAndWaitForAck (void) |
sahilmgandhi | 18:6a4db94011d3 | 1761 | * { |
sahilmgandhi | 18:6a4db94011d3 | 1762 | * RAIL_TxOptions_t txOption; |
sahilmgandhi | 18:6a4db94011d3 | 1763 | * txOption.waitForAck = true; |
sahilmgandhi | 18:6a4db94011d3 | 1764 | * RAIL_Status_t status = RAIL_TxStartWithOptions(0, &txOption, NULL, NULL); |
sahilmgandhi | 18:6a4db94011d3 | 1765 | * } |
sahilmgandhi | 18:6a4db94011d3 | 1766 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 1767 | * |
sahilmgandhi | 18:6a4db94011d3 | 1768 | * If the ack payload is dynamic, the application must call |
sahilmgandhi | 18:6a4db94011d3 | 1769 | * RAIL_AutoAckLoadBuffer() with the appropriate ack payload after the |
sahilmgandhi | 18:6a4db94011d3 | 1770 | * application processes the receive. RAIL can auto ack from the normal |
sahilmgandhi | 18:6a4db94011d3 | 1771 | * transmit buffer if RAIL_AutoAckUseTxBuffer() is called before the radio |
sahilmgandhi | 18:6a4db94011d3 | 1772 | * transmits the ack. Make sure the transmit buffer contains data loaded by |
sahilmgandhi | 18:6a4db94011d3 | 1773 | * RAIL_TxDataLoad(). |
sahilmgandhi | 18:6a4db94011d3 | 1774 | * |
sahilmgandhi | 18:6a4db94011d3 | 1775 | * Standards based protocols that contain auto ack functionality are normally |
sahilmgandhi | 18:6a4db94011d3 | 1776 | * configured in the protocol specific config function. For example, |
sahilmgandhi | 18:6a4db94011d3 | 1777 | * RAIL_IEEE802154_Init() provides auto ack configuration parameters in \ref |
sahilmgandhi | 18:6a4db94011d3 | 1778 | * RAIL_IEEE802154_Config_t and should only be configured through that |
sahilmgandhi | 18:6a4db94011d3 | 1779 | * function. It is unadvised to call both RAIL_IEEE802154_Init() and |
sahilmgandhi | 18:6a4db94011d3 | 1780 | * RAIL_AutoAckConfig(). However, ack modification functions are still valid to |
sahilmgandhi | 18:6a4db94011d3 | 1781 | * use with protocol specific acks. To cancel a IEEE 802.15.4 ack transmit, use |
sahilmgandhi | 18:6a4db94011d3 | 1782 | * RAIL_AutoAckCancelAck(). |
sahilmgandhi | 18:6a4db94011d3 | 1783 | * |
sahilmgandhi | 18:6a4db94011d3 | 1784 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1785 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1786 | |
sahilmgandhi | 18:6a4db94011d3 | 1787 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1788 | * Disable Automatic Acknowledgement |
sahilmgandhi | 18:6a4db94011d3 | 1789 | * |
sahilmgandhi | 18:6a4db94011d3 | 1790 | * @return if function successfully disabled auto acking |
sahilmgandhi | 18:6a4db94011d3 | 1791 | * |
sahilmgandhi | 18:6a4db94011d3 | 1792 | * Disable auto ack functionality. All state transitions are reverted to IDLE, |
sahilmgandhi | 18:6a4db94011d3 | 1793 | * IDLE. |
sahilmgandhi | 18:6a4db94011d3 | 1794 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1795 | RAIL_Status_t RAIL_AutoAckDisable(void); |
sahilmgandhi | 18:6a4db94011d3 | 1796 | |
sahilmgandhi | 18:6a4db94011d3 | 1797 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1798 | * Return the enable status of the auto ack feature |
sahilmgandhi | 18:6a4db94011d3 | 1799 | * |
sahilmgandhi | 18:6a4db94011d3 | 1800 | * @return true if Auto Ack is enabled, false if disabled |
sahilmgandhi | 18:6a4db94011d3 | 1801 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1802 | bool RAIL_AutoAckIsEnabled(void); |
sahilmgandhi | 18:6a4db94011d3 | 1803 | |
sahilmgandhi | 18:6a4db94011d3 | 1804 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1805 | * Configure and enable Auto Acknowledgement |
sahilmgandhi | 18:6a4db94011d3 | 1806 | * |
sahilmgandhi | 18:6a4db94011d3 | 1807 | * @param[in] config Auto ack config structure |
sahilmgandhi | 18:6a4db94011d3 | 1808 | * @return If autoack is successfully enabled |
sahilmgandhi | 18:6a4db94011d3 | 1809 | * |
sahilmgandhi | 18:6a4db94011d3 | 1810 | * Configures the RAIL state machine to for hardware accelerated auto |
sahilmgandhi | 18:6a4db94011d3 | 1811 | * acknowledgement. Ack timing parameters are defined in the configuration |
sahilmgandhi | 18:6a4db94011d3 | 1812 | * structure. |
sahilmgandhi | 18:6a4db94011d3 | 1813 | * |
sahilmgandhi | 18:6a4db94011d3 | 1814 | * While auto acking is enabled do not call the following RAIL functions: |
sahilmgandhi | 18:6a4db94011d3 | 1815 | * - RAIL_SetRxTransitions() |
sahilmgandhi | 18:6a4db94011d3 | 1816 | * - RAIL_SetTxTransitions() |
sahilmgandhi | 18:6a4db94011d3 | 1817 | * - RAIL_SetStateTiming() |
sahilmgandhi | 18:6a4db94011d3 | 1818 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1819 | RAIL_Status_t RAIL_AutoAckConfig(RAIL_AutoAckConfig_t *config); |
sahilmgandhi | 18:6a4db94011d3 | 1820 | |
sahilmgandhi | 18:6a4db94011d3 | 1821 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1822 | * Load Auto Ack buffer with ack data |
sahilmgandhi | 18:6a4db94011d3 | 1823 | * |
sahilmgandhi | 18:6a4db94011d3 | 1824 | * @param[in] ackData Pointer to ack data to transmit |
sahilmgandhi | 18:6a4db94011d3 | 1825 | * @return \ref RAIL_STATUS_INVALID_CALL if called while ACK buffer is being |
sahilmgandhi | 18:6a4db94011d3 | 1826 | * used by the radio |
sahilmgandhi | 18:6a4db94011d3 | 1827 | * |
sahilmgandhi | 18:6a4db94011d3 | 1828 | * If the ack buffer is available to be updated, load the ack buffer with data. |
sahilmgandhi | 18:6a4db94011d3 | 1829 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1830 | RAIL_Status_t RAIL_AutoAckLoadBuffer(RAIL_AutoAckData_t *ackData); |
sahilmgandhi | 18:6a4db94011d3 | 1831 | |
sahilmgandhi | 18:6a4db94011d3 | 1832 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1833 | * Pause RX Auto Ack functionality. |
sahilmgandhi | 18:6a4db94011d3 | 1834 | * |
sahilmgandhi | 18:6a4db94011d3 | 1835 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 1836 | * |
sahilmgandhi | 18:6a4db94011d3 | 1837 | * When RX Auto Acking is paused, the radio will transition to the defaultState |
sahilmgandhi | 18:6a4db94011d3 | 1838 | * after receiving a packet and will not transmit an ack. |
sahilmgandhi | 18:6a4db94011d3 | 1839 | * |
sahilmgandhi | 18:6a4db94011d3 | 1840 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1841 | void RAIL_AutoAckRxPause(void); |
sahilmgandhi | 18:6a4db94011d3 | 1842 | |
sahilmgandhi | 18:6a4db94011d3 | 1843 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1844 | * Resume Rx Auto Ack functionality. |
sahilmgandhi | 18:6a4db94011d3 | 1845 | * |
sahilmgandhi | 18:6a4db94011d3 | 1846 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 1847 | * |
sahilmgandhi | 18:6a4db94011d3 | 1848 | * When Rx Auto Ack is resumed, the radio will resume automatically acking |
sahilmgandhi | 18:6a4db94011d3 | 1849 | * every successfully received packet. |
sahilmgandhi | 18:6a4db94011d3 | 1850 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1851 | void RAIL_AutoAckRxResume(void); |
sahilmgandhi | 18:6a4db94011d3 | 1852 | |
sahilmgandhi | 18:6a4db94011d3 | 1853 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1854 | * Return if Rx Auto Ack is paused |
sahilmgandhi | 18:6a4db94011d3 | 1855 | * |
sahilmgandhi | 18:6a4db94011d3 | 1856 | * @return true if Rx Auto Ack is paused, false if not paused |
sahilmgandhi | 18:6a4db94011d3 | 1857 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1858 | bool RAIL_AutoAckRxIsPaused(void); |
sahilmgandhi | 18:6a4db94011d3 | 1859 | |
sahilmgandhi | 18:6a4db94011d3 | 1860 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1861 | * Resume Tx Auto Ack functionality. |
sahilmgandhi | 18:6a4db94011d3 | 1862 | * |
sahilmgandhi | 18:6a4db94011d3 | 1863 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 1864 | * |
sahilmgandhi | 18:6a4db94011d3 | 1865 | * When Tx Auto Ack is resumed, the radio will resume automatically waiting for |
sahilmgandhi | 18:6a4db94011d3 | 1866 | * an ack after a successful transmit. |
sahilmgandhi | 18:6a4db94011d3 | 1867 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1868 | void RAIL_AutoAckTxResume(void); |
sahilmgandhi | 18:6a4db94011d3 | 1869 | |
sahilmgandhi | 18:6a4db94011d3 | 1870 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1871 | * Pause TX Auto Ack functionality. |
sahilmgandhi | 18:6a4db94011d3 | 1872 | * |
sahilmgandhi | 18:6a4db94011d3 | 1873 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 1874 | * |
sahilmgandhi | 18:6a4db94011d3 | 1875 | * When TX Auto Acking is paused, the radio will transition to the defaultState |
sahilmgandhi | 18:6a4db94011d3 | 1876 | * after transmitting a packet and will not wait for an ack. |
sahilmgandhi | 18:6a4db94011d3 | 1877 | * |
sahilmgandhi | 18:6a4db94011d3 | 1878 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1879 | void RAIL_AutoAckTxPause(void); |
sahilmgandhi | 18:6a4db94011d3 | 1880 | |
sahilmgandhi | 18:6a4db94011d3 | 1881 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1882 | * Return if Tx Auto Ack is paused |
sahilmgandhi | 18:6a4db94011d3 | 1883 | * |
sahilmgandhi | 18:6a4db94011d3 | 1884 | * @return true if Tx Auto Ack is paused, false if not paused |
sahilmgandhi | 18:6a4db94011d3 | 1885 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1886 | bool RAIL_AutoAckTxIsPaused(void); |
sahilmgandhi | 18:6a4db94011d3 | 1887 | |
sahilmgandhi | 18:6a4db94011d3 | 1888 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1889 | * Modify the upcoming ack to use the TX Buffer |
sahilmgandhi | 18:6a4db94011d3 | 1890 | * |
sahilmgandhi | 18:6a4db94011d3 | 1891 | * @return True if the ack is modified to send from TX buffer, false if it is |
sahilmgandhi | 18:6a4db94011d3 | 1892 | * too late to switch to tx buffer or if the function call is not valid |
sahilmgandhi | 18:6a4db94011d3 | 1893 | * |
sahilmgandhi | 18:6a4db94011d3 | 1894 | * This function allows the application to use the normal TX buffer as the data |
sahilmgandhi | 18:6a4db94011d3 | 1895 | * source for the upcoming ack. The ack modification to use the TX buffer only |
sahilmgandhi | 18:6a4db94011d3 | 1896 | * applies to one ack transmission. |
sahilmgandhi | 18:6a4db94011d3 | 1897 | * |
sahilmgandhi | 18:6a4db94011d3 | 1898 | * This function will only return true if the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 1899 | * - Radio has not already decided to use the ack buffer AND |
sahilmgandhi | 18:6a4db94011d3 | 1900 | * - Radio is either looking for sync, receiving the packet after sync or in |
sahilmgandhi | 18:6a4db94011d3 | 1901 | * the Rx2Tx turnaround before the ack is sent. |
sahilmgandhi | 18:6a4db94011d3 | 1902 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1903 | bool RAIL_AutoAckUseTxBuffer(void); |
sahilmgandhi | 18:6a4db94011d3 | 1904 | |
sahilmgandhi | 18:6a4db94011d3 | 1905 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1906 | * Cancel the upcoming ack |
sahilmgandhi | 18:6a4db94011d3 | 1907 | * |
sahilmgandhi | 18:6a4db94011d3 | 1908 | * @return True if the ack is successfully cancelled, false if it is |
sahilmgandhi | 18:6a4db94011d3 | 1909 | * too late to cancel the ack or if the function call is not valid |
sahilmgandhi | 18:6a4db94011d3 | 1910 | * |
sahilmgandhi | 18:6a4db94011d3 | 1911 | * This function allows the application to use cancel the upcoming automatic |
sahilmgandhi | 18:6a4db94011d3 | 1912 | * acknowledgement. |
sahilmgandhi | 18:6a4db94011d3 | 1913 | * |
sahilmgandhi | 18:6a4db94011d3 | 1914 | * This function will only return true if the following conditions are met: |
sahilmgandhi | 18:6a4db94011d3 | 1915 | * - Radio has not already decided to transmit the ack AND |
sahilmgandhi | 18:6a4db94011d3 | 1916 | * - Radio is either looking for sync, receiving the packet after sync or in |
sahilmgandhi | 18:6a4db94011d3 | 1917 | * the Rx2Tx turnaround before the ack is sent. |
sahilmgandhi | 18:6a4db94011d3 | 1918 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1919 | bool RAIL_AutoAckCancelAck(void); |
sahilmgandhi | 18:6a4db94011d3 | 1920 | |
sahilmgandhi | 18:6a4db94011d3 | 1921 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1922 | * Return if the radio is currently waiting for an ack |
sahilmgandhi | 18:6a4db94011d3 | 1923 | * |
sahilmgandhi | 18:6a4db94011d3 | 1924 | * @return True if radio is waiting for ack, False if radio is not waiting for |
sahilmgandhi | 18:6a4db94011d3 | 1925 | * an ack |
sahilmgandhi | 18:6a4db94011d3 | 1926 | * |
sahilmgandhi | 18:6a4db94011d3 | 1927 | * This function allows the application to query if the radio is currently |
sahilmgandhi | 18:6a4db94011d3 | 1928 | * waiting for an ack after a transmit operation. |
sahilmgandhi | 18:6a4db94011d3 | 1929 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1930 | bool RAIL_AutoAckWaitingForAck(void); |
sahilmgandhi | 18:6a4db94011d3 | 1931 | |
sahilmgandhi | 18:6a4db94011d3 | 1932 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1933 | * Callback that notifies the application when searching for an ACK has timed |
sahilmgandhi | 18:6a4db94011d3 | 1934 | * out. |
sahilmgandhi | 18:6a4db94011d3 | 1935 | * |
sahilmgandhi | 18:6a4db94011d3 | 1936 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 1937 | * |
sahilmgandhi | 18:6a4db94011d3 | 1938 | * This callback function is called whenever the timeout for searching for an |
sahilmgandhi | 18:6a4db94011d3 | 1939 | * ack is exceeded. |
sahilmgandhi | 18:6a4db94011d3 | 1940 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1941 | void RAILCb_RxAckTimeout(void); |
sahilmgandhi | 18:6a4db94011d3 | 1942 | |
sahilmgandhi | 18:6a4db94011d3 | 1943 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1944 | * @} endof Auto_Acking |
sahilmgandhi | 18:6a4db94011d3 | 1945 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1946 | |
sahilmgandhi | 18:6a4db94011d3 | 1947 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 1948 | * Calibration |
sahilmgandhi | 18:6a4db94011d3 | 1949 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 1950 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1951 | * @addtogroup Calibration |
sahilmgandhi | 18:6a4db94011d3 | 1952 | * @brief APIs for calibrating the radio |
sahilmgandhi | 18:6a4db94011d3 | 1953 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 1954 | * |
sahilmgandhi | 18:6a4db94011d3 | 1955 | * These APIs can be used to calibrate the radio. The RAIL library will |
sahilmgandhi | 18:6a4db94011d3 | 1956 | * determine what calibrations are necessary to be performed. Calibrations can |
sahilmgandhi | 18:6a4db94011d3 | 1957 | * be enabled/disabled in RAIL_Init_t.calEnable. |
sahilmgandhi | 18:6a4db94011d3 | 1958 | * |
sahilmgandhi | 18:6a4db94011d3 | 1959 | * Some calibrations produce values that can be saved and reapplied to |
sahilmgandhi | 18:6a4db94011d3 | 1960 | * save repetition of the calibration process. RAIL_CalValues_t is the |
sahilmgandhi | 18:6a4db94011d3 | 1961 | * structure to communicate this value between RAIL and the application. |
sahilmgandhi | 18:6a4db94011d3 | 1962 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1963 | |
sahilmgandhi | 18:6a4db94011d3 | 1964 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1965 | * Initialize RAIL Calibration |
sahilmgandhi | 18:6a4db94011d3 | 1966 | * |
sahilmgandhi | 18:6a4db94011d3 | 1967 | * @param[in] railCalInit The initialization structure to be used for setting |
sahilmgandhi | 18:6a4db94011d3 | 1968 | * up calibration procedures. |
sahilmgandhi | 18:6a4db94011d3 | 1969 | * @return Returns zero on success and an error code on error. |
sahilmgandhi | 18:6a4db94011d3 | 1970 | * |
sahilmgandhi | 18:6a4db94011d3 | 1971 | * Calibration initialization provides the calibration settings that |
sahilmgandhi | 18:6a4db94011d3 | 1972 | * correspond to the current radio configuration. |
sahilmgandhi | 18:6a4db94011d3 | 1973 | */ |
sahilmgandhi | 18:6a4db94011d3 | 1974 | uint8_t RAIL_CalInit(const RAIL_CalInit_t *railCalInit); |
sahilmgandhi | 18:6a4db94011d3 | 1975 | |
sahilmgandhi | 18:6a4db94011d3 | 1976 | /** |
sahilmgandhi | 18:6a4db94011d3 | 1977 | * Start the calibration process |
sahilmgandhi | 18:6a4db94011d3 | 1978 | * |
sahilmgandhi | 18:6a4db94011d3 | 1979 | * @param[in] calValues Calibration Values to apply. To force the calibration |
sahilmgandhi | 18:6a4db94011d3 | 1980 | * algorithm to run set the value to \ref RAIL_CAL_INVALID_VALUE. |
sahilmgandhi | 18:6a4db94011d3 | 1981 | * @param[in] calForce Mask to force certain calibration(s) to execute. These |
sahilmgandhi | 18:6a4db94011d3 | 1982 | * will run even if not enabled during initialization. If specified, only forced |
sahilmgandhi | 18:6a4db94011d3 | 1983 | * calibrations will be run. |
sahilmgandhi | 18:6a4db94011d3 | 1984 | * @param[in] calSave If true, we will update any invalid values in calValues |
sahilmgandhi | 18:6a4db94011d3 | 1985 | * with their computed value. You can use this to save calibrations across runs. |
sahilmgandhi | 18:6a4db94011d3 | 1986 | * |
sahilmgandhi | 18:6a4db94011d3 | 1987 | * This function begins the calibration process while determining which |
sahilmgandhi | 18:6a4db94011d3 | 1988 | * calibrations should be performed. The possible list of calibration options |
sahilmgandhi | 18:6a4db94011d3 | 1989 | * are configured in RAIL_Init_t.calEnable parameter. |
sahilmgandhi | 18:6a4db94011d3 | 1990 | * |
sahilmgandhi | 18:6a4db94011d3 | 1991 | * If the calibration was performed previously and the application saves off |
sahilmgandhi | 18:6a4db94011d3 | 1992 | * the calibration value, it can be passed into function and applied to the |
sahilmgandhi | 18:6a4db94011d3 | 1993 | * chip. If the calibration value provided is \ref RAIL_CAL_INVALID_VALUE then |
sahilmgandhi | 18:6a4db94011d3 | 1994 | * the calibration will be performed to set this value. If calSave is set, the |
sahilmgandhi | 18:6a4db94011d3 | 1995 | * calibration output will update the pointer's value. If a NULL pointer is |
sahilmgandhi | 18:6a4db94011d3 | 1996 | * passed in all calibrations requested/required will be performed and the |
sahilmgandhi | 18:6a4db94011d3 | 1997 | * results will not be saved regardless of the calSave parameter. |
sahilmgandhi | 18:6a4db94011d3 | 1998 | * |
sahilmgandhi | 18:6a4db94011d3 | 1999 | * @note Some calibrations should only be executed when the radio is IDLE. See |
sahilmgandhi | 18:6a4db94011d3 | 2000 | * chip-specific documentation for more detail. |
sahilmgandhi | 18:6a4db94011d3 | 2001 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2002 | void RAIL_CalStart(RAIL_CalValues_t *calValues, RAIL_CalMask_t calForce, bool calSave); |
sahilmgandhi | 18:6a4db94011d3 | 2003 | |
sahilmgandhi | 18:6a4db94011d3 | 2004 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2005 | * Returns the current set of pending calibrations |
sahilmgandhi | 18:6a4db94011d3 | 2006 | * |
sahilmgandhi | 18:6a4db94011d3 | 2007 | * @return A mask of all pending calibrations that the user has been asked to |
sahilmgandhi | 18:6a4db94011d3 | 2008 | * perform. |
sahilmgandhi | 18:6a4db94011d3 | 2009 | * |
sahilmgandhi | 18:6a4db94011d3 | 2010 | * This function will return a full set of pending calibrations. The only way |
sahilmgandhi | 18:6a4db94011d3 | 2011 | * to clear pending calibrations is to perform them using the \ref RAIL_CalStart() |
sahilmgandhi | 18:6a4db94011d3 | 2012 | * API with the appropriate list of calibrations. |
sahilmgandhi | 18:6a4db94011d3 | 2013 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2014 | RAIL_CalMask_t RAIL_CalPendingGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 2015 | |
sahilmgandhi | 18:6a4db94011d3 | 2016 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2017 | * Callback that notifies the application that a calibration is needed. |
sahilmgandhi | 18:6a4db94011d3 | 2018 | * |
sahilmgandhi | 18:6a4db94011d3 | 2019 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 2020 | * |
sahilmgandhi | 18:6a4db94011d3 | 2021 | * This callback function is called whenever the RAIL library detects that a |
sahilmgandhi | 18:6a4db94011d3 | 2022 | * calibration is needed. It is up to the application to determine a valid |
sahilmgandhi | 18:6a4db94011d3 | 2023 | * window to call \ref RAIL_CalStart(). |
sahilmgandhi | 18:6a4db94011d3 | 2024 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2025 | void RAILCb_CalNeeded(void); |
sahilmgandhi | 18:6a4db94011d3 | 2026 | |
sahilmgandhi | 18:6a4db94011d3 | 2027 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2028 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 2029 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2030 | |
sahilmgandhi | 18:6a4db94011d3 | 2031 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 2032 | * Diagnostic |
sahilmgandhi | 18:6a4db94011d3 | 2033 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 2034 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2035 | * @addtogroup Diagnostic |
sahilmgandhi | 18:6a4db94011d3 | 2036 | * @brief APIs for diagnostic and test chip modes |
sahilmgandhi | 18:6a4db94011d3 | 2037 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 2038 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2039 | |
sahilmgandhi | 18:6a4db94011d3 | 2040 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2041 | * Enable or disable direct mode for RAIL. |
sahilmgandhi | 18:6a4db94011d3 | 2042 | * |
sahilmgandhi | 18:6a4db94011d3 | 2043 | * @param[in] enable Whether to turn direct mode on or off. At some point this |
sahilmgandhi | 18:6a4db94011d3 | 2044 | * will include a configuration structure. |
sahilmgandhi | 18:6a4db94011d3 | 2045 | * @warning This API configures fixed pins for tx data in, rx data out, rx clock |
sahilmgandhi | 18:6a4db94011d3 | 2046 | * out. There should be more control over these pins in the future but they are |
sahilmgandhi | 18:6a4db94011d3 | 2047 | * currently fixed. |
sahilmgandhi | 18:6a4db94011d3 | 2048 | * |
sahilmgandhi | 18:6a4db94011d3 | 2049 | * In this mode packets will be output and input directly to the radio via GPIO |
sahilmgandhi | 18:6a4db94011d3 | 2050 | * and RAIL packet handling will be ignored. On the EFR32, the DIN pin in TX is |
sahilmgandhi | 18:6a4db94011d3 | 2051 | * EFR32_PC10, which corresponds to EXP_HEADER15/WSTKP12, and the DOUT pin in |
sahilmgandhi | 18:6a4db94011d3 | 2052 | * RX is EFR32_PC11, which corresponds to EXP_HEADER16/WSTKP13. |
sahilmgandhi | 18:6a4db94011d3 | 2053 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2054 | void RAIL_DirectModeConfig(bool enable); |
sahilmgandhi | 18:6a4db94011d3 | 2055 | |
sahilmgandhi | 18:6a4db94011d3 | 2056 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2057 | * Set the crystal tuning |
sahilmgandhi | 18:6a4db94011d3 | 2058 | * |
sahilmgandhi | 18:6a4db94011d3 | 2059 | * @param[in] tune Chip dependent crystal capacitor bank tuning parameter |
sahilmgandhi | 18:6a4db94011d3 | 2060 | * |
sahilmgandhi | 18:6a4db94011d3 | 2061 | * Tune the crystal that the radio depends on, to change the location of the |
sahilmgandhi | 18:6a4db94011d3 | 2062 | * center frequency for transmitting and receiving. |
sahilmgandhi | 18:6a4db94011d3 | 2063 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2064 | void RAIL_SetTune(uint32_t tune); |
sahilmgandhi | 18:6a4db94011d3 | 2065 | |
sahilmgandhi | 18:6a4db94011d3 | 2066 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2067 | * Get the crystal tuning |
sahilmgandhi | 18:6a4db94011d3 | 2068 | * |
sahilmgandhi | 18:6a4db94011d3 | 2069 | * @return Chip dependent crystal capacitor bank tuning parameter |
sahilmgandhi | 18:6a4db94011d3 | 2070 | * |
sahilmgandhi | 18:6a4db94011d3 | 2071 | * Retrieve the current tuning value used by the crystal that the radio |
sahilmgandhi | 18:6a4db94011d3 | 2072 | * depends on. |
sahilmgandhi | 18:6a4db94011d3 | 2073 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2074 | uint32_t RAIL_GetTune(void); |
sahilmgandhi | 18:6a4db94011d3 | 2075 | |
sahilmgandhi | 18:6a4db94011d3 | 2076 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2077 | * Starts transmitting a tone on a certain channel |
sahilmgandhi | 18:6a4db94011d3 | 2078 | * |
sahilmgandhi | 18:6a4db94011d3 | 2079 | * @param[in] channel Define the channel to emit a tone |
sahilmgandhi | 18:6a4db94011d3 | 2080 | * @return Returns 0 on success and 1 on error |
sahilmgandhi | 18:6a4db94011d3 | 2081 | * |
sahilmgandhi | 18:6a4db94011d3 | 2082 | * Transmits a continuous wave, or tone, at the given channel, as defined by |
sahilmgandhi | 18:6a4db94011d3 | 2083 | * the channel configuration passed to RAIL_ChannelConfig(). |
sahilmgandhi | 18:6a4db94011d3 | 2084 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2085 | uint8_t RAIL_TxToneStart(uint8_t channel); |
sahilmgandhi | 18:6a4db94011d3 | 2086 | |
sahilmgandhi | 18:6a4db94011d3 | 2087 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2088 | * Stop tone transmission |
sahilmgandhi | 18:6a4db94011d3 | 2089 | * |
sahilmgandhi | 18:6a4db94011d3 | 2090 | * @return Returns 0 on success and 1 on error |
sahilmgandhi | 18:6a4db94011d3 | 2091 | * |
sahilmgandhi | 18:6a4db94011d3 | 2092 | * Halt the transmission started by RAIL_TxToneStart(). |
sahilmgandhi | 18:6a4db94011d3 | 2093 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2094 | uint8_t RAIL_TxToneStop(void); |
sahilmgandhi | 18:6a4db94011d3 | 2095 | |
sahilmgandhi | 18:6a4db94011d3 | 2096 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2097 | * Start transmitting a stream on a certain channel |
sahilmgandhi | 18:6a4db94011d3 | 2098 | * |
sahilmgandhi | 18:6a4db94011d3 | 2099 | * @param[in] channel Channel on which to emit a stream |
sahilmgandhi | 18:6a4db94011d3 | 2100 | * @param[in] mode Choose the stream mode (PN9, etc) |
sahilmgandhi | 18:6a4db94011d3 | 2101 | * @return Returns 0 on success and 1 on error |
sahilmgandhi | 18:6a4db94011d3 | 2102 | * |
sahilmgandhi | 18:6a4db94011d3 | 2103 | * Emits an encoded stream of bits on the given channel, from either a PN9 or |
sahilmgandhi | 18:6a4db94011d3 | 2104 | * pseudo-random source. |
sahilmgandhi | 18:6a4db94011d3 | 2105 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2106 | uint8_t RAIL_TxStreamStart(uint8_t channel, RAIL_StreamMode_t mode); |
sahilmgandhi | 18:6a4db94011d3 | 2107 | |
sahilmgandhi | 18:6a4db94011d3 | 2108 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2109 | * Stop stream transmission |
sahilmgandhi | 18:6a4db94011d3 | 2110 | * |
sahilmgandhi | 18:6a4db94011d3 | 2111 | * @return Returns 0 on success and 1 on error |
sahilmgandhi | 18:6a4db94011d3 | 2112 | * |
sahilmgandhi | 18:6a4db94011d3 | 2113 | * Halt the transmission started by RAIL_TxStreamStart(). |
sahilmgandhi | 18:6a4db94011d3 | 2114 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2115 | uint8_t RAIL_TxStreamStop(void); |
sahilmgandhi | 18:6a4db94011d3 | 2116 | |
sahilmgandhi | 18:6a4db94011d3 | 2117 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2118 | * Configure BER test |
sahilmgandhi | 18:6a4db94011d3 | 2119 | * |
sahilmgandhi | 18:6a4db94011d3 | 2120 | * @param[in] berConfig BER test parameters to apply. |
sahilmgandhi | 18:6a4db94011d3 | 2121 | * |
sahilmgandhi | 18:6a4db94011d3 | 2122 | * Configure settings specific to bit error rate (BER) testing. |
sahilmgandhi | 18:6a4db94011d3 | 2123 | * During BER test mode, this device will expect to receive a standard PN9 |
sahilmgandhi | 18:6a4db94011d3 | 2124 | * signal (x^9 + x^5 + 1). In order to use this BER test, the selection |
sahilmgandhi | 18:6a4db94011d3 | 2125 | * for BER mode should be enabled from the radio configurator. |
sahilmgandhi | 18:6a4db94011d3 | 2126 | * This function has been deprecated. |
sahilmgandhi | 18:6a4db94011d3 | 2127 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2128 | void RAIL_BerConfigSet(RAIL_BerConfig_t *berConfig); |
sahilmgandhi | 18:6a4db94011d3 | 2129 | |
sahilmgandhi | 18:6a4db94011d3 | 2130 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2131 | * Start BER test |
sahilmgandhi | 18:6a4db94011d3 | 2132 | * |
sahilmgandhi | 18:6a4db94011d3 | 2133 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 2134 | * |
sahilmgandhi | 18:6a4db94011d3 | 2135 | * Enter BER receive with the settings specified by RAIL_BerConfigSet(). |
sahilmgandhi | 18:6a4db94011d3 | 2136 | * This also resets the BER status. |
sahilmgandhi | 18:6a4db94011d3 | 2137 | * This function has been deprecated. |
sahilmgandhi | 18:6a4db94011d3 | 2138 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2139 | void RAIL_BerRxStart(void); |
sahilmgandhi | 18:6a4db94011d3 | 2140 | |
sahilmgandhi | 18:6a4db94011d3 | 2141 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2142 | * Stop BER test |
sahilmgandhi | 18:6a4db94011d3 | 2143 | * |
sahilmgandhi | 18:6a4db94011d3 | 2144 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 2145 | * |
sahilmgandhi | 18:6a4db94011d3 | 2146 | * Halt a test early, or exit infinite BER receive mode. |
sahilmgandhi | 18:6a4db94011d3 | 2147 | * This function has been deprecated. |
sahilmgandhi | 18:6a4db94011d3 | 2148 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2149 | void RAIL_BerRxStop(void); |
sahilmgandhi | 18:6a4db94011d3 | 2150 | |
sahilmgandhi | 18:6a4db94011d3 | 2151 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2152 | * Get BER test status |
sahilmgandhi | 18:6a4db94011d3 | 2153 | * |
sahilmgandhi | 18:6a4db94011d3 | 2154 | * @param[out] status Statistics pertaining to the latest BER test. |
sahilmgandhi | 18:6a4db94011d3 | 2155 | * @return void |
sahilmgandhi | 18:6a4db94011d3 | 2156 | * |
sahilmgandhi | 18:6a4db94011d3 | 2157 | * Get status of latest BER test. |
sahilmgandhi | 18:6a4db94011d3 | 2158 | * This function has been deprecated. |
sahilmgandhi | 18:6a4db94011d3 | 2159 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2160 | void RAIL_BerStatusGet(RAIL_BerStatus_t *status); |
sahilmgandhi | 18:6a4db94011d3 | 2161 | |
sahilmgandhi | 18:6a4db94011d3 | 2162 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2163 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 2164 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2165 | |
sahilmgandhi | 18:6a4db94011d3 | 2166 | |
sahilmgandhi | 18:6a4db94011d3 | 2167 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 2168 | * Debug |
sahilmgandhi | 18:6a4db94011d3 | 2169 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 2170 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2171 | * @addtogroup Debug |
sahilmgandhi | 18:6a4db94011d3 | 2172 | * @brief APIs for debugging |
sahilmgandhi | 18:6a4db94011d3 | 2173 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 2174 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2175 | |
sahilmgandhi | 18:6a4db94011d3 | 2176 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
sahilmgandhi | 18:6a4db94011d3 | 2177 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2178 | * Configure Debug callbacks (all are optional) |
sahilmgandhi | 18:6a4db94011d3 | 2179 | * |
sahilmgandhi | 18:6a4db94011d3 | 2180 | * @param[in] cbToEnable Define statuses that force TxRadioStatus callback |
sahilmgandhi | 18:6a4db94011d3 | 2181 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2182 | void RAIL_DebugCbConfig(uint32_t cbToEnable); |
sahilmgandhi | 18:6a4db94011d3 | 2183 | |
sahilmgandhi | 18:6a4db94011d3 | 2184 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2185 | * Configure the debug mode for the radio library. Do not use this function |
sahilmgandhi | 18:6a4db94011d3 | 2186 | * unless instructed to by Silicon Labs. |
sahilmgandhi | 18:6a4db94011d3 | 2187 | * @param debugMode The debug mode to enter |
sahilmgandhi | 18:6a4db94011d3 | 2188 | * @return Whether this command ran successfully or not. |
sahilmgandhi | 18:6a4db94011d3 | 2189 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2190 | RAIL_Status_t RAIL_DebugModeSet(uint32_t debugMode); |
sahilmgandhi | 18:6a4db94011d3 | 2191 | |
sahilmgandhi | 18:6a4db94011d3 | 2192 | uint32_t RAIL_DebugModeGet(void); |
sahilmgandhi | 18:6a4db94011d3 | 2193 | |
sahilmgandhi | 18:6a4db94011d3 | 2194 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2195 | * Override the radio base frequency |
sahilmgandhi | 18:6a4db94011d3 | 2196 | * |
sahilmgandhi | 18:6a4db94011d3 | 2197 | * @param[in] freq Desired frequency in Hz |
sahilmgandhi | 18:6a4db94011d3 | 2198 | * |
sahilmgandhi | 18:6a4db94011d3 | 2199 | * Sets the radio to transmit at the frequency given. This function can only |
sahilmgandhi | 18:6a4db94011d3 | 2200 | * be used while in RAIL_DEBUG_MODE_FREQ_OVERRIDE. The given frequency needs |
sahilmgandhi | 18:6a4db94011d3 | 2201 | * to be close to the base frequency of the current PHY. |
sahilmgandhi | 18:6a4db94011d3 | 2202 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2203 | RAIL_Status_t RAIL_DebugFrequencyOverride(uint32_t freq); |
sahilmgandhi | 18:6a4db94011d3 | 2204 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 2205 | |
sahilmgandhi | 18:6a4db94011d3 | 2206 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2207 | * Callback function to signify when the radio changes state. |
sahilmgandhi | 18:6a4db94011d3 | 2208 | * |
sahilmgandhi | 18:6a4db94011d3 | 2209 | * @param[in] state Current state of the radio. Exact values are for internal |
sahilmgandhi | 18:6a4db94011d3 | 2210 | * use only. |
sahilmgandhi | 18:6a4db94011d3 | 2211 | * |
sahilmgandhi | 18:6a4db94011d3 | 2212 | * This is for debug and __NOT__ for application use. It is not called by |
sahilmgandhi | 18:6a4db94011d3 | 2213 | * default but is required for the linking process. |
sahilmgandhi | 18:6a4db94011d3 | 2214 | * |
sahilmgandhi | 18:6a4db94011d3 | 2215 | * Create an empty function for this callback as shown below. |
sahilmgandhi | 18:6a4db94011d3 | 2216 | * |
sahilmgandhi | 18:6a4db94011d3 | 2217 | * @code{.c} |
sahilmgandhi | 18:6a4db94011d3 | 2218 | * RAILCb_RadioStateChanged(uint8_t state) { |
sahilmgandhi | 18:6a4db94011d3 | 2219 | * } |
sahilmgandhi | 18:6a4db94011d3 | 2220 | * @endcode |
sahilmgandhi | 18:6a4db94011d3 | 2221 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2222 | void RAILCb_RadioStateChanged(uint8_t state); |
sahilmgandhi | 18:6a4db94011d3 | 2223 | |
sahilmgandhi | 18:6a4db94011d3 | 2224 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2225 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 2226 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2227 | |
sahilmgandhi | 18:6a4db94011d3 | 2228 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2229 | * end of RAIL_API |
sahilmgandhi | 18:6a4db94011d3 | 2230 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 2231 | */ |
sahilmgandhi | 18:6a4db94011d3 | 2232 | |
sahilmgandhi | 18:6a4db94011d3 | 2233 | #endif // __RAIL_H__ |