54 #include "contiki-conf.h"
55 #include "rf-core/api/common_cmd.h"
61 #ifdef RF_CORE_CONF_CHANNEL
62 #define RF_CORE_CHANNEL RF_CORE_CONF_CHANNEL
64 #define RF_CORE_CHANNEL 25
67 #define RF_CORE_CMD_ERROR 0
68 #define RF_CORE_CMD_OK 1
107 #define RF_CORE_CMDSTA_PENDING 0x00
108 #define RF_CORE_CMDSTA_DONE 0x01
109 #define RF_CORE_CMDSTA_ILLEGAL_PTR 0x81
110 #define RF_CORE_CMDSTA_UNKNOWN_CMD 0x82
111 #define RF_CORE_CMDSTA_UNKNOWN_DIR_CMD 0x83
112 #define RF_CORE_CMDSTA_CONTEXT_ERR 0x85
113 #define RF_CORE_CMDSTA_SCHEDULING_ERR 0x86
114 #define RF_CORE_CMDSTA_PAR_ERR 0x87
115 #define RF_CORE_CMDSTA_QUEUE_ERR 0x88
116 #define RF_CORE_CMDSTA_QUEUE_BUSY 0x89
119 #define RF_CORE_CMDSTA_ERR_MASK 0x80
122 #define RF_CORE_CMDSTA_RESULT_MASK 0xFF
124 #define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
126 #define RF_CORE_NOT_ACCESSIBLE 0x00
127 #define RF_CORE_ACCESSIBLE 0x01
130 #define RF_CORE_RADIO_OP_STATUS_IDLE 0x0000
131 #define RF_CORE_RADIO_OP_STATUS_PENDING 0x0001
132 #define RF_CORE_RADIO_OP_STATUS_ACTIVE 0x0002
133 #define RF_CORE_RADIO_OP_STATUS_SKIPPED 0x0003
134 #define RF_CORE_RADIO_OP_STATUS_DONE_OK 0x0400
135 #define RF_CORE_RADIO_OP_STATUS_DONE_COUNTDOWN 0x0401
136 #define RF_CORE_RADIO_OP_STATUS_DONE_RXERR 0x0402
137 #define RF_CORE_RADIO_OP_STATUS_DONE_TIMEOUT 0x0403
138 #define RF_CORE_RADIO_OP_STATUS_DONE_STOPPED 0x0404
139 #define RF_CORE_RADIO_OP_STATUS_DONE_ABORT 0x0405
140 #define RF_CORE_RADIO_OP_STATUS_ERROR_PAST_START 0x0800
141 #define RF_CORE_RADIO_OP_STATUS_ERROR_START_TRIG 0x0801
142 #define RF_CORE_RADIO_OP_STATUS_ERROR_CONDITION 0x0802
143 #define RF_CORE_RADIO_OP_STATUS_ERROR_PAR 0x0803
144 #define RF_CORE_RADIO_OP_STATUS_ERROR_POINTER 0x0804
145 #define RF_CORE_RADIO_OP_STATUS_ERROR_CMDID 0x0805
146 #define RF_CORE_RADIO_OP_STATUS_ERROR_NO_SETUP 0x0807
147 #define RF_CORE_RADIO_OP_STATUS_ERROR_NO_FS 0x0808
148 #define RF_CORE_RADIO_OP_STATUS_ERROR_SYNTH_PROG 0x0809
151 #define RF_CORE_RADIO_OP_STATUS_IEEE_SUSPENDED 0x2001
152 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK 0x2400
153 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BUSY 0x2401
154 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_STOPPED 0x2402
155 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACK 0x2403
156 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ACKPEND 0x2404
157 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_TIMEOUT 0x2405
158 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_BGEND 0x2406
159 #define RF_CORE_RADIO_OP_STATUS_IEEE_DONE_ABORT 0x2407
160 #define RF_CORE_RADIO_OP_STATUS_ERROR_WRONG_BG 0x0806
161 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_PAR 0x2800
162 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_SETUP 0x2801
163 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_NO_FS 0x2802
164 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_SYNTH_PROG 0x2803
165 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_RXOVF 0x2804
166 #define RF_CORE_RADIO_OP_STATUS_IEEE_ERROR_TXUNF 0x2805
169 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_OK 0x1400
170 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXTIMEOUT 0x1401
171 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_NOSYNC 0x1402
172 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_RXERR 0x1403
173 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_CONNECT 0x1404
174 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_MAXNACK 0x1405
175 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ENDED 0x1406
176 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_ABORT 0x1407
177 #define RF_CORE_RADIO_OP_STATUS_BLE_DONE_STOPPED 0x1408
178 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_PAR 0x1800
179 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXBUF 0x1801
180 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_SETUP 0x1802
181 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_NO_FS 0x1803
182 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_SYNTH_PROG 0x1804
183 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_RXOVF 0x1805
184 #define RF_CORE_RADIO_OP_STATUS_BLE_ERROR_TXUNF 0x1806
187 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK 0x3400
188 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXTIMEOUT 0x3401
189 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BREAK 0x3402
190 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ENDED 0x3403
191 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_STOPPED 0x3404
192 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_ABORT 0x3405
193 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_RXERR 0x3406
194 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLE 0x3407
195 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSY 0x3408
196 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_IDLETIMEOUT 0x3409
197 #define RF_CORE_RADIO_OP_STATUS_PROP_DONE_BUSYTIMEOUT 0x340A
198 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_PAR 0x3800
199 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXBUF 0x3801
200 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXFULL 0x3802
201 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_SETUP 0x3803
202 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_NO_FS 0x3804
203 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_RXOVF 0x3805
204 #define RF_CORE_RADIO_OP_STATUS_PROP_ERROR_TXUNF 0x3806
207 #define RF_CORE_RADIO_OP_STATUS_PROTO_MASK 0xF000
208 #define RF_CORE_RADIO_OP_STATUS_PROTO_GENERIC 0x0000
209 #define RF_CORE_RADIO_OP_STATUS_PROTO_BLE 0x1000
210 #define RF_CORE_RADIO_OP_STATUS_PROTO_IEEE 0x2000
211 #define RF_CORE_RADIO_OP_STATUS_PROTO_PROP 0x3000
214 #define RF_CORE_RADIO_OP_MASKED_STATUS 0x0C00
215 #define RF_CORE_RADIO_OP_MASKED_STATUS_RUNNING 0x0000
216 #define RF_CORE_RADIO_OP_MASKED_STATUS_DONE 0x0400
217 #define RF_CORE_RADIO_OP_MASKED_STATUS_ERROR 0x0800
220 #define RF_CORE_COMMAND_TYPE_MASK 0x0C00
221 #define RF_CORE_COMMAND_TYPE_RADIO_OP 0x0800
222 #define RF_CORE_COMMAND_TYPE_IEEE_BG_RADIO_OP 0x0800
223 #define RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP 0x0C00
225 #define RF_CORE_COMMAND_PROTOCOL_MASK 0x3000
226 #define RF_CORE_COMMAND_PROTOCOL_COMMON 0x0000
227 #define RF_CORE_COMMAND_PROTOCOL_BLE 0x1000
228 #define RF_CORE_COMMAND_PROTOCOL_IEEE 0x2000
229 #define RF_CORE_COMMAND_PROTOCOL_PROP 0x3000
void rf_core_power_down()
Disable RFCORE clock domain in the MCU VD and turn off the RFCORE PD.
uint8_t(* restore)(void)
A pointer to a function that will restore the previous radio op.
void rf_core_primary_mode_abort()
Abort the currently running primary radio op.
void rf_core_setup_interrupts()
Setup RF core interrupts.
PROCESS_NAME(sample_process)
Process the sampler runs as.
uint8_t rf_core_is_accessible()
Check whether the RF core is accessible.
uint8_t rf_core_set_modesel()
Initialise RF APIs in the RF core.
void rf_core_cmd_done_en(bool fg)
Enable interrupt on command done.
uint8_t rf_core_boot()
Boot the RF Core.
void(* abort)(void)
A pointer to a function used to abort the current radio op.
int rf_core_power_up()
Turn on power to the RFC and boot it.
void rf_core_primary_mode_register(const rf_core_primary_mode_t *mode)
Register a primary mode for radio operation.
struct rf_core_primary_mode_s rf_core_primary_mode_t
A data strcuture representing the radio's primary mode of operation.
uint_fast8_t rf_core_send_cmd(uint32_t cmd, uint32_t *status)
Sends a command to the RF core.
rfc_radioOp_t * rf_core_get_last_radio_op()
Returns a pointer to the most recent proto-dependent Radio Op.
uint8_t rf_core_primary_mode_restore()
Abort the currently running primary radio op.
uint8_t rf_core_start_rat()
Start the CM0 RAT.
void rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command)
Prepare a buffer to host a Radio Op.
void rf_core_cmd_done_dis()
Disable the LAST_CMD_DONE and LAST_FG_CMD_DONE interrupts.
A data strcuture representing the radio's primary mode of operation.
uint_fast8_t rf_core_wait_cmd_done(void *cmd)
Block and wait for a Radio op to complete.