CC26xx Driver Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sys_ctrl.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: sys_ctrl.h
3 * Revised: 2015-01-15 14:12:37 +0100 (to, 15 jan 2015)
4 * Revision: 42392
5 *
6 * Description: Defines and prototypes for the System Controller.
7 *
8 * Copyright (c) 2015, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 //*****************************************************************************
40 //
43 //
44 //*****************************************************************************
45 
46 #ifndef __SYSCTRL_H__
47 #define __SYSCTRL_H__
48 
49 //*****************************************************************************
50 //
51 // If building with a C++ compiler, make all of the definitions in this header
52 // have a C binding.
53 //
54 //*****************************************************************************
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
60 #include <stdbool.h>
61 #include <stdint.h>
62 #include <inc/hw_types.h>
63 #include <inc/hw_memmap.h>
64 #include <inc/hw_ints.h>
65 #include <inc/hw_sysctl.h>
66 #include <inc/hw_prcm.h>
67 #include <inc/hw_nvic.h>
68 #include <inc/hw_aon_wuc.h>
69 #include <inc/hw_aux_wuc.h>
70 #include <inc/hw_aon_ioc.h>
71 #include <inc/hw_ddi_0_osc.h>
72 #include <inc/hw_rfc_pwr.h>
73 #include <inc/hw_prcm.h>
74 #include <inc/hw_adi_3_refsys.h>
75 #include <inc/hw_aon_sysctl.h>
76 #include <inc/hw_aon_rtc.h>
77 #include <inc/hw_fcfg1.h>
78 #include <driverlib/interrupt.h>
79 #include <driverlib/debug.h>
80 #include <driverlib/pwr_ctrl.h>
81 #include <driverlib/osc.h>
82 #include <driverlib/prcm.h>
83 #include <driverlib/aux_wuc.h>
84 #include <driverlib/aon_wuc.h>
85 #include <driverlib/adi.h>
86 #include <driverlib/ddi.h>
87 #include <driverlib/cpu.h>
88 #include <driverlib/vims.h>
89 
90 //*****************************************************************************
91 //
92 // Support for DriverLib in ROM:
93 // This section renames all functions that are not "static inline", so that
94 // calling these functions will default to implementation in flash. At the end
95 // of this file a second renaming will change the defaults to implementation in
96 // ROM for available functions.
97 //
98 // To force use of the implementation in flash, e.g. for debugging:
99 // - Globally: Define DRIVERLIB_NOROM at project level
100 // - Per function: Use prefix "NOROM_" when calling the function
101 //
102 // Do not define DRIVERLIB_GENERATE_ROM!
103 //
104 //*****************************************************************************
105 #ifndef DRIVERLIB_GENERATE_ROM
106  #define SysCtrlPowerEverything NOROM_SysCtrlPowerEverything
107  #define SysCtrlStandby NOROM_SysCtrlStandby
108  #define SysCtrlPowerdown NOROM_SysCtrlPowerdown
109  #define SysCtrlShutdown NOROM_SysCtrlShutdown
110  #define SysCtrlClockGet NOROM_SysCtrlClockGet
111  #define SysCtrlPeripheralClockGet NOROM_SysCtrlPeripheralClockGet
112  #define SysCtrlResetSourceGet NOROM_SysCtrlResetSourceGet
113 #endif
114 
115 //*****************************************************************************
116 //
117 // Defines for the settings of the main XOSC
118 //
119 //*****************************************************************************
120 #define SYSCTRL_SYSBUS_ON 0x00000001
121 #define SYSCTRL_SYSBUS_OFF 0x00000000
122 
123 //*****************************************************************************
124 //
125 // Defines for the different power modes of the Cortex M3
126 //
127 //*****************************************************************************
128 #define CPU_RUN 0x00000000
129 #define CPU_SLEEP 0x00000001
130 #define CPU_DEEP_SLEEP 0x00000002
131 
132 //*****************************************************************************
133 //
134 // API Functions and prototypes
135 //
136 //*****************************************************************************
137 
138 //*****************************************************************************
139 //
148 //
149 //*****************************************************************************
150 extern void SysCtrlPowerEverything(void);
151 
152 //*****************************************************************************
153 //
162 //
163 //*****************************************************************************
164 extern void SysCtrlStandby(void);
165 
166 //*****************************************************************************
167 //
176 //
177 //*****************************************************************************
178 extern void SysCtrlPowerdown(void);
179 
180 //*****************************************************************************
181 //
195 //
196 //*****************************************************************************
197 extern void SysCtrlShutdown(void);
198 
199 //*****************************************************************************
200 //
209 //
210 //*****************************************************************************
211 extern uint32_t SysCtrlClockGet(void);
212 
213 //*****************************************************************************
214 //
232 //
233 //*****************************************************************************
234 extern uint32_t SysCtrlPeripheralClockGet(uint32_t ui32Peripheral,
235  uint32_t ui32BusMode);
236 
237 //*****************************************************************************
238 //
245 //
246 //*****************************************************************************
247 __STATIC_INLINE void
249 {
250  //
251  // Sync the AON interface
252  //
253  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC);
254 }
255 
256 //*****************************************************************************
257 //
270 //
271 //*****************************************************************************
272 __STATIC_INLINE void
274 {
275  //
276  // Force a clock cycle on the AON interface to guarantee all registers are
277  // in sync.
278  //
279  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC) = 1;
280  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC);
281 }
282 
283 
284 //*****************************************************************************
285 //
292 //
293 //*****************************************************************************
294 typedef enum {
298 
299 //*****************************************************************************
300 //
318 //
319 //*****************************************************************************
320 void
322 
323 
324 //*****************************************************************************
325 //
343 //
344 //*****************************************************************************
345 void
347 
348 
349 //*****************************************************************************
350 //
360 //
361 //*****************************************************************************
362 void
364 
365 
366 //*****************************************************************************
367 // \name Return values from calling SysCtrlResetSourceGet()
369 //*****************************************************************************
378 #define RSTSRC_WAKEUP_FROM_SHUTDOWN (( AON_SYSCTL_RESETCTL_RESET_SRC_M >> AON_SYSCTL_RESETCTL_RESET_SRC_S ) + 1 )
379 
380 
381 //*****************************************************************************
382 //
386 //
387 //*****************************************************************************
388 extern uint32_t SysCtrlResetSourceGet( void );
389 
390 
391 //*****************************************************************************
392 //
393 // Support for DriverLib in ROM:
394 // Redirect to implementation in ROM when available.
395 //
396 //*****************************************************************************
397 #ifndef DRIVERLIB_NOROM
398  #include <driverlib/rom.h>
399  #ifdef ROM_SysCtrlPowerEverything
400  #undef SysCtrlPowerEverything
401  #define SysCtrlPowerEverything ROM_SysCtrlPowerEverything
402  #endif
403  #ifdef ROM_SysCtrlStandby
404  #undef SysCtrlStandby
405  #define SysCtrlStandby ROM_SysCtrlStandby
406  #endif
407  #ifdef ROM_SysCtrlPowerdown
408  #undef SysCtrlPowerdown
409  #define SysCtrlPowerdown ROM_SysCtrlPowerdown
410  #endif
411  #ifdef ROM_SysCtrlShutdown
412  #undef SysCtrlShutdown
413  #define SysCtrlShutdown ROM_SysCtrlShutdown
414  #endif
415  #ifdef ROM_SysCtrlClockGet
416  #undef SysCtrlClockGet
417  #define SysCtrlClockGet ROM_SysCtrlClockGet
418  #endif
419  #ifdef ROM_SysCtrlPeripheralClockGet
420  #undef SysCtrlPeripheralClockGet
421  #define SysCtrlPeripheralClockGet ROM_SysCtrlPeripheralClockGet
422  #endif
423  #ifdef ROM_SysCtrlResetSourceGet
424  #undef SysCtrlResetSourceGet
425  #define SysCtrlResetSourceGet ROM_SysCtrlResetSourceGet
426  #endif
427 #endif
428 
429 //*****************************************************************************
430 //
431 // Mark the end of the C bindings section for C++ compilers.
432 //
433 //*****************************************************************************
434 #ifdef __cplusplus
435 }
436 #endif
437 
438 #endif // __SYSCTRL_H__
439 
440 //*****************************************************************************
441 //
444 //
445 //*****************************************************************************
uint32_t SysCtrlPeripheralClockGet(uint32_t ui32Peripheral, uint32_t ui32BusMode)
Get the clock for a peripheral.
Definition: sys_ctrl.c:364
void SysCtrl_DCDC_VoltageConditionalControl(void)
Turns DCDC on or off depending of what’s considered to be optimal usage.
Definition: sys_ctrl.c:658
uint32_t SysCtrlResetSourceGet(void)
Returns last reset source (including "wakeup from shutdown")
Definition: sys_ctrl.c:711
When xosc_hf is in LOW_POWER_XOSC.
Definition: sys_ctrl.h:296
void SysCtrlAdjustRechargeAfterPowerDown(void)
Adjust Recharge calculations to be used next.
Definition: sys_ctrl.c:609
uint32_t SysCtrlClockGet(void)
Get the CPU core clock frequency.
Definition: sys_ctrl.c:338
void SysCtrlShutdown(void)
Force the system into shutdown.
Definition: sys_ctrl.c:296
void SysCtrlStandby(void)
Force the system into standby mode.
Definition: sys_ctrl.c:225
__STATIC_INLINE void SysCtrlAonUpdate(void)
Update all interfaces to AON.
Definition: sys_ctrl.h:273
When xosc_hf is in HIGH_POWER_XOSC.
Definition: sys_ctrl.h:295
__STATIC_INLINE void SysCtrlAonSync(void)
Sync all accesses to the AON register interface.
Definition: sys_ctrl.h:248
XoscPowerMode_t
Enumeration describing possible input options to SysCtrlSetRechargeBeforePowerDown().
Definition: sys_ctrl.h:294
void SysCtrlPowerdown(void)
Force the system into power down.
Definition: sys_ctrl.c:255
void SysCtrlSetRechargeBeforePowerDown(XoscPowerMode_t xoscPowerMode)
Set Recharge values before entering Power Down.
Definition: sys_ctrl.c:452
void SysCtrlPowerEverything(void)
Power up everything.
Definition: sys_ctrl.c:121