Contiki 3.x
rf-core.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 /*---------------------------------------------------------------------------*/
31 /**
32  * \addtogroup rf-core
33  * @{
34  *
35  * \file
36  * Implementation of the CC13xx/CC26xx RF core driver
37  */
38 /*---------------------------------------------------------------------------*/
39 #include "contiki-conf.h"
40 #include "dev/watchdog.h"
41 #include "sys/process.h"
42 #include "sys/energest.h"
43 #include "sys/cc.h"
44 #include "net/netstack.h"
45 #include "net/packetbuf.h"
46 #include "net/rime/rimestats.h"
47 #include "rf-core/rf-core.h"
48 #include "ti-lib.h"
49 /*---------------------------------------------------------------------------*/
50 /* RF core and RF HAL API */
51 #include "hw_rfc_dbell.h"
52 #include "hw_rfc_pwr.h"
53 /*---------------------------------------------------------------------------*/
54 /* RF Core Mailbox API */
55 #include "rf-core/api/mailbox.h"
56 #include "rf-core/api/common_cmd.h"
57 #include "rf-core/api/ble_cmd.h"
58 #include "rf-core/api/ieee_cmd.h"
59 #include "rf-core/api/data_entry.h"
60 #include "rf-core/api/ble_mailbox.h"
61 #include "rf-core/api/ieee_mailbox.h"
62 #include "rf-core/api/prop_mailbox.h"
63 #include "rf-core/api/prop_cmd.h"
64 /*---------------------------------------------------------------------------*/
65 #include <stdint.h>
66 #include <stdbool.h>
67 #include <stdio.h>
68 #include <string.h>
69 /*---------------------------------------------------------------------------*/
70 #define DEBUG 0
71 #if DEBUG
72 #define PRINTF(...) printf(__VA_ARGS__)
73 #else
74 #define PRINTF(...)
75 #endif
76 /*---------------------------------------------------------------------------*/
77 #ifdef RF_CORE_CONF_DEBUG_CRC
78 #define RF_CORE_DEBUG_CRC RF_CORE_CONF_DEBUG_CRC
79 #else
80 #define RF_CORE_DEBUG_CRC DEBUG
81 #endif
82 /*---------------------------------------------------------------------------*/
83 /* RF interrupts */
84 #define RX_FRAME_IRQ IRQ_RX_ENTRY_DONE
85 #define ERROR_IRQ IRQ_INTERNAL_ERROR
86 #define RX_NOK_IRQ IRQ_RX_NOK
87 
88 /* Those IRQs are enabled all the time */
89 #if RF_CORE_DEBUG_CRC
90 #define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ | RX_NOK_IRQ)
91 #else
92 #define ENABLED_IRQS (RX_FRAME_IRQ | ERROR_IRQ)
93 #endif
94 
95 #define cc26xx_rf_cpe0_isr RFCCPE0IntHandler
96 #define cc26xx_rf_cpe1_isr RFCCPE1IntHandler
97 /*---------------------------------------------------------------------------*/
98 /* Remember the last Radio Op issued to the radio */
99 static rfc_radioOp_t *last_radio_op = NULL;
100 /*---------------------------------------------------------------------------*/
101 /* A struct holding pointers to the primary mode's abort() and restore() */
102 static const rf_core_primary_mode_t *primary_mode = NULL;
103 /*---------------------------------------------------------------------------*/
104 PROCESS(rf_core_process, "CC13xx / CC26xx RF driver");
105 /*---------------------------------------------------------------------------*/
106 #define RF_CORE_CLOCKS_MASK (RFC_PWR_PWMCLKEN_RFC_M | RFC_PWR_PWMCLKEN_CPE_M \
107  | RFC_PWR_PWMCLKEN_CPERAM_M)
108 /*---------------------------------------------------------------------------*/
109 uint8_t
111 {
112  if(ti_lib_prcm_rf_ready()) {
113  return RF_CORE_ACCESSIBLE;
114  }
115  return RF_CORE_NOT_ACCESSIBLE;
116 }
117 /*---------------------------------------------------------------------------*/
118 uint_fast8_t
119 rf_core_send_cmd(uint32_t cmd, uint32_t *status)
120 {
121  uint32_t timeout_count = 0;
122  bool interrupts_disabled;
123  bool is_radio_op = false;
124 
125  /*
126  * If cmd is 4-byte aligned, then it's either a radio OP or an immediate
127  * command. Clear the status field if it's a radio OP
128  */
129  if((cmd & 0x03) == 0) {
130  uint32_t cmd_type;
131  cmd_type = ((rfc_command_t *)cmd)->commandNo & RF_CORE_COMMAND_TYPE_MASK;
132  if(cmd_type == RF_CORE_COMMAND_TYPE_IEEE_FG_RADIO_OP ||
133  cmd_type == RF_CORE_COMMAND_TYPE_RADIO_OP) {
134  is_radio_op = true;
135  ((rfc_radioOp_t *)cmd)->status = RF_CORE_RADIO_OP_STATUS_IDLE;
136  }
137  }
138 
139  /*
140  * Make sure ContikiMAC doesn't turn us off from within an interrupt while
141  * we are accessing RF Core registers
142  */
143  interrupts_disabled = ti_lib_int_master_disable();
144 
145  if(!rf_core_is_accessible()) {
146  PRINTF("rf_core_send_cmd: RF was off\n");
147  if(!interrupts_disabled) {
148  ti_lib_int_master_enable();
149  }
150  return RF_CORE_CMD_ERROR;
151  }
152 
153  if(is_radio_op) {
154  uint16_t command_no = ((rfc_radioOp_t *)cmd)->commandNo;
155  if((command_no & RF_CORE_COMMAND_PROTOCOL_MASK) != RF_CORE_COMMAND_PROTOCOL_COMMON &&
156  (command_no & RF_CORE_COMMAND_TYPE_MASK) == RF_CORE_COMMAND_TYPE_RADIO_OP) {
157  last_radio_op = (rfc_radioOp_t *)cmd;
158  }
159  }
160 
161  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = cmd;
162  do {
163  *status = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA);
164  if(++timeout_count > 50000) {
165  PRINTF("rf_core_send_cmd: 0x%08lx Timeout\n", cmd);
166  if(!interrupts_disabled) {
167  ti_lib_int_master_enable();
168  }
169  return RF_CORE_CMD_ERROR;
170  }
171  } while((*status & RF_CORE_CMDSTA_RESULT_MASK) == RF_CORE_CMDSTA_PENDING);
172 
173  if(!interrupts_disabled) {
174  ti_lib_int_master_enable();
175  }
176 
177  /*
178  * If we reach here the command is no longer pending. It is either completed
179  * successfully or with error
180  */
181  return (*status & RF_CORE_CMDSTA_RESULT_MASK) == RF_CORE_CMDSTA_DONE;
182 }
183 /*---------------------------------------------------------------------------*/
184 uint_fast8_t
186 {
187  volatile rfc_radioOp_t *command = (rfc_radioOp_t *)cmd;
188  uint32_t timeout_cnt = 0;
189 
190  /*
191  * 0xn4nn=DONE, 0x0400=DONE_OK while all other "DONE" values means done
192  * but with some kind of error (ref. "Common radio operation status codes")
193  */
194  do {
195  if(++timeout_cnt > 500000) {
196  return RF_CORE_CMD_ERROR;
197  }
198  } while((command->status & RF_CORE_RADIO_OP_MASKED_STATUS)
199  != RF_CORE_RADIO_OP_MASKED_STATUS_DONE);
200 
201  return (command->status & RF_CORE_RADIO_OP_MASKED_STATUS)
202  == RF_CORE_RADIO_OP_STATUS_DONE_OK;
203 }
204 /*---------------------------------------------------------------------------*/
205 static int
206 fs_powerdown(void)
207 {
208  rfc_CMD_FS_POWERDOWN_t cmd;
209  uint32_t cmd_status;
210 
211  rf_core_init_radio_op((rfc_radioOp_t *)&cmd, sizeof(cmd), CMD_FS_POWERDOWN);
212 
213  if(rf_core_send_cmd((uint32_t)&cmd, &cmd_status) != RF_CORE_CMD_OK) {
214  PRINTF("fs_powerdown: CMDSTA=0x%08lx\n", cmd_status);
215  return RF_CORE_CMD_ERROR;
216  }
217 
218  if(rf_core_wait_cmd_done(&cmd) != RF_CORE_CMD_OK) {
219  PRINTF("fs_powerdown: CMDSTA=0x%08lx, status=0x%04x\n",
220  cmd_status, cmd.status);
221  return RF_CORE_CMD_ERROR;
222  }
223 
224  return RF_CORE_CMD_OK;
225 }
226 /*---------------------------------------------------------------------------*/
227 int
229 {
230  uint32_t cmd_status;
231  bool interrupts_disabled = ti_lib_int_master_disable();
232 
233  ti_lib_int_pend_clear(INT_RF_CPE0);
234  ti_lib_int_pend_clear(INT_RF_CPE1);
235  ti_lib_int_disable(INT_RF_CPE0);
236  ti_lib_int_disable(INT_RF_CPE1);
237 
238  /* Enable RF Core power domain */
239  ti_lib_prcm_power_domain_on(PRCM_DOMAIN_RFCORE);
240  while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE)
241  != PRCM_DOMAIN_POWER_ON);
242 
243  ti_lib_prcm_domain_enable(PRCM_DOMAIN_RFCORE);
244  ti_lib_prcm_load_set();
245  while(!ti_lib_prcm_load_get());
246 
247  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
248  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0;
249  ti_lib_int_enable(INT_RF_CPE0);
250  ti_lib_int_enable(INT_RF_CPE1);
251 
252  if(!interrupts_disabled) {
253  ti_lib_int_master_enable();
254  }
255 
256  /* Let CPE boot */
257  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RF_CORE_CLOCKS_MASK;
258 
259  /* Send ping (to verify RFCore is ready and alive) */
260  if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_PING), &cmd_status) != RF_CORE_CMD_OK) {
261  PRINTF("rf_core_power_up: CMD_PING fail, CMDSTA=0x%08lx\n", cmd_status);
262  return RF_CORE_CMD_ERROR;
263  }
264 
265  return RF_CORE_CMD_OK;
266 }
267 /*---------------------------------------------------------------------------*/
268 void
270 {
271  bool interrupts_disabled = ti_lib_int_master_disable();
272  ti_lib_int_disable(INT_RF_CPE0);
273  ti_lib_int_disable(INT_RF_CPE1);
274 
275  if(rf_core_is_accessible()) {
276  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
277  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = 0x0;
278 
279  /* need to send FS_POWERDOWN or analog components will use power */
280  fs_powerdown();
281  }
282 
283  /* Shut down the RFCORE clock domain in the MCU VD */
284  ti_lib_prcm_domain_disable(PRCM_DOMAIN_RFCORE);
285  ti_lib_prcm_load_set();
286  while(!ti_lib_prcm_load_get());
287 
288  /* Turn off RFCORE PD */
289  ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE);
290  while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_RFCORE)
291  != PRCM_DOMAIN_POWER_OFF);
292 
293  ti_lib_int_pend_clear(INT_RF_CPE0);
294  ti_lib_int_pend_clear(INT_RF_CPE1);
295  ti_lib_int_enable(INT_RF_CPE0);
296  ti_lib_int_enable(INT_RF_CPE1);
297  if(!interrupts_disabled) {
298  ti_lib_int_master_enable();
299  }
300 }
301 /*---------------------------------------------------------------------------*/
302 uint8_t
304 {
305  uint8_t rv = RF_CORE_CMD_ERROR;
306 
307  if(ti_lib_chipinfo_chip_family_is_cc26xx()) {
308  if(ti_lib_chipinfo_supports_ble() == true &&
309  ti_lib_chipinfo_supports_ieee_802_15_4() == true) {
310  /* CC2650 */
311  HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE5;
312  rv = RF_CORE_CMD_OK;
313  } else if(ti_lib_chipinfo_supports_ble() == false &&
314  ti_lib_chipinfo_supports_ieee_802_15_4() == true) {
315  /* CC2630 */
316  HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE2;
317  rv = RF_CORE_CMD_OK;
318  }
319  } else if(ti_lib_chipinfo_chip_family_is_cc13xx()) {
320  if(ti_lib_chipinfo_supports_ble() == false &&
321  ti_lib_chipinfo_supports_ieee_802_15_4() == false) {
322  /* CC1310 */
323  HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = PRCM_RFCMODESEL_CURR_MODE3;
324  rv = RF_CORE_CMD_OK;
325  }
326  }
327 
328  return rv;
329 }
330 /*---------------------------------------------------------------------------*/
331 uint8_t
333 {
334  uint32_t cmd_status;
335 
336  /* Start radio timer (RAT) */
337  if(rf_core_send_cmd(CMDR_DIR_CMD(CMD_START_RAT), &cmd_status)
338  != RF_CORE_CMD_OK) {
339  PRINTF("rf_core_apply_patches: START_RAT fail, CMDSTA=0x%08lx\n",
340  cmd_status);
341  return RF_CORE_CMD_ERROR;
342  }
343 
344  return RF_CORE_CMD_OK;
345 }
346 /*---------------------------------------------------------------------------*/
347 uint8_t
349 {
350  if(rf_core_power_up() != RF_CORE_CMD_OK) {
351  PRINTF("rf_core_boot: rf_core_power_up() failed\n");
352 
354 
355  return RF_CORE_CMD_ERROR;
356  }
357 
358  if(rf_core_start_rat() != RF_CORE_CMD_OK) {
359  PRINTF("rf_core_boot: rf_core_start_rat() failed\n");
360 
362 
363  return RF_CORE_CMD_ERROR;
364  }
365 
366  return RF_CORE_CMD_OK;
367 }
368 /*---------------------------------------------------------------------------*/
369 void
371 {
372  bool interrupts_disabled;
373 
374  /* We are already turned on by the caller, so this should not happen */
375  if(!rf_core_is_accessible()) {
376  PRINTF("setup_interrupts: No access\n");
377  return;
378  }
379 
380  /* Disable interrupts */
381  interrupts_disabled = ti_lib_int_master_disable();
382 
383  /* Set all interrupt channels to CPE0 channel, error to CPE1 */
384  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEISL) = ERROR_IRQ;
385 
386  /* Acknowledge configured interrupts */
387  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS;
388 
389  /* Clear interrupt flags, active low clear(?) */
390  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
391 
392  ti_lib_int_pend_clear(INT_RF_CPE0);
393  ti_lib_int_pend_clear(INT_RF_CPE1);
394  ti_lib_int_enable(INT_RF_CPE0);
395  ti_lib_int_enable(INT_RF_CPE1);
396 
397  if(!interrupts_disabled) {
398  ti_lib_int_master_enable();
399  }
400 }
401 /*---------------------------------------------------------------------------*/
402 void
404 {
405  uint32_t irq = fg ? IRQ_LAST_FG_COMMAND_DONE : IRQ_LAST_COMMAND_DONE;
406 
407  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = ENABLED_IRQS;
408  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS | irq;
409 }
410 /*---------------------------------------------------------------------------*/
411 void
413 {
414  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIEN) = ENABLED_IRQS;
415 }
416 /*---------------------------------------------------------------------------*/
417 rfc_radioOp_t *
419 {
420  return last_radio_op;
421 }
422 /*---------------------------------------------------------------------------*/
423 void
424 rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command)
425 {
426  memset(op, 0, len);
427 
428  op->commandNo = command;
429  op->condition.rule = COND_NEVER;
430 }
431 /*---------------------------------------------------------------------------*/
432 void
434 {
435  primary_mode = mode;
436 }
437 /*---------------------------------------------------------------------------*/
438 void
440 {
441  if(primary_mode) {
442  if(primary_mode->abort) {
443  primary_mode->abort();
444  }
445  }
446 }
447 /*---------------------------------------------------------------------------*/
448 uint8_t
450 {
451  if(primary_mode) {
452  if(primary_mode->restore) {
453  return primary_mode->restore();
454  }
455  }
456 
457  return RF_CORE_CMD_ERROR;
458 }
459 /*---------------------------------------------------------------------------*/
460 PROCESS_THREAD(rf_core_process, ev, data)
461 {
462  int len;
463 
464  PROCESS_BEGIN();
465 
466  while(1) {
467  PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
468  do {
470  packetbuf_clear();
471  len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
472 
473  if(len > 0) {
475 
476  NETSTACK_RDC.input();
477  }
478  } while(len > 0);
479  }
480  PROCESS_END();
481 }
482 /*---------------------------------------------------------------------------*/
483 static void
484 rx_nok_isr(void)
485 {
486  RIMESTATS_ADD(badcrc);
487  PRINTF("RF: Bad CRC\n");
488 }
489 /*---------------------------------------------------------------------------*/
490 void
491 cc26xx_rf_cpe1_isr(void)
492 {
493  ENERGEST_ON(ENERGEST_TYPE_IRQ);
494 
495  PRINTF("RF Error\n");
496 
497  if(!rf_core_is_accessible()) {
498  if(rf_core_power_up() != RF_CORE_CMD_OK) {
499  return;
500  }
501  }
502 
503  /* Clear INTERNAL_ERROR interrupt flag */
504  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0x7FFFFFFF;
505 
506  ENERGEST_OFF(ENERGEST_TYPE_IRQ);
507 }
508 /*---------------------------------------------------------------------------*/
509 void
510 cc26xx_rf_cpe0_isr(void)
511 {
512  ENERGEST_ON(ENERGEST_TYPE_IRQ);
513 
514  if(!rf_core_is_accessible()) {
515  printf("RF ISR called but RF not ready... PANIC!!\n");
516  if(rf_core_power_up() != RF_CORE_CMD_OK) {
517  PRINTF("rf_core_power_up() failed\n");
518  return;
519  }
520  }
521 
522  ti_lib_int_master_disable();
523 
524  if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_FRAME_IRQ) {
525  /* Clear the RX_ENTRY_DONE interrupt flag */
526  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFF7FFFFF;
527  process_poll(&rf_core_process);
528  }
529 
530  if(RF_CORE_DEBUG_CRC) {
531  if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) & RX_NOK_IRQ) {
532  /* Clear the RX_NOK interrupt flag */
533  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFFFDFFFF;
534  rx_nok_isr();
535  }
536  }
537 
538  if(HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) &
539  (IRQ_LAST_FG_COMMAND_DONE | IRQ_LAST_COMMAND_DONE)) {
540  /* Clear the two TX-related interrupt flags */
541  HWREG(RFC_DBELL_NONBUF_BASE + RFC_DBELL_O_RFCPEIFG) = 0xFFFFFFF5;
542  }
543 
544  ti_lib_int_master_enable();
545 
546  ENERGEST_OFF(ENERGEST_TYPE_IRQ);
547 }
548 /*---------------------------------------------------------------------------*/
549 /** @} */
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
Definition: packetbuf.c:158
void process_poll(struct process *p)
Request a process to be polled.
Definition: process.c:371
void rf_core_power_down()
Disable RFCORE clock domain in the MCU VD and turn off the RFCORE PD.
Definition: rf-core.c:269
Header file with macros which rename TI CC26xxware functions.
uint8_t(* restore)(void)
A pointer to a function that will restore the previous radio op.
Definition: rf-core.h:103
void packetbuf_clear(void)
Clear and reset the packetbuf.
Definition: packetbuf.c:76
Default definitions of C compiler quirk work-arounds.
#define PROCESS_END()
Define the end of a process.
Definition: process.h:131
#define PROCESS(name, strname)
Declare a process.
Definition: process.h:307
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
Definition: process.h:273
#define PACKETBUF_SIZE
The size of the packetbuf, in bytes.
Definition: packetbuf.h:66
void rf_core_primary_mode_abort()
Abort the currently running primary radio op.
Definition: rf-core.c:439
Header file for the energy estimation mechanism
Header file for the Rime buffer (packetbuf) management
void rf_core_setup_interrupts()
Setup RF core interrupts.
Definition: rf-core.c:370
Header file for the CC13xx/CC26xx RF core driver.
uint8_t rf_core_is_accessible()
Check whether the RF core is accessible.
Definition: rf-core.c:110
#define NULL
The null pointer.
uint8_t rf_core_set_modesel()
Initialise RF APIs in the RF core.
Definition: rf-core.c:303
void rf_core_cmd_done_en(bool fg)
Enable interrupt on command done.
Definition: rf-core.c:403
uint8_t rf_core_boot()
Boot the RF Core.
Definition: rf-core.c:348
void watchdog_periodic(void)
Writes the WDT clear sequence.
Definition: watchdog.c:64
void(* abort)(void)
A pointer to a function used to abort the current radio op.
Definition: rf-core.h:97
int rf_core_power_up()
Turn on power to the RFC and boot it.
Definition: rf-core.c:228
void rf_core_primary_mode_register(const rf_core_primary_mode_t *mode)
Register a primary mode for radio operation.
Definition: rf-core.c:433
uint_fast8_t rf_core_send_cmd(uint32_t cmd, uint32_t *status)
Sends a command to the RF core.
Definition: rf-core.c:119
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
Definition: packetbuf.c:151
Header file for the Contiki process interface.
#define PROCESS_YIELD_UNTIL(c)
Yield the currently running process until a condition occurs.
Definition: process.h:178
rfc_radioOp_t * rf_core_get_last_radio_op()
Returns a pointer to the most recent proto-dependent Radio Op.
Definition: rf-core.c:418
Header file for Rime statistics
uint8_t rf_core_primary_mode_restore()
Abort the currently running primary radio op.
Definition: rf-core.c:449
uint8_t rf_core_start_rat()
Start the CM0 RAT.
Definition: rf-core.c:332
void rf_core_init_radio_op(rfc_radioOp_t *op, uint16_t len, uint16_t command)
Prepare a buffer to host a Radio Op.
Definition: rf-core.c:424
void rf_core_cmd_done_dis()
Disable the LAST_CMD_DONE and LAST_FG_CMD_DONE interrupts.
Definition: rf-core.c:412
Include file for the Contiki low-layer network stack (NETSTACK)
A data strcuture representing the radio's primary mode of operation.
Definition: rf-core.h:93
uint_fast8_t rf_core_wait_cmd_done(void *cmd)
Block and wait for a Radio op to complete.
Definition: rf-core.c:185
#define PROCESS_BEGIN()
Define the beginning of a process.
Definition: process.h:120