Contiki-NG
sched.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018, 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  * \addtogroup cc13xx-cc26xx-rf-sched
32  * @{
33  *
34  * \file
35  * Implementation of the CC13xx/CC26xx RF scheduler.
36  * \author
37  * Edvard Pettersen <e.pettersen@ti.com>
38  */
39 /*---------------------------------------------------------------------------*/
40 #include "contiki.h"
41 #include "dev/watchdog.h"
42 #include "sys/cc.h"
43 #include "sys/etimer.h"
44 #include "sys/process.h"
45 #include "sys/energest.h"
46 #include "net/netstack.h"
47 #include "net/packetbuf.h"
48 #include "net/mac/mac.h"
49 #include "lib/random.h"
50 /*---------------------------------------------------------------------------*/
51 #include <ti/devices/DeviceFamily.h>
52 #include DeviceFamily_constructPath(driverlib/rf_common_cmd.h)
53 #include DeviceFamily_constructPath(driverlib/rf_mailbox.h)
54 
55 #include <ti/drivers/rf/RF.h>
56 /*---------------------------------------------------------------------------*/
57 #include "rf/rf.h"
58 #include "rf/sched.h"
59 #include "rf/data-queue.h"
60 #include "rf/settings.h"
61 /*---------------------------------------------------------------------------*/
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include <string.h>
65 /*---------------------------------------------------------------------------*/
66 /* Log configuration */
67 #include "sys/log.h"
68 #define LOG_MODULE "Radio"
69 #define LOG_LEVEL LOG_LEVEL_NONE
70 /*---------------------------------------------------------------------------*/
71 /* Configuration parameters */
72 /*---------------------------------------------------------------------------*/
73 #define CMD_FS_RETRIES 3
74 
75 #define RF_EVENTS_CMD_DONE (RF_EventCmdDone | RF_EventLastCmdDone | \
76  RF_EventFGCmdDone | RF_EventLastFGCmdDone)
77 
78 #define CMD_STATUS(cmd) (CC_ACCESS_NOW(RF_Op, cmd).status)
79 
80 #define CMD_HANDLE_OK(handle) (((handle) != RF_ALLOC_ERROR) && \
81  ((handle) != RF_SCHEDULE_CMD_ERROR))
82 
83 #define EVENTS_CMD_DONE(events) (((events) & RF_EVENTS_CMD_DONE) != 0)
84 /*---------------------------------------------------------------------------*/
85 /* Synth re-calibration every 3 minutes */
86 #define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3)
87 /* Set re-calibration interval with a jitter of 10 seconds */
88 #define SYNTH_RECAL_JITTER (CLOCK_SECOND * 10)
89 
90 static struct etimer synth_recal_timer;
91 /*---------------------------------------------------------------------------*/
92 static RF_Object rf_netstack;
93 
94 #if RF_CONF_BLE_BEACON_ENABLE
95 static RF_Object rf_ble;
96 #endif
97 
98 static RF_CmdHandle cmd_rx_handle;
99 
100 static bool rf_is_on;
101 static volatile bool rx_buf_full;
102 /*---------------------------------------------------------------------------*/
103 static void
104 cmd_rx_cb(RF_Handle client, RF_CmdHandle command, RF_EventMask events)
105 {
106  /* Unused arguments */
107  (void)client;
108  (void)command;
109 
110  if(events & RF_EventRxEntryDone) {
111  process_poll(&rf_sched_process);
112  }
113 
114  if(events & RF_EventRxBufFull) {
115  rx_buf_full = true;
116  process_poll(&rf_sched_process);
117  }
118 }
119 /*---------------------------------------------------------------------------*/
120 static inline clock_time_t
121 synth_recal_interval(void)
122 {
123  /*
124  * Add jitter centered around SYNTH_RECAL_INTERVAL, giving a plus/minus
125  * jitter seconds halved.
126  */
127  return SYNTH_RECAL_INTERVAL + (random_rand() % SYNTH_RECAL_JITTER) - (SYNTH_RECAL_JITTER / 2);
128 }
129 /*---------------------------------------------------------------------------*/
130 static inline bool
131 cmd_rx_is_active(void)
132 {
133  /*
134  * Active in this case means RX command is either running to be running,
135  * that is ACTIVE for running or PENDING for to be running.
136  */
137  const uint16_t status = CMD_STATUS(netstack_cmd_rx);
138  return (status == ACTIVE) ||
139  (status == PENDING);
140 }
141 /*---------------------------------------------------------------------------*/
142 static uint_fast8_t
143 cmd_rx_disable(void)
144 {
145  const bool is_active = cmd_rx_is_active();
146 
147  if(is_active) {
148  CMD_STATUS(netstack_cmd_rx) = DONE_STOPPED;
149  RF_cancelCmd(&rf_netstack, cmd_rx_handle, RF_ABORT_GRACEFULLY);
150  cmd_rx_handle = 0;
151  }
152 
153  return (uint_fast8_t)is_active;
154 }
155 /*---------------------------------------------------------------------------*/
156 static rf_result_t
157 cmd_rx_restore(uint_fast8_t rx_key)
158 {
159  const bool was_active = (rx_key != 0) ? true : false;
160 
161  if(!was_active) {
162  return RF_RESULT_OK;
163  }
164 
165  RF_ScheduleCmdParams sched_params;
166  RF_ScheduleCmdParams_init(&sched_params);
167 
168  sched_params.priority = RF_PriorityNormal;
169  sched_params.endTime = 0;
170  sched_params.allowDelay = RF_AllowDelayAny;
171 
172  CMD_STATUS(netstack_cmd_rx) = PENDING;
173 
174  cmd_rx_handle = RF_scheduleCmd(
175  &rf_netstack,
176  (RF_Op *)&netstack_cmd_rx,
177  &sched_params,
178  cmd_rx_cb,
179  RF_EventRxEntryDone | RF_EventRxBufFull);
180 
181  if(!CMD_HANDLE_OK(cmd_rx_handle)) {
182  LOG_ERR("Unable to restore RX command, handle=%d status=0x%04x",
183  cmd_rx_handle, CMD_STATUS(netstack_cmd_rx));
184  return RF_RESULT_ERROR;
185  }
186 
187  return RF_RESULT_OK;
188 }
189 /*---------------------------------------------------------------------------*/
190 rf_result_t
191 rf_yield(void)
192 {
193  /* Force abort of any ongoing RF operation */
194  RF_flushCmd(&rf_netstack, RF_CMDHANDLE_FLUSH_ALL, RF_ABORT_GRACEFULLY);
195 #if RF_CONF_BLE_BEACON_ENABLE
196  RF_flushCmd(&rf_ble, RF_CMDHANDLE_FLUSH_ALL, RF_ABORT_GRACEFULLY);
197 #endif
198 
199  /* Trigger a manual power-down */
200  RF_yield(&rf_netstack);
201 #if RF_CONF_BLE_BEACON_ENABLE
202  RF_yield(&rf_ble);
203 #endif
204 
205  ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
206 
207  etimer_stop(&synth_recal_timer);
208  rf_is_on = false;
209 
210  return RF_RESULT_OK;
211 }
212 /*---------------------------------------------------------------------------*/
213 rf_result_t
214 rf_set_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t dbm)
215 {
216  const RF_Stat stat = RF_setTxPower(handle, RF_TxPowerTable_findValue(table, dbm));
217 
218  return (stat == RF_StatSuccess)
219  ? RF_RESULT_OK
220  : RF_RESULT_ERROR;
221 }
222 /*---------------------------------------------------------------------------*/
223 rf_result_t
224 rf_get_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t *dbm)
225 {
226  *dbm = RF_TxPowerTable_findPowerLevel(table, RF_getTxPower(handle));
227 
228  return (*dbm != RF_TxPowerTable_INVALID_DBM)
229  ? RF_RESULT_OK
230  : RF_RESULT_ERROR;
231 }
232 /*---------------------------------------------------------------------------*/
233 RF_Handle
234 netstack_open(RF_Params *params)
235 {
236  return RF_open(&rf_netstack, &netstack_mode, (RF_RadioSetup *)&netstack_cmd_radio_setup, params);
237 }
238 /*---------------------------------------------------------------------------*/
239 rf_result_t
240 netstack_sched_fs(void)
241 {
242  const uint_fast8_t rx_key = cmd_rx_disable();
243 
244  /*
245  * For IEEE-mode, restarting CMD_IEEE_RX re-calibrates the synth by using the
246  * channel field in the CMD_IEEE_RX command. It is assumed this field is
247  * already configured before this function is called. However, if
248  * CMD_IEEE_RX wasn't active, manually calibrate the synth with CMD_FS.
249  *
250  * For Prop-mode, the synth is always manually calibrated with CMD_FS.
251  */
252 #if (RF_MODE == RF_CORE_MODE_2_4_GHZ)
253  if(rx_key) {
254  cmd_rx_restore(rx_key);
255  return RF_RESULT_OK;
256  }
257 #endif /* RF_MODE == RF_CORE_MODE_2_4_GHZ */
258 
259  RF_EventMask events;
260  bool synth_error = false;
261  uint8_t num_tries = 0;
262 
263  do {
264  CMD_STATUS(netstack_cmd_fs) = PENDING;
265 
266  events = RF_runCmd(
267  &rf_netstack,
268  (RF_Op *)&netstack_cmd_fs,
269  RF_PriorityNormal,
270  NULL,
271  0);
272 
273  synth_error = (EVENTS_CMD_DONE(events)) && (CMD_STATUS(netstack_cmd_fs) == ERROR_SYNTH_PROG);
274 
275  } while(synth_error && (num_tries++ < CMD_FS_RETRIES));
276 
277  cmd_rx_restore(rx_key);
278 
279  return (CMD_STATUS(netstack_cmd_fs) == DONE_OK)
280  ? RF_RESULT_OK
281  : RF_RESULT_ERROR;
282 }
283 /*---------------------------------------------------------------------------*/
284 rf_result_t
285 netstack_sched_ieee_tx(bool ack_request)
286 {
287  rf_result_t res;
288 
289  RF_ScheduleCmdParams sched_params;
290  RF_ScheduleCmdParams_init(&sched_params);
291 
292  sched_params.priority = RF_PriorityNormal;
293  sched_params.endTime = 0;
294  sched_params.allowDelay = RF_AllowDelayAny;
295 
296  const bool rx_is_active = cmd_rx_is_active();
297  const bool rx_needed = (ack_request && !rx_is_active);
298 
299  /*
300  * If we expect ACK after transmission, RX must be running to be able to
301  * run the RX_ACK command. Therefore, turn on RX before starting the
302  * chained TX command.
303  */
304  if(rx_needed) {
305  res = netstack_sched_rx(false);
306  if(res != RF_RESULT_OK) {
307  return res;
308  }
309  }
310 
311  CMD_STATUS(netstack_cmd_tx) = PENDING;
312 
313  RF_CmdHandle tx_handle = RF_scheduleCmd(
314  &rf_netstack,
315  (RF_Op *)&netstack_cmd_tx,
316  &sched_params,
317  NULL,
318  0);
319 
320  if(!CMD_HANDLE_OK(tx_handle)) {
321  LOG_ERR("Unable to schedule TX command, handle=%d status=0x%04x\n",
322  tx_handle, CMD_STATUS(netstack_cmd_tx));
323  return RF_RESULT_ERROR;
324  }
325 
326  if(rx_is_active) {
327  ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT);
328  } else {
329  ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
330  }
331 
332  /* Wait until TX operation finishes */
333  RF_EventMask tx_events = RF_pendCmd(&rf_netstack, tx_handle, 0);
334 
335  /* Stop RX if it was turned on only for ACK */
336  if(rx_needed) {
337  netstack_stop_rx();
338  }
339 
340  if(rx_is_active) {
341  ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN);
342  } else {
343  ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
344  }
345 
346  if(!EVENTS_CMD_DONE(tx_events)) {
347  LOG_ERR("Pending on TX comand generated error, events=0x%08llx status=0x%04x\n",
348  tx_events, CMD_STATUS(netstack_cmd_tx));
349  return RF_RESULT_ERROR;
350  }
351 
352  return RF_RESULT_OK;
353 }
354 /*---------------------------------------------------------------------------*/
355 rf_result_t
356 netstack_sched_prop_tx(void)
357 {
358  RF_ScheduleCmdParams sched_params;
359  RF_ScheduleCmdParams_init(&sched_params);
360 
361  sched_params.priority = RF_PriorityNormal;
362  sched_params.endTime = 0;
363  sched_params.allowDelay = RF_AllowDelayAny;
364 
365  CMD_STATUS(netstack_cmd_tx) = PENDING;
366 
367  RF_CmdHandle tx_handle = RF_scheduleCmd(
368  &rf_netstack,
369  (RF_Op *)&netstack_cmd_tx,
370  &sched_params,
371  NULL,
372  0);
373 
374  if(!CMD_HANDLE_OK(tx_handle)) {
375  LOG_ERR("Unable to schedule TX command, handle=%d status=0x%04x\n",
376  tx_handle, CMD_STATUS(netstack_cmd_tx));
377  return RF_RESULT_ERROR;
378  }
379 
380  /*
381  * Prop TX requires any on-going RX operation to be stopped to be
382  * able to transmit. Therefore, disable RX if running.
383  */
384  const bool rx_key = cmd_rx_disable();
385 
386  if(rx_key) {
387  ENERGEST_SWITCH(ENERGEST_TYPE_LISTEN, ENERGEST_TYPE_TRANSMIT);
388  } else {
389  ENERGEST_ON(ENERGEST_TYPE_TRANSMIT);
390  }
391 
392  /* Wait until TX operation finishes */
393  RF_EventMask tx_events = RF_pendCmd(&rf_netstack, tx_handle, 0);
394 
395  cmd_rx_restore(rx_key);
396 
397  if(rx_key) {
398  ENERGEST_SWITCH(ENERGEST_TYPE_TRANSMIT, ENERGEST_TYPE_LISTEN);
399  } else {
400  ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
401  }
402 
403  if(!EVENTS_CMD_DONE(tx_events)) {
404  LOG_ERR("Pending on scheduled TX command generated error, events=0x%08llx status=0x%04x\n",
405  tx_events, CMD_STATUS(netstack_cmd_tx));
406  return RF_RESULT_ERROR;
407  }
408 
409  return RF_RESULT_OK;
410 }
411 /*---------------------------------------------------------------------------*/
412 rf_result_t
413 netstack_sched_rx(bool start)
414 {
415  if(cmd_rx_is_active()) {
416  LOG_WARN("Already in RX when scheduling RX\n");
417  return RF_RESULT_OK;
418  }
419 
420  RF_ScheduleCmdParams sched_params;
421  RF_ScheduleCmdParams_init(&sched_params);
422 
423  sched_params.priority = RF_PriorityNormal;
424  sched_params.endTime = 0;
425  sched_params.allowDelay = RF_AllowDelayAny;
426 
427  CMD_STATUS(netstack_cmd_rx) = PENDING;
428 
429  cmd_rx_handle = RF_scheduleCmd(
430  &rf_netstack,
431  (RF_Op *)&netstack_cmd_rx,
432  &sched_params,
433  cmd_rx_cb,
434  RF_EventRxEntryDone | RF_EventRxBufFull);
435 
436  if(!CMD_HANDLE_OK(cmd_rx_handle)) {
437  LOG_ERR("Unable to schedule RX command, handle=%d status=0x%04x\n",
438  cmd_rx_handle, CMD_STATUS(netstack_cmd_rx));
439  return RF_RESULT_ERROR;
440  }
441 
442  ENERGEST_ON(ENERGEST_TYPE_LISTEN);
443 
444  if(start) {
445  rf_is_on = true;
446  process_poll(&rf_sched_process);
447  }
448 
449  return RF_RESULT_OK;
450 }
451 /*---------------------------------------------------------------------------*/
452 rf_result_t
453 netstack_stop_rx(void)
454 {
455  if(!cmd_rx_is_active()) {
456  LOG_WARN("RX not active when stopping RX\n");
457  return RF_RESULT_OK;
458  }
459 
460  CMD_STATUS(netstack_cmd_rx) = DONE_STOPPED;
461  const RF_Stat stat = RF_cancelCmd(&rf_netstack, cmd_rx_handle, RF_ABORT_GRACEFULLY);
462  cmd_rx_handle = 0;
463 
464  ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
465 
466  return (stat == RF_StatSuccess)
467  ? RF_RESULT_OK
468  : RF_RESULT_ERROR;
469 }
470 /*---------------------------------------------------------------------------*/
471 RF_Handle
472 ble_open(RF_Params *params)
473 {
474 #if RF_CONF_BLE_BEACON_ENABLE
475  return RF_open(&rf_ble, &ble_mode, (RF_RadioSetup *)&ble_cmd_radio_setup, params);
476 
477 #else
478  return (RF_Handle)NULL;
479 #endif
480 }
481 /*---------------------------------------------------------------------------*/
482 rf_result_t
483 ble_sched_beacon(RF_Callback cb, RF_EventMask bm_event)
484 {
485 #if RF_CONF_BLE_BEACON_ENABLE
486  RF_ScheduleCmdParams sched_params;
487  RF_ScheduleCmdParams_init(&sched_params);
488 
489  sched_params.priority = RF_PriorityNormal;
490  sched_params.endTime = 0;
491  sched_params.allowDelay = RF_AllowDelayAny;
492 
493  CMD_STATUS(ble_cmd_beacon) = PENDING;
494 
495  RF_CmdHandle beacon_handle = RF_scheduleCmd(
496  &rf_ble,
497  (RF_Op *)&ble_cmd_beacon,
498  &sched_params,
499  cb,
500  bm_event);
501 
502  if(!CMD_HANDLE_OK(beacon_handle)) {
503  LOG_ERR("Unable to schedule BLE Beacon command, handle=%d status=0x%04x\n",
504  beacon_handle, CMD_STATUS(ble_cmd_beacon));
505  return RF_RESULT_ERROR;
506  }
507 
508  const uint_fast8_t rx_key = cmd_rx_disable();
509 
510  /* Wait until Beacon operation finishes */
511  RF_EventMask beacon_events = RF_pendCmd(&rf_ble, beacon_handle, 0);
512  if(!EVENTS_CMD_DONE(beacon_events)) {
513  LOG_ERR("Pending on scheduled BLE Beacon command generated error, events=0x%08llx status=0x%04x\n",
514  beacon_events, CMD_STATUS(ble_cmd_beacon));
515 
516  cmd_rx_restore(rx_key);
517  return RF_RESULT_ERROR;
518  }
519 
520  cmd_rx_restore(rx_key);
521  return RF_RESULT_OK;
522 
523 #else
524  return RF_RESULT_ERROR;
525 #endif
526 }
527 /*---------------------------------------------------------------------------*/
528 PROCESS(rf_sched_process, "RF Scheduler Process");
529 /*---------------------------------------------------------------------------*/
530 PROCESS_THREAD(rf_sched_process, ev, data)
531 {
532  int len;
533 
534  PROCESS_BEGIN();
535 
536  while(1) {
537  PROCESS_YIELD_UNTIL((ev == PROCESS_EVENT_POLL) ||
538  (ev == PROCESS_EVENT_TIMER));
539 
540  /* start the synth re-calibration timer once. */
541  if(rf_is_on) {
542  rf_is_on = false;
543  clock_time_t interval = synth_recal_interval();
544  LOG_INFO("Starting synth re-calibration timer, next timeout %lu\n", interval);
545  etimer_set(&synth_recal_timer, interval);
546  }
547 
548  if(ev == PROCESS_EVENT_POLL) {
549  do {
551 
552  packetbuf_clear();
553  len = NETSTACK_RADIO.read(packetbuf_dataptr(), PACKETBUF_SIZE);
554 
555  /*
556  * RX will stop if the RX buffers are full. In this case, restart
557  * RX after we've freed at least on packet.
558  */
559  if(rx_buf_full) {
560  LOG_ERR("RX buffer full, restart RX status=0x%04x\n", CMD_STATUS(netstack_cmd_rx));
561  rx_buf_full = false;
562 
563  /* Restart RX. */
564  netstack_stop_rx();
565  netstack_sched_rx(false);
566  }
567 
568  if(len > 0) {
570 
571  NETSTACK_MAC.input();
572  }
573  /* Only break when we receive -1 => No available data */
574  } while(len >= 0);
575  }
576 
577  /* Scheduling CMD_FS will re-calibrate the synth. */
578  if((ev == PROCESS_EVENT_TIMER) &&
579  etimer_expired(&synth_recal_timer)) {
580  clock_time_t interval = synth_recal_interval();
581  LOG_DBG("Re-calibrate synth, next interval %lu\n", interval);
582 
583  netstack_sched_fs();
584  etimer_set(&synth_recal_timer, interval);
585  }
586  }
587  PROCESS_END();
588 }
589 /*---------------------------------------------------------------------------*/
590 /** @} */
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
Definition: packetbuf.c:143
#define PROCESS(name, strname)
Declare a process.
Definition: process.h:307
void etimer_stop(struct etimer *et)
Stop a pending event timer.
Definition: etimer.c:243
static uint8_t rf_is_on(void)
Checks whether the RFC domain is accessible and the RFC is in IEEE RX.
Definition: ieee-mode.c:254
void packetbuf_clear(void)
Clear and reset the packetbuf.
Definition: packetbuf.c:75
static bool start(void)
Start measurement.
Header file for the energy estimation mechanism
#define PROCESS_YIELD_UNTIL(c)
Yield the currently running process until a condition occurs.
Definition: process.h:178
#define PROCESS_BEGIN()
Define the beginning of a process.
Definition: process.h:120
#define PROCESS_END()
Define the end of a process.
Definition: process.h:131
Header file of the CC13xx/CC26xx RF scheduler.
Event timer header file.
void(* input)(void)
Callback for getting notified of incoming packet.
Definition: mac.h:72
void process_poll(struct process *p)
Request a process to be polled.
Definition: process.c:371
#define PACKETBUF_SIZE
The size of the packetbuf, in bytes.
Definition: packetbuf.h:66
Header file for the Contiki process interface.
int etimer_expired(struct etimer *et)
Check if an event timer has expired.
Definition: etimer.c:213
Header file of the CC13xx/CC26xx RF data queue.
A timer.
Definition: etimer.h:75
Header file of RF settings for CC13xx/CC26xx.
Header file of common CC13xx/CC26xx RF functionality.
Header file for the Packet buffer (packetbuf) management
Include file for the Contiki low-layer network stack (NETSTACK)
void watchdog_periodic(void)
Writes the WDT clear sequence.
Definition: watchdog.c:85
Default definitions of C compiler quirk work-arounds.
PROCESS_THREAD(cc2538_rf_process, ev, data)
Implementation of the cc2538 RF driver process.
Definition: cc2538-rf.c:1035
unsigned short random_rand(void)
Generates a new random number using the cc2538 RNG.
Definition: random.c:58
Header file for the logging system
void etimer_set(struct etimer *et, clock_time_t interval)
Set an event timer.
Definition: etimer.c:177
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
Definition: packetbuf.c:136
MAC driver header file