Contiki-NG
lpm.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 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 cc26xx-lpm
33  * @{
34  *
35  * Implementation of CC13xx/CC26xx low-power operation functionality
36  *
37  * @{
38  *
39  * \file
40  * Driver for CC13xx/CC26xx low-power operation
41  */
42 /*---------------------------------------------------------------------------*/
43 #include "prcm.h"
44 #include "contiki.h"
45 #include "ti-lib.h"
46 #include "lpm.h"
47 #include "sys/energest.h"
48 #include "lib/list.h"
49 #include "dev/aux-ctrl.h"
50 #include "dev/leds.h"
51 #include "dev/watchdog.h"
52 #include "dev/soc-rtc.h"
53 #include "dev/oscillators.h"
54 
55 #include <stdint.h>
56 #include <string.h>
57 #include <stdbool.h>
58 /*---------------------------------------------------------------------------*/
59 LIST(modules_list);
60 /*---------------------------------------------------------------------------*/
61 /* PDs that may stay on in deep sleep */
62 #define LOCKABLE_DOMAINS ((uint32_t)(PRCM_DOMAIN_SERIAL | PRCM_DOMAIN_PERIPH))
63 /*---------------------------------------------------------------------------*/
64 /*
65  * Don't consider standby mode if the next AON RTC event is scheduled to fire
66  * in less than STANDBY_MIN_DURATION rtimer ticks
67  */
68 #define STANDBY_MIN_DURATION (RTIMER_SECOND / 100) /* 10.0 ms */
69 
70 /* Wake up this much time earlier before the next rtimer */
71 #define SLEEP_GUARD_TIME (RTIMER_SECOND / 1000) /* 1.0 ms */
72 
73 #define MAX_SLEEP_TIME RTIMER_SECOND
74 #define MIN_SAFE_SCHEDULE 8u
75 /*---------------------------------------------------------------------------*/
76 /* Prototype of a function in clock.c. Called every time we come out of DS */
77 void clock_update(void);
78 /*---------------------------------------------------------------------------*/
79 void
80 lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on)
81 {
82  lpm_registered_module_t *module;
83  int i;
84  uint32_t io_cfg = (IOC_STD_INPUT & ~IOC_IOPULL_M) | io_pull | wake_on;
85  aux_consumer_module_t aux = { .clocks = AUX_WUC_OSCCTRL_CLOCK };
86 
87  /* This procedure may not be interrupted */
88  ti_lib_int_master_disable();
89 
90  /* Disable the RTC */
91  ti_lib_aon_rtc_disable();
92  ti_lib_aon_rtc_event_clear(AON_RTC_CH0);
93  ti_lib_aon_rtc_event_clear(AON_RTC_CH1);
94  ti_lib_aon_rtc_event_clear(AON_RTC_CH2);
95 
96  /* Reset AON even fabric to default wakeup sources */
97  for(i = AON_EVENT_MCU_WU0; i <= AON_EVENT_MCU_WU3; i++) {
98  ti_lib_aon_event_mcu_wake_up_set(i, AON_EVENT_NONE);
99  }
100  for(i = AON_EVENT_AUX_WU0; i <= AON_EVENT_AUX_WU2; i++) {
101  ti_lib_aon_event_aux_wake_up_set(i, AON_EVENT_NONE);
102  }
103 
104  ti_lib_sys_ctrl_aon_sync();
105 
107 
108  /* Notify all modules that we're shutting down */
109  for(module = list_head(modules_list); module != NULL;
110  module = module->next) {
111  if(module->shutdown) {
112  module->shutdown(LPM_MODE_SHUTDOWN);
113  }
114  }
115 
116  /* Configure the wakeup trigger */
117  if(wakeup_pin != IOID_UNUSED) {
118  ti_lib_gpio_set_output_enable_dio(wakeup_pin, GPIO_OUTPUT_DISABLE);
119  ti_lib_ioc_port_configure_set(wakeup_pin, IOC_PORT_GPIO, io_cfg);
120  }
121 
122  /* Freeze I/O latches in AON */
123  ti_lib_aon_ioc_freeze_enable();
124 
125  /* Turn off RFCORE, SERIAL and PERIPH PDs. This will happen immediately */
126  ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE | PRCM_DOMAIN_SERIAL |
127  PRCM_DOMAIN_PERIPH);
128 
129  /* Register an aux-ctrl consumer to avoid powercycling AUX twice in a row */
133 
134  /* Configure clock sources for MCU: No clock */
135  ti_lib_aon_wuc_mcu_power_down_config(AONWUC_NO_CLOCK);
136 
137  /* Disable SRAM retention */
138  ti_lib_aon_wuc_mcu_sram_config(0);
139 
140  /*
141  * Request CPU, SYSBYS and VIMS PD off.
142  * This will only happen when the CM3 enters deep sleep
143  */
144  ti_lib_prcm_power_domain_off(PRCM_DOMAIN_CPU | PRCM_DOMAIN_VIMS |
145  PRCM_DOMAIN_SYSBUS);
146 
147  /* Request JTAG domain power off */
148  ti_lib_aon_wuc_jtag_power_off();
149 
150  /* Turn off AUX */
151  aux_ctrl_power_down(true);
152  ti_lib_aon_wuc_domain_power_down_enable();
153 
154  /*
155  * Request MCU VD power off.
156  * This will only happen when the CM3 enters deep sleep
157  */
158  ti_lib_prcm_mcu_power_off();
159 
160  /* Set MCU wakeup to immediate and disable virtual power off */
161  ti_lib_aon_wuc_mcu_wake_up_config(MCU_IMM_WAKE_UP);
162  ti_lib_aon_wuc_mcu_power_off_config(MCU_VIRT_PWOFF_DISABLE);
163 
164  /* Latch the IOs in the padring and enable I/O pad sleep mode */
165  ti_lib_aon_ioc_freeze_enable();
166  HWREG(AON_SYSCTL_BASE + AON_SYSCTL_O_SLEEPCTL) = 0;
167  ti_lib_sys_ctrl_aon_sync();
168 
169  /* Turn off VIMS cache, CRAM and TRAM - possibly not required */
170  ti_lib_prcm_cache_retention_disable();
171  ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF);
172 
173  /* Enable shutdown and sync AON */
174  ti_lib_aon_wuc_shut_down_enable();
175  ti_lib_sys_ctrl_aon_sync();
176 
177  /* Deep Sleep */
178  ti_lib_prcm_deep_sleep();
179 }
180 /*---------------------------------------------------------------------------*/
181 /*
182  * Notify all modules that we're back on and rely on them to restore clocks
183  * and power domains as required.
184  */
185 static void
186 wake_up(void)
187 {
188  lpm_registered_module_t *module;
189 
190  ENERGEST_SWITCH(ENERGEST_TYPE_DEEP_LPM, ENERGEST_TYPE_CPU);
191 
192  /* Sync so that we get the latest values before adjusting recharge settings */
193  ti_lib_sys_ctrl_aon_sync();
194 
195  /* Adjust recharge settings */
196  ti_lib_sys_ctrl_adjust_recharge_after_power_down();
197 
198  /*
199  * Release the request to the uLDO
200  * This is likely not required, since the switch to GLDO/DCDC is automatic
201  * when coming back from deep sleep
202  */
203  ti_lib_prcm_mcu_uldo_configure(false);
204 
205  /* Turn on cache again */
206  ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED);
207  ti_lib_prcm_cache_retention_enable();
208 
209  ti_lib_aon_ioc_freeze_disable();
210  ti_lib_sys_ctrl_aon_sync();
211 
212  /* Check operating conditions, optimally choose DCDC versus GLDO */
213  ti_lib_sys_ctrl_dcdc_voltage_conditional_control();
214 
215  /* Fire up AUX is the user has requested this */
217 
218  /*
219  * We may or may not have been woken up by an AON RTC tick. If not, we need
220  * to adjust our software tick counter
221  */
222  clock_update();
223 
225 
226  /* Notify all registered modules that we've just woken up */
227  for(module = list_head(modules_list); module != NULL;
228  module = module->next) {
229  if(module->wakeup) {
230  module->wakeup();
231  }
232  }
233 
234 #if CC2650_FAST_RADIO_STARTUP
235  /*
236  * Trigger a switch to the XOSC, so that we can subsequently use the RF FS
237  */
239 #endif
240 }
241 /*---------------------------------------------------------------------------*/
242 static uint8_t
243 check_next_rtimer(rtimer_clock_t now, rtimer_clock_t *next_rtimer, bool *next_rtimer_set)
244 {
245  uint8_t max_pm = LPM_MODE_MAX_SUPPORTED;
246 
247  if(ti_lib_aon_rtc_channel_active(AON_RTC_CH0)) {
248  *next_rtimer_set = true;
249 
250  /* find out the timer of the next rtimer interrupt */
251  *next_rtimer = ti_lib_aon_rtc_compare_value_get(AON_RTC_CH0);
252 
253  if(RTIMER_CLOCK_LT(*next_rtimer, now + 2)) {
254  max_pm = MIN(max_pm, LPM_MODE_AWAKE);
255  } else if(RTIMER_CLOCK_LT(*next_rtimer, now + STANDBY_MIN_DURATION)) {
256  max_pm = MIN(max_pm, LPM_MODE_SLEEP);
257  }
258  } else {
259  *next_rtimer_set = false;
260  }
261 
262  return max_pm;
263 }
264 /*---------------------------------------------------------------------------*/
265 static uint8_t
266 check_next_etimer(rtimer_clock_t now, rtimer_clock_t *next_etimer, bool *next_etimer_set)
267 {
268  uint8_t max_pm = LPM_MODE_MAX_SUPPORTED;
269 
270  *next_etimer_set = false;
271 
272  /* Find out the time of the next etimer */
273  if(etimer_pending()) {
274  int32_t until_next_etimer = (int32_t)etimer_next_expiration_time() - (int32_t)clock_time();
275  if(until_next_etimer < 1) {
276  max_pm = MIN(max_pm, LPM_MODE_AWAKE);
277  } else {
278  *next_etimer_set = true;
279  *next_etimer = soc_rtc_last_isr_time() + (until_next_etimer * (RTIMER_SECOND / CLOCK_SECOND));
280  if(RTIMER_CLOCK_LT(*next_etimer, now + STANDBY_MIN_DURATION)) {
281  max_pm = MIN(max_pm, LPM_MODE_SLEEP);
282  }
283  }
284  }
285 
286  return max_pm;
287 }
288 /*---------------------------------------------------------------------------*/
289 static uint8_t
290 setup_sleep_mode(void)
291 {
292  lpm_registered_module_t *module;
293  uint8_t max_pm = LPM_MODE_MAX_SUPPORTED;
294  uint8_t pm;
295 
296  rtimer_clock_t now;
297  rtimer_clock_t next_rtimer = 0;
298  rtimer_clock_t next_etimer = 0;
299  bool next_rtimer_set = false;
300  bool next_etimer_set = false;
301 
302  /* Check if any events fired before we turned interrupts off. If so, abort */
303  if(LPM_MODE_MAX_SUPPORTED == LPM_MODE_AWAKE || process_nevents()) {
304  return LPM_MODE_AWAKE;
305  }
306 
307  /* Collect max allowed PM permission from interested modules */
308  for(module = list_head(modules_list); module != NULL;
309  module = module->next) {
310  if(module->request_max_pm) {
311  uint8_t module_pm = module->request_max_pm();
312  if(module_pm < max_pm) {
313  max_pm = module_pm;
314  }
315  }
316  }
317 
318  now = RTIMER_NOW();
319 
320  pm = check_next_rtimer(now, &next_rtimer, &next_rtimer_set);
321  if(pm < max_pm) {
322  max_pm = pm;
323  }
324  pm = check_next_etimer(now, &next_etimer, &next_etimer_set);
325  if(pm < max_pm) {
326  max_pm = pm;
327  }
328 
329  if(max_pm == LPM_MODE_SLEEP) {
330  if(next_etimer_set) {
331  /* Schedule the next system wakeup due to etimer */
332  if(RTIMER_CLOCK_LT(next_etimer, now + MIN_SAFE_SCHEDULE)) {
333  /* Too soon in future, use this minimal interval instead */
334  next_etimer = now + MIN_SAFE_SCHEDULE;
335  } else if(RTIMER_CLOCK_LT(now + MAX_SLEEP_TIME, next_etimer)) {
336  /* Too far in future, use MAX_SLEEP_TIME instead */
337  next_etimer = now + MAX_SLEEP_TIME;
338  }
339  soc_rtc_schedule_one_shot(AON_RTC_CH1, next_etimer);
340  } else {
341  /* No etimers set. Since by default the CH1 RTC fires once every clock tick,
342  * need to explicitly schedule a wakeup in the future to save energy.
343  * But do not stay in this mode for too long, otherwise watchdog will be trigerred. */
344  soc_rtc_schedule_one_shot(AON_RTC_CH1, now + MAX_SLEEP_TIME);
345  }
346 
347  } else if(max_pm == LPM_MODE_DEEP_SLEEP) {
348  /* Watchdog is not enabled, so deep sleep can continue an arbitrary long time.
349  * On the other hand, if `CC2650_FAST_RADIO_STARTUP` is defined,
350  * early wakeup before the next rtimer should be scheduled. */
351 
352 #if CC2650_FAST_RADIO_STARTUP
353  if(next_rtimer_set) {
354  if(!next_etimer_set || RTIMER_CLOCK_LT(next_rtimer - SLEEP_GUARD_TIME, next_etimer)) {
355  /* schedule a wakeup briefly before the next rtimer to wake up the system */
356  soc_rtc_schedule_one_shot(AON_RTC_CH2, next_rtimer - SLEEP_GUARD_TIME);
357  }
358  }
359 #endif
360 
361  if(next_etimer_set) {
362  /* Schedule the next system wakeup due to etimer.
363  * No need to compare the `next_etimer` to `now` here as this branch
364  * is only entered when there's sufficient time for deep sleeping. */
365  soc_rtc_schedule_one_shot(AON_RTC_CH1, next_etimer);
366  } else {
367  /* Use the farthest possible wakeup time */
368  soc_rtc_schedule_one_shot(AON_RTC_CH1, now - 1);
369  }
370  }
371 
372  return max_pm;
373 }
374 /*---------------------------------------------------------------------------*/
375 void
377 {
378  ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
379 
380  /* Just to be on the safe side, explicitly disable Deep Sleep */
381  HWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP);
382 
383  ti_lib_prcm_sleep();
384 
385  ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
386 }
387 /*---------------------------------------------------------------------------*/
388 static void
389 deep_sleep(void)
390 {
391  uint32_t domains = LOCKABLE_DOMAINS;
392  lpm_registered_module_t *module;
393 
394  /*
395  * Notify all registered modules that we are dropping to mode X. We do not
396  * need to do this for simple sleep.
397  *
398  * This is a chance for modules to delay us a little bit until an ongoing
399  * operation has finished (e.g. uart TX) or to configure themselves for
400  * deep sleep.
401  *
402  * At this stage, we also collect power domain locks, if any.
403  * The argument to PRCMPowerDomainOff() is a bitwise OR, so every time
404  * we encounter a lock we just clear the respective bits in the 'domains'
405  * variable as required by the lock. In the end the domains variable will
406  * just hold whatever has not been cleared
407  */
408  for(module = list_head(modules_list); module != NULL;
409  module = module->next) {
410  if(module->shutdown) {
411  module->shutdown(LPM_MODE_DEEP_SLEEP);
412  }
413 
414  /* Clear the bits specified in the lock */
415  domains &= ~module->domain_lock;
416  }
417 
418  /* Pat the dog: We don't want it to shout right after we wake up */
420 
421  /* Clear unacceptable bits, just in case a lock provided a bad value */
422  domains &= LOCKABLE_DOMAINS;
423 
424  /*
425  * Freeze the IOs on the boundary between MCU and AON. We only do this if
426  * PERIPH is not needed
427  */
428  if(domains & PRCM_DOMAIN_PERIPH) {
429  ti_lib_aon_ioc_freeze_enable();
430  }
431 
432  /*
433  * Among LOCKABLE_DOMAINS, turn off those that are not locked
434  *
435  * If domains is != 0, pass it as-is
436  */
437  if(domains) {
438  ti_lib_prcm_power_domain_off(domains);
439  }
440 
441  /*
442  * Before entering Deep Sleep, we must switch off the HF XOSC. The HF XOSC
443  * is predominantly controlled by the RF driver. In a build with radio
444  * cycling (e.g. ContikiMAC), the RF driver will request the XOSC before
445  * using the Freq. Synth, and switch back to the RC when it is about to
446  * turn back off.
447  *
448  * If the radio is on, we won't even reach here, and if it's off the HF
449  * clock source should already be the HF RC, unless CC2650_FAST_RADIO_STARTUP
450  * is defined.
451  *
452  * Nevertheless, request the switch to the HF RC explicitly here.
453  */
455 
456  /* Shut Down the AUX if the user application is not using it */
457  aux_ctrl_power_down(false);
458 
459  /* Configure clock sources for MCU: No clock */
460  ti_lib_aon_wuc_mcu_power_down_config(AONWUC_NO_CLOCK);
461 
462  /* Full RAM retention. */
463  ti_lib_aon_wuc_mcu_sram_config(MCU_RAM0_RETENTION | MCU_RAM1_RETENTION |
464  MCU_RAM2_RETENTION | MCU_RAM3_RETENTION);
465 
466  /*
467  * Always turn off RFCORE, CPU, SYSBUS and VIMS. RFCORE should be off
468  * already
469  */
470  ti_lib_prcm_power_domain_off(PRCM_DOMAIN_RFCORE | PRCM_DOMAIN_CPU |
471  PRCM_DOMAIN_VIMS | PRCM_DOMAIN_SYSBUS);
472 
473  /* Request JTAG domain power off */
474  ti_lib_aon_wuc_jtag_power_off();
475 
476  /* Allow MCU and AUX powerdown */
477  ti_lib_aon_wuc_domain_power_down_enable();
478 
479  /* Configure the recharge controller */
480  ti_lib_sys_ctrl_set_recharge_before_power_down(XOSC_IN_HIGH_POWER_MODE);
481 
482  /*
483  * If both PERIPH and SERIAL PDs are off, request the uLDO as the power
484  * source while in deep sleep.
485  */
486  if(domains == LOCKABLE_DOMAINS) {
487  ti_lib_pwr_ctrl_source_set(PWRCTRL_PWRSRC_ULDO);
488  }
489 
490  ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_DEEP_LPM);
491 
492  /* Sync the AON interface to ensure all writes have gone through. */
493  ti_lib_sys_ctrl_aon_sync();
494 
495  /*
496  * Explicitly turn off VIMS cache, CRAM and TRAM. Needed because of
497  * retention mismatch between VIMS logic and cache. We wait to do this
498  * until right before deep sleep to be able to use the cache for as long
499  * as possible.
500  */
501  ti_lib_prcm_cache_retention_disable();
502  ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF);
503 
504  /* Deep Sleep */
505  ti_lib_prcm_deep_sleep();
506 
507  /*
508  * When we reach here, some interrupt woke us up. The global interrupt
509  * flag is off, hence we have a chance to run things here. We will wake up
510  * the chip properly, and then we will enable the global interrupt without
511  * unpending events so the handlers can fire
512  */
513  wake_up();
514 
515  ti_lib_int_master_enable();
516 }
517 /*---------------------------------------------------------------------------*/
518 void
520 {
521  uint8_t max_pm;
522 
523  /* Critical. Don't get interrupted! */
524  ti_lib_int_master_disable();
525 
526  max_pm = setup_sleep_mode();
527 
528  /* Drop */
529  if(max_pm == LPM_MODE_SLEEP) {
530  lpm_sleep();
531  } else if(max_pm == LPM_MODE_DEEP_SLEEP) {
532  deep_sleep();
533  }
534 
535  ti_lib_int_master_enable();
536 }
537 /*---------------------------------------------------------------------------*/
538 void
539 lpm_register_module(lpm_registered_module_t *module)
540 {
541  list_add(modules_list, module);
542 }
543 /*---------------------------------------------------------------------------*/
544 void
545 lpm_unregister_module(lpm_registered_module_t *module)
546 {
547  list_remove(modules_list, module);
548 }
549 /*---------------------------------------------------------------------------*/
550 void
552 {
553  list_init(modules_list);
554 
555  /* Always wake up on any DIO edge detection */
556  ti_lib_aon_event_mcu_wake_up_set(AON_EVENT_MCU_WU3, AON_EVENT_IO);
557 }
558 /*---------------------------------------------------------------------------*/
559 void
561 {
562  if(ioid == IOID_UNUSED) {
563  return;
564  }
565 
566  ti_lib_ioc_port_configure_set(ioid, IOC_PORT_GPIO, IOC_STD_OUTPUT);
567  ti_lib_gpio_set_output_enable_dio(ioid, GPIO_OUTPUT_DISABLE);
568 }
569 /*---------------------------------------------------------------------------*/
570 /**
571  * @}
572  * @}
573  */
void oscillators_request_hf_xosc(void)
Requests the HF XOSC as the source for the HF clock, but does not perform the actual switch...
Definition: oscillators.c:94
void soc_rtc_schedule_one_shot(uint32_t channel, uint32_t ticks)
Schedule an AON RTC channel 0 one-shot compare event.
Definition: soc-rtc.c:125
void lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on)
Put the chip in shutdown power mode.
Definition: lpm.c:80
Header file with macros which rename TI CC26xxware functions.
Header file for the energy estimation mechanism
Header file for the management of CC13xx/CC26xx low-power operation.
void lpm_sleep(void)
Enter sleep mode.
Definition: lpm.c:376
clock_time_t etimer_next_expiration_time(void)
Get next event timer expiration time.
Definition: etimer.c:237
#define RTIMER_NOW()
Get the current clock time.
Definition: rtimer.h:160
Header file for the CC13xx/CC26xx oscillator control.
void lpm_drop()
Drop the cortex to sleep / deep sleep and shut down peripherals.
Definition: lpm.c:519
void oscillators_switch_to_hf_rc(void)
Switches MF and HF clock source to be the HF RC OSC.
Definition: oscillators.c:134
#define CLOCK_SECOND
A second, measured in system clock time.
Definition: clock.h:82
Linked list manipulation routines.
void * list_head(list_t list)
Get a pointer to the first element of a list.
Definition: list.c:82
int etimer_pending(void)
Check if there are any non-expired event timers.
Definition: etimer.c:231
clock_time_t clock_time(void)
Get the current clock time.
Definition: clock.c:118
Header file for the management of the CC13xx/CC26xx AUX domain.
void list_add(list_t list, void *item)
Add an item at the end of a list.
Definition: list.c:142
void aux_ctrl_register_consumer(aux_consumer_module_t *consumer)
Register a module that no longer requires access to the AUX power domain.
Definition: aux-ctrl.c:44
void list_init(list_t list)
Initialize a list.
Definition: list.c:65
int process_nevents(void)
Number of events waiting to be processed.
Definition: process.c:316
#define LIST(name)
Declare a linked list.
Definition: list.h:88
void aux_ctrl_power_up()
Power-up the AUX power domain.
Definition: aux-ctrl.c:75
void aux_ctrl_power_down(bool force)
Power down the AUX power domain.
Definition: aux-ctrl.c:87
void lpm_init()
Initialise the low-power mode management module.
Definition: lpm.c:551
The data structure to be used for modules that require access to AUX.
Definition: aux-ctrl.h:62
void lpm_pin_set_default_state(uint32_t ioid)
Sets an IOID to a default state.
Definition: lpm.c:560
void watchdog_periodic(void)
Writes the WDT clear sequence.
Definition: watchdog.c:85
Header file for the CC13xx/CC26xx AON RTC driver.
Header file for the LED HAL.
void list_remove(list_t list, void *item)
Remove a specific element from a list.
Definition: list.c:237
void lpm_unregister_module(lpm_registered_module_t *module)
Unregister a module from LPM notifications.
Definition: lpm.c:545
void lpm_register_module(lpm_registered_module_t *module)
Register a module for LPM notifications.
Definition: lpm.c:539
void oscillators_select_lf_rcosc(void)
Set the LF clock source to be the LF RCOSC.
Definition: oscillators.c:73