Contiki-NG
aux-ctrl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, University of Bristol - http://www.bris.ac.uk/
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
33  * @{
34  *
35  * \defgroup cc26xx-aux-ctrl CC13xx/CC26xx AUX domain controller
36  *
37  * CC13xx/CC26xx AUX domain power management controller
38  *
39  * @{
40  *
41  * \file
42  * Header file for the management of the CC13xx/CC26xx AUX domain
43  */
44 /*---------------------------------------------------------------------------*/
45 #ifndef AUX_CTRL_H_
46 #define AUX_CTRL_H_
47 /*---------------------------------------------------------------------------*/
48 #include "contiki.h"
49 
50 #include "ti-lib.h"
51 
52 #include <stdint.h>
53 /*---------------------------------------------------------------------------*/
54 /**
55  * \brief The data structure to be used for modules that require access to AUX
56  *
57  * The clocks field should specify the clocks (within AUX) that your module
58  * requires in order to perform its functionality. Those clocks are an ORd
59  * value of AUX_WUC_xxxx_CLOCK. For instance, the oscillators module specifies
60  * AUX_WUC_OSCCTRL_CLOCK | AUX_WUC_SMPH_CLOCK
61  */
62 typedef struct aux_consumer_module {
63  struct aux_consumer_module *next;
64  uint32_t clocks;
66 /*---------------------------------------------------------------------------*/
67 /**
68  * \brief Register a module that no longer requires access to the AUX power domain
69  * \param consumer A pointer to the data structure of your AUX consumer
70  *
71  * Call this function if you are developing a module that requires access to
72  * hardware within the AUX PD. Calling this function will achieve a number of
73  * things:
74  *
75  * - It will power up the AUX PD
76  * - It will enable the AUX clocks that you require
77  *
78  * If you call this function, AUX will stay powered-on and clocked during deep
79  * sleep, and retention will be enabled (so that you can e.g. use the sensor
80  * controller to monitor peripherals while the main MCU in deep sleep). If you
81  * do not need AUX enabled during deep sleep, you must release it by calling
82  * aux_ctrl_unregister_consumer()
83  *
84  * \sa aux_ctrl_unregister_consumer
85  */
87 
88 /**
89  * \brief Deregister a module that no longer requires access to the AUX power domain
90  * \param consumer A pointer to the data structure of your AUX consumer
91  *
92  * When your module is finished using features provided from within the AUX
93  * domain, you should call this function to signal that AUX is no longer
94  * required, so that the LPM module can power it down in deep sleep. If there
95  * are no more registered consumers left, this function will also power down
96  * AUX.
97  *
98  * \sa aux_ctrl_register_consumer
99  * \sa aux_ctrl_power_down
100  */
102 
103 /**
104  * \brief Power-up the AUX power domain
105  *
106  * This function will power up the AUX power-domain, but only if there are
107  * registered consumers for it. If there are not, the PD will stay off.
108  *
109  * This function will automatically get called by the LPM module whenever the
110  * chip comes out of deep sleep.
111  *
112  * User applications will normally not need to call this function. if you are
113  * developing a user application that requires access, to AUX, you should
114  * normally call aux_ctrl_register_consumer(), which will automatically power
115  * up AUX for you, if it's not already powered.
116  */
117 void aux_ctrl_power_up(void);
118 
119 /**
120  * \brief Power down the AUX power domain
121  * \param force Force the power down irrespective of registered consumers
122  *
123  * This function will shut down the AUX power-domain.
124  *
125  * The shutdown is unconditional if force is true. If force is false and there
126  * are registered consumers, the power-down will be suppressed.
127  *
128  * This function will automatically get called by the LPM module whenever the
129  * chip tries to enter deep sleep or shuts down.
130  *
131  * User applications will normally not need to call this function. if you are
132  * developing a user application that no longer requires access, to AUX, you
133  * should normally simply release it by calling aux_ctrl_unregister_consumer().
134  * If no other consumers are using AUX, then the lpm module will shut it down.
135  */
136 void aux_ctrl_power_down(bool force);
137 /*---------------------------------------------------------------------------*/
138 #endif /* AUX_CTRL_H_ */
139 /*---------------------------------------------------------------------------*/
140 /**
141  * @}
142  * @}
143  */
void aux_ctrl_unregister_consumer(aux_consumer_module_t *consumer)
Deregister a module that no longer requires access to the AUX power domain.
Definition: aux-ctrl.c:61
Header file with macros which rename TI CC26xxware functions.
struct aux_consumer_module aux_consumer_module_t
The data structure to be used for modules that require access to AUX.
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 aux_ctrl_power_up(void)
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
The data structure to be used for modules that require access to AUX.
Definition: aux-ctrl.h:62