55#include "driverlib/rf_common_cmd.h"
60#define RF_CORE_FRONT_END_MODE_DIFFERENTIAL 0
61#define RF_CORE_FRONT_END_MODE_SINGLE_RFP 1
62#define RF_CORE_FRONT_END_MODE_SINGLE_RFN 2
64#define RF_CORE_BIAS_MODE_INTERNAL 0
65#define RF_CORE_BIAS_MODE_EXTERNAL 1
71#ifdef RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE
72#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_CONF_RADIO_SETUP_FRONT_END_MODE
74#define RF_CORE_RADIO_SETUP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL
77#ifdef RF_CORE_CONF_RADIO_SETUP_BIAS_MODE
78#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_CONF_RADIO_SETUP_BIAS_MODE
80#define RF_CORE_RADIO_SETUP_BIAS_MODE RF_CORE_BIAS_MODE_INTERNAL
87#ifdef RF_CORE_CONF_PROP_FRONT_END_MODE
88#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_CONF_PROP_FRONT_END_MODE
90#define RF_CORE_PROP_FRONT_END_MODE RF_CORE_FRONT_END_MODE_DIFFERENTIAL
93#ifdef RF_CORE_CONF_PROP_BIAS_MODE
94#define RF_CORE_PROP_BIAS_MODE RF_CORE_CONF_PROP_BIAS_MODE
96#define RF_CORE_PROP_BIAS_MODE RF_CORE_BIAS_MODE_EXTERNAL
99#define RF_CORE_CMD_ERROR 0
100#define RF_CORE_CMD_OK 1
150#define RF_CORE_CMDSTA_PENDING 0x00
151#define RF_CORE_CMDSTA_DONE 0x01
152#define RF_CORE_CMDSTA_ILLEGAL_PTR 0x81
153#define RF_CORE_CMDSTA_UNKNOWN_CMD 0x82
154#define RF_CORE_CMDSTA_UNKNOWN_DIR_CMD 0x83
155#define RF_CORE_CMDSTA_CONTEXT_ERR 0x85
156#define RF_CORE_CMDSTA_SCHEDULING_ERR 0x86
157#define RF_CORE_CMDSTA_PAR_ERR 0x87
158#define RF_CORE_CMDSTA_QUEUE_ERR 0x88
159#define RF_CORE_CMDSTA_QUEUE_BUSY 0x89
162#define RF_CORE_CMDSTA_ERR_MASK 0x80
165#define RF_CORE_CMDSTA_RESULT_MASK 0xFF
167#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
169#define RF_CORE_NOT_ACCESSIBLE 0x00
170#define RF_CORE_ACCESSIBLE 0x01
173#define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
174#define RF_CORE_RADIO_OP_STATUS_PENDING 0x0001
175#define RF_CORE_RADIO_OP_STATUS_ACTIVE 0x0002
176#define RF_CORE_RADIO_OP_STATUS_SKIPPED 0x0003
177#define RF_CORE_RADIO_OP_STATUS_DONE_OK 0x0400
178#define RF_CORE_RADIO_OP_STATUS_DONE_COUNTDOWN 0x0401
179#define RF_CORE_RADIO_OP_STATUS_DONE_RXERR 0x0402
180#define RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT 0x0403
181#define RF_CORE_RADIO_OP_STATUS_DONE_STOPPED 0x0404
182#define RF_CORE_RADIO_OP_STATUS_DONE_ABORT 0x0405
183#define RF_CORE_RADIO_OP_STATUS_ERROR_PAST_START 0x0800
184#define RF_CORE_RADIO_OP_STATUS_ERROR_START_TRIG 0x0801
185#define RF_CORE_RADIO_OP_STATUS_ERROR_CONDITION 0x0802
186#define RF_CORE_RADIO_OP_STATUS_ERROR_PAR 0x0803
187#define RF_CORE_RADIO_OP_STATUS_ERROR_POINTER 0x0804
188#define RF_CORE_RADIO_OP_STATUS_ERROR_CMDID 0x0805
189#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_SETUP 0x0807
190#define RF_CORE_RADIO_OP_STATUS_ERROR_NO_FS 0x0808
191#define RF_CORE_RADIO_OP_STATUS_ERROR_SYNTH_PROG 0x0809
194#define RF_CORE_RADIO_OP_STATUS_IEEE_SUSPENDED 0x2001
195#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK 0x2400
196#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BUSY 0x2401
197#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_STOPPED 0x2402
198#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACK 0x2403
199#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACKPEND 0x2404
200#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_TIMEOUT 0x2405
201#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BGEND 0x2406
202#define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ABORT 0x2407
203#define RF_CORE_RADIO_OP_STATUS_ERROR_WRONG_BG 0x0806
204#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_PAR 0x2800
205#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_SETUP 0x2801
206#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_FS 0x2802
207#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_SYNTH_PROG 0x2803
208#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_RXOVF 0x2804
209#define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_TXUNF 0x2805
212#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_OK 0x1400
213#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXTIMEOUT 0x1401
214#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_NOSYNC 0x1402
215#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXERR 0x1403
216#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_CONNECT 0x1404
217#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_MAXNACK 0x1405
218#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ENDED 0x1406
219#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ABORT 0x1407
220#define RF_CORE_RADIO_OP_STATUS_BLE_DONE_STOPPED 0x1408
221#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_PAR 0x1800
222#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXBUF 0x1801
223#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_SETUP 0x1802
224#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_FS 0x1803
225#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_SYNTH_PROG 0x1804
226#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXOVF 0x1805
227#define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_TXUNF 0x1806
230#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK 0x3400
231#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXTIMEOUT 0x3401
232#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BREAK 0x3402
233#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ENDED 0x3403
234#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_STOPPED 0x3404
235#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ABORT 0x3405
236#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXERR 0x3406
237#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLE 0x3407
238#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSY 0x3408
239#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLETIMEOUT 0x3409
240#define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSYTIMEOUT 0x340A
241#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_PAR 0x3800
242#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXBUF 0x3801
243#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXFULL 0x3802
244#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_SETUP 0x3803
245#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_FS 0x3804
246#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXOVF 0x3805
247#define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_TXUNF 0x3806
250#define RF_CORE_RADIO_OP_STATUS_PROTO_MASK 0xF000
251#define RF_CORE_RADIO_OP_STATUS_PROTO_GENERIC 0x0000
252#define RF_CORE_RADIO_OP_STATUS_PROTO_BLE 0x1000
253#define RF_CORE_RADIO_OP_STATUS_PROTO_IEEE 0x2000
254#define RF_CORE_RADIO_OP_STATUS_PROTO_PROP 0x3000
257#define RF_CORE_RADIO_OP_MASKED_STATUS 0x0C00
258#define RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING 0x0000
259#define RF_CORE_RADIO_OP_MASKED_STATUS_DONE 0x0400
260#define RF_CORE_RADIO_OP_MASKED_STATUS_ERROR 0x0800
263#define RF_CORE_COMMAND_TYPE_MASK 0x0C00
264#define RF_CORE_COMMAND_TYPE_RADIO_OP 0x0800
265#define RF_CORE_COMMAND_TYPE_IEEE_BG_RADIO_OP 0x0800
266#define RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP 0x0C00
268#define RF_CORE_COMMAND_PROTOCOL_MASK 0x3000
269#define RF_CORE_COMMAND_PROTOCOL_COMMON 0x0000
270#define RF_CORE_COMMAND_PROTOCOL_BLE 0x1000
271#define RF_CORE_COMMAND_PROTOCOL_IEEE 0x2000
272#define RF_CORE_COMMAND_PROTOCOL_PROP 0x3000
275#define RATCNT 0x00000004
278#define RF_CORE_CMD_CCA_REQ_RSSI_UNKNOWN -128
281#define RF_CORE_CCA_CLEAR 1
282#define RF_CORE_CCA_BUSY 0
285#define RF_CORE_GET_CCA_INFO_ERROR 0xFF
291#define RF_CORE_CMD_CCA_REQ_CCA_STATE_IDLE 0
292#define RF_CORE_CMD_CCA_REQ_CCA_STATE_BUSY 1
293#define RF_CORE_CMD_CCA_REQ_CCA_STATE_INVALID 2
295#define RF_CORE_CMD_CCA_REQ_CCA_CORR_IDLE (0 << 4)
296#define RF_CORE_CMD_CCA_REQ_CCA_CORR_BUSY (1 << 4)
297#define RF_CORE_CMD_CCA_REQ_CCA_CORR_INVALID (3 << 4)
298#define RF_CORE_CMD_CCA_REQ_CCA_CORR_MASK (3 << 4)
300#define RF_CORE_CMD_CCA_REQ_CCA_SYNC_BUSY (1 << 6)
302#define RF_CORE_RX_BUF_INCLUDE_CRC 0
303#define RF_CORE_RX_BUF_INCLUDE_RSSI 1
304#define RF_CORE_RX_BUF_INCLUDE_CORR 1
305#define RF_CORE_RX_BUF_INCLUDE_TIMESTAMP 1
308#define RF_CORE_TX_TIMEOUT (RTIMER_SECOND >> 11)
311#define RF_CORE_ENTER_RX_TIMEOUT (RTIMER_SECOND >> 10)
314#define RF_CORE_TURN_OFF_TIMEOUT (RTIMER_SECOND >> 10)
317#define RF_CORE_TX_FINISH_TIMEOUT (RTIMER_SECOND >> 7)
325extern volatile int8_t rf_core_last_rssi;
327extern volatile uint8_t rf_core_last_corr_lqi;
329extern volatile uint32_t rf_core_last_packet_timestamp;
332extern uint8_t rf_core_poll_mode;
#define PROCESS_NAME(name)
Declare the name of a process.
void rf_core_primary_mode_abort()
Abort the currently running primary radio op.
void rf_core_cmd_done_dis(void)
Disable the LAST_CMD_DONE and LAST_FG_CMD_DONE interrupts.
void rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command)
Prepare a buffer to host a Radio Op.
uint8_t rf_core_stop_rat(void)
Stop the CM0 RAT synchronously.
void rf_core_power_down()
Disable RFCORE clock domain in the MCU VD and turn off the RFCORE PD.
struct rf_core_primary_mode_s rf_core_primary_mode_t
A data strcuture representing the radio's primary mode of operation.
uint32_t rf_core_cmd_status(void)
Get the status of the last issued radio command.
uint_fast8_t rf_core_send_cmd(uint32_t cmd, uint32_t *status)
Sends a command to the RF core.
uint8_t rf_core_is_accessible()
Check whether the RF core is accessible.
rfc_radioOp_t * rf_core_get_last_radio_op()
Returns a pointer to the most recent proto-dependent Radio Op.
int rf_core_power_up()
Turn on power to the RFC and boot it.
uint8_t rf_core_boot()
Boot the RF Core.
uint8_t rf_core_set_modesel()
Initialise RF APIs in the RF core.
uint_fast8_t rf_core_wait_cmd_done(void *cmd)
Block and wait for a Radio op to complete.
uint32_t rf_core_convert_rat_to_rtimer(uint32_t rat_timestamp)
Convert from RAT timestamp to rtimer ticks.
void rf_core_cmd_done_en(bool fg)
Enable interrupt on command done.
uint8_t rf_core_restart_rat(void)
Restart the CM0 RAT.
void rf_core_primary_mode_register(const rf_core_primary_mode_t *mode)
Register a primary mode for radio operation.
void rf_core_setup_interrupts(void)
Setup RF core interrupts.
uint8_t rf_core_rat_init(void)
Initialize the RAT to RTC conversion machinery.
uint8_t rf_core_primary_mode_restore()
Abort the currently running primary radio op.
uint8_t rf_core_check_rat_overflow(void)
Check if RAT overflow has occured and increment the overflow counter if so.
uint8_t rf_core_start_rat(void)
Start the CM0 RAT.
A data strcuture representing the radio's primary mode of operation.
void(* abort)(void)
A pointer to a function used to abort the current radio op.
int16_t sfd_timestamp_offset
Offset of the end of SFD when compared to the radio HW-generated timestamp.
uint8_t(* restore)(void)
A pointer to a function that will restore the previous radio op.
uint8_t(* is_on)(void)
A pointer to a function that checks if the radio is on.