CC26xx Driver Library
aon_wuc.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: aon_wuc.h
3 * Revised: 2016-07-07 19:12:02 +0200 (Thu, 07 Jul 2016)
4 * Revision: 46848
5 *
6 * Description: Defines and prototypes for the AON Wake-Up Controller
7 *
8 * Copyright (c) 2015 - 2016, 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 //
45 //
46 //*****************************************************************************
47 
48 #ifndef __AON_WUC_H__
49 #define __AON_WUC_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include <inc/hw_types.h>
65 #include <inc/hw_memmap.h>
66 #include <inc/hw_ints.h>
67 #include <inc/hw_aon_wuc.h>
68 #include <inc/hw_aon_rtc.h>
69 #include <driverlib/interrupt.h>
70 #include <driverlib/debug.h>
71 
72 //*****************************************************************************
73 //
74 // Support for DriverLib in ROM:
75 // This section renames all functions that are not "static inline", so that
76 // calling these functions will default to implementation in flash. At the end
77 // of this file a second renaming will change the defaults to implementation in
78 // ROM for available functions.
79 //
80 // To force use of the implementation in flash, e.g. for debugging:
81 // - Globally: Define DRIVERLIB_NOROM at project level
82 // - Per function: Use prefix "NOROM_" when calling the function
83 //
84 //*****************************************************************************
85 #if !defined(DOXYGEN)
86  #define AONWUCAuxReset NOROM_AONWUCAuxReset
87  #define AONWUCRechargeCtrlConfigSet NOROM_AONWUCRechargeCtrlConfigSet
88  #define AONWUCOscConfig NOROM_AONWUCOscConfig
89 #endif
90 
91 //*****************************************************************************
92 //
93 // Defines the possible clock source for the MCU and AUX domain.
94 //
95 //*****************************************************************************
96 #define AONWUC_CLOCK_SRC_HF 0x00000003 // System clock high frequency -
97  // 48 MHz.
98 #define AONWUC_CLOCK_SRC_LF 0x00000001 // System clock low frequency -
99  // 32 kHz.
100 #define AONWUC_NO_CLOCK 0x00000000 // System clock low frequency -
101  // 32 kHz.
102 
103 //*****************************************************************************
104 //
105 // Defines the possible clock division factors for the AUX domain.
106 //
107 //*****************************************************************************
108 #define AUX_CLOCK_DIV_2 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV2 )
109 #define AUX_CLOCK_DIV_4 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV4 )
110 #define AUX_CLOCK_DIV_8 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV8 )
111 #define AUX_CLOCK_DIV_16 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV16 )
112 #define AUX_CLOCK_DIV_32 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV32 )
113 #define AUX_CLOCK_DIV_64 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV64 )
114 #define AUX_CLOCK_DIV_128 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV128 )
115 #define AUX_CLOCK_DIV_256 ( AON_WUC_AUXCLK_SCLK_HF_DIV_DIV256 )
116 #define AUX_CLOCK_DIV_UNUSED ( AON_WUC_AUXCLK_SCLK_HF_DIV_M + ( 1 << AON_WUC_AUXCLK_SCLK_HF_DIV_S ))
117 #define AUX_CLOCK_DIV_M ( AON_WUC_AUXCLK_SCLK_HF_DIV_M )
118 
119 //*****************************************************************************
120 //
121 // Defines used for configuring the power-off and wake up procedure.
122 //
123 //*****************************************************************************
124 #define MCU_VIRT_PWOFF_DISABLE 0x00000000
125 #define MCU_VIRT_PWOFF_ENABLE 0x00020000
126 #define MCU_IMM_WAKE_UP 0x00000000
127 #define MCU_FIXED_WAKE_UP 0x00010000
128 #define AUX_VIRT_PWOFF_DISABLE 0x00000000
129 #define AUX_VIRT_PWOFF_ENABLE 0x00020000
130 #define AUX_IMM_WAKE_UP 0x00000000
131 #define AUX_FIXED_WAKE_UP 0x00010000
132 
133 //*****************************************************************************
134 //
135 // Defines that can be be used to enable/disable the entire SRAM and the
136 // retention on the SRAM in both the MCU and the AUX domain.
137 //
138 //*****************************************************************************
139 #define MCU_RAM0_RETENTION 0x00000001
140 #define MCU_RAM1_RETENTION 0x00000002
141 #define MCU_RAM2_RETENTION 0x00000004
142 #define MCU_RAM3_RETENTION 0x00000008
143 #define MCU_RAM_BLOCK_RETENTION 0x0000000F
144 #define MCU_AUX_RET_ENABLE 0x00000001
145 
146 //*****************************************************************************
147 //
148 // Defines for different wake up modes for AUX domain which can be set using
149 // AONWUCAuxWakeUpEvent() .
150 //
151 //*****************************************************************************
152 #define AONWUC_AUX_WAKEUP 0x00000001
153 #define AONWUC_AUX_ALLOW_SLEEP 0x00000000
154 
155 //*****************************************************************************
156 //
157 // Defines for all the different power modes available through
158 // AONWUCPowerStatusGet() .
159 //
160 //*****************************************************************************
161 #define AONWUC_OSC_GBIAS_REQ 0x00400000 // OSC is requesting GBias
162 #define AONWUC_AUX_GBIAS_REQ 0x00200000 // AUX is requesting GBias
163 #define AONWUC_MCU_GBIAS_REQ 0x00100000 // MCU is requesting GBias
164 #define AONWUC_OSC_BGAP_REQ 0x00040000 // OSC is requesting BGap
165 #define AONWUC_AUX_BGAP_REQ 0x00020000 // AUX is requesting BGap
166 #define AONWUC_MCU_BGAP_REQ 0x00010000 // MCU is requesting BGap
167 #define AONWUC_GBIAS_ON 0x00002000 // Global Bias is on
168 #define AONWUC_BGAP_ON 0x00001000 // Band Gap is on
169 #define AONWUC_AUX_POWER_DOWN 0x00000200 // AUX is in powerdown mode
170 #define AONWUC_MCU_POWER_DOWN 0x00000100 // MCU is in powerdown mode
171 #define AONWUC_JTAG_POWER_ON 0x00000040 // JTAG is powered on
172 #define AONWUC_AUX_POWER_ON 0x00000020 // AUX is powered on
173 #define AONWUC_MCU_POWER_ON 0x00000010 // MCU is powered on
174 #define AONWUC_SPLY_POWER_DOWN 0x00000001 // Power supply is in power down
175 
176 
177 //*****************************************************************************
178 //
179 // RAM repair status bits. Values are returned by AOXWUCRamRepairStatusGet() .
180 //
181 //*****************************************************************************
182 #define MCU_RAMREPAIR_DONE 0x00000001
183 #define AUX_RAMREPAIR_DONE 0x00000002
184 
185 //*****************************************************************************
186 
187 //*****************************************************************************
188 #define RC_RATE_MAX 768 // Maximum recharge rate for the
189  // recharge controller.
190 #define RC_RATE_MIN 2 // Minimum recharge rate for the
191  // recharge controller.
192 
193 //*****************************************************************************
194 #define AONWUC_MCU_RESET_SRC 0x00000002 // MCU reset source can be SW or
195  // JTAG
196 #define AONWUC_MCU_WARM_RESET 0x00000001 // MCU reset type and can be warm
197  // or not warm.
198 
199 //*****************************************************************************
200 //
201 // API Functions and prototypes
202 //
203 //*****************************************************************************
204 
205 //*****************************************************************************
206 //
223 //
224 //*****************************************************************************
225 __STATIC_INLINE void
226 AONWUCMcuPowerDownConfig(uint32_t ui32ClkSrc)
227 {
228  uint32_t ui32Reg;
229 
230  //
231  // Check the arguments.
232  //
233  ASSERT((ui32ClkSrc == AONWUC_NO_CLOCK) ||
234  (ui32ClkSrc == AONWUC_CLOCK_SRC_LF));
235 
236  //
237  // Set the clock source for the MCU domain when in power down.
238  //
239  ui32Reg = HWREG(AON_WUC_BASE + AON_WUC_O_MCUCLK);
240  ui32Reg &= ~AON_WUC_MCUCLK_PWR_DWN_SRC_M;
241  HWREG(AON_WUC_BASE + AON_WUC_O_MCUCLK) = ui32Reg |
242  (ui32ClkSrc <<
244 }
245 
246 //*****************************************************************************
247 //
262 //
263 //*****************************************************************************
264 __STATIC_INLINE void
265 AONWUCMcuPowerOffConfig(uint32_t ui32Mode)
266 {
267  // Check the arguments.
268  ASSERT((ui32Mode == MCU_VIRT_PWOFF_ENABLE) ||
269  (ui32Mode == MCU_VIRT_PWOFF_DISABLE));
270 
271  // Set the powerdown mode.
272  HWREGBITW(AON_WUC_BASE + AON_WUC_O_MCUCFG, AON_WUC_MCUCFG_VIRT_OFF_BITN) = (ui32Mode != 0);
273 }
274 
275 //*****************************************************************************
276 //
291 //
292 //*****************************************************************************
293 __STATIC_INLINE void
294 AONWUCMcuWakeUpConfig(uint32_t ui32WakeUp)
295 {
296  // Check the arguments.
297  ASSERT((ui32WakeUp == MCU_IMM_WAKE_UP) ||
298  (ui32WakeUp == MCU_FIXED_WAKE_UP));
299 
300  // Configure the wake up procedure.
301  HWREGBITW(AON_WUC_BASE + AON_WUC_O_MCUCFG, AON_WUC_MCUCFG_FIXED_WU_EN_BITN) = (ui32WakeUp != 0);
302 }
303 
304 //*****************************************************************************
305 //
328 //
329 //*****************************************************************************
330 __STATIC_INLINE void
331 AONWUCMcuSRamConfig(uint32_t ui32Retention)
332 {
333  uint32_t ui32Reg;
334 
335  //
336  // Check the arguments.
337  //
338  ASSERT(ui32Retention & MCU_RAM_BLOCK_RETENTION);
339  ASSERT(!(ui32Retention & ~MCU_RAM_BLOCK_RETENTION));
340 
341  //
342  // Configure the retention.
343  //
344  ui32Reg = HWREG(AON_WUC_BASE + AON_WUC_O_MCUCFG) & ~MCU_RAM_BLOCK_RETENTION;
345  ui32Reg |= ui32Retention;
346  HWREG(AON_WUC_BASE + AON_WUC_O_MCUCFG) = ui32Reg;
347 }
348 
349 
350 //*****************************************************************************
351 //
368 //
369 //*****************************************************************************
370 __STATIC_INLINE uint32_t
372 {
373  //
374  // Return the clock divider value.
375  //
376  return ((HWREG(AON_WUC_BASE + AON_WUC_O_AUXCLK) &
379 }
380 
381 //*****************************************************************************
382 //
397 //
398 //*****************************************************************************
399 __STATIC_INLINE void
400 AONWUCAuxPowerDownConfig(uint32_t ui32ClkSrc)
401 {
402  uint32_t ui32Reg;
403 
404  //
405  // Check the arguments.
406  //
407  ASSERT((ui32ClkSrc == AONWUC_NO_CLOCK) ||
408  (ui32ClkSrc == AONWUC_CLOCK_SRC_LF));
409 
410  //
411  // Set the clock source for the AUX domain when in power down.
412  //
413  ui32Reg = HWREG(AON_WUC_BASE + AON_WUC_O_AUXCLK);
414  ui32Reg &= ~AON_WUC_AUXCLK_PWR_DWN_SRC_M;
415  HWREG(AON_WUC_BASE + AON_WUC_O_AUXCLK) = ui32Reg |
416  (ui32ClkSrc <<
418 }
419 
420 
421 //*****************************************************************************
422 //
438 //
439 //*****************************************************************************
440 __STATIC_INLINE void
441 AONWUCAuxSRamConfig(uint32_t ui32Retention)
442 {
443  // Enable/disable the retention.
444  HWREGBITW(AON_WUC_BASE + AON_WUC_O_AUXCFG, AON_WUC_AUXCFG_RAM_RET_EN_BITN) = ui32Retention;
445 }
446 
447 //*****************************************************************************
448 //
462 //
473 //
474 //*****************************************************************************
475 __STATIC_INLINE void
476 AONWUCAuxWakeupEvent(uint32_t ui32Mode)
477 {
478  // Check the arguments.
479  ASSERT((ui32Mode == AONWUC_AUX_WAKEUP) ||
480  (ui32Mode == AONWUC_AUX_ALLOW_SLEEP));
481 
482  // Wake up the AUX domain.
484 }
485 
486 //*****************************************************************************
487 //
499 //
500 //*****************************************************************************
501 extern void AONWUCAuxReset(void);
502 
503 //*****************************************************************************
504 //
511 //
512 //*****************************************************************************
513 __STATIC_INLINE void
515 {
516  // Tell the Sensor Controller that the image in memory is valid.
518 }
519 
520 //*****************************************************************************
521 //
528 //
529 //*****************************************************************************
530 __STATIC_INLINE void
532 {
533  // Tell the Sensor Controller that the image in memory is invalid.
535 }
536 
537 //*****************************************************************************
538 //
553 //
554 //*****************************************************************************
555 __STATIC_INLINE uint32_t
557 {
558  //
559  // Return the power status.
560  //
561  return (HWREG(AON_WUC_BASE + AON_WUC_O_PWRSTAT));
562 }
563 
564 //*****************************************************************************
565 //
578 //
579 //*****************************************************************************
580 __STATIC_INLINE void
582 {
583  // Ensure the JTAG domain is turned off;
584  // otherwise MCU domain can't be turned off.
585  HWREG(AON_WUC_BASE + AON_WUC_O_JTAGCFG) = 0;
586 
587  // Enable shutdown of the device.
590 }
591 
592 //*****************************************************************************
593 //
602 //
603 //*****************************************************************************
604 __STATIC_INLINE void
606 {
607  // Ensure the JTAG domain is turned off;
608  // otherwise MCU domain can't be turned off.
609  HWREG(AON_WUC_BASE + AON_WUC_O_JTAGCFG) = 0;
610 
611  // Enable power down mode.
613 }
614 
615 //*****************************************************************************
616 //
624 //
625 //*****************************************************************************
626 __STATIC_INLINE void
628 {
629  // Disable power down mode.
631 }
632 
633 //*****************************************************************************
634 //
653 //
654 //*****************************************************************************
655 __STATIC_INLINE void
656 AONWUCMcuResetClear(uint32_t ui32Status)
657 {
658  //
659  // Check the arguments.
660  //
661  ASSERT((ui32Status & AONWUC_MCU_RESET_SRC) ||
662  (ui32Status & AONWUC_MCU_WARM_RESET));
663 
664  //
665  // Clear the status bits.
666  //
667  HWREG(AON_WUC_BASE + AON_WUC_O_CTL1) = ui32Status;
668 }
669 
670 //*****************************************************************************
671 //
677 //
678 //*****************************************************************************
679 __STATIC_INLINE uint32_t
681 {
682  //
683  // Return the current status.
684  //
685  return (HWREG(AON_WUC_BASE + AON_WUC_O_CTL1));
686 }
687 
688 //*****************************************************************************
689 //
696 
707 
722 //
740 //*****************************************************************************
741 extern void AONWUCRechargeCtrlConfigSet(bool bAdaptEnable,
742  uint32_t ui32AdaptRate,
743  uint32_t ui32Period,
744  uint32_t ui32MaxPeriod);
745 
746 //*****************************************************************************
747 //
753 //
754 //*****************************************************************************
755 __STATIC_INLINE uint32_t
757 {
758  //
759  // Return the current configuration.
760  //
761  return(HWREG(AON_WUC_BASE + AON_WUC_O_RECHARGECFG));
762 }
763 
764 //*****************************************************************************
765 //
773 
780 //
797 //*****************************************************************************
798 extern void AONWUCOscConfig(uint32_t ui32Period);
799 
800 //*****************************************************************************
801 //
813 //
814 //*****************************************************************************
815 __STATIC_INLINE void
817 {
818  //
819  // Request the power off of the Jtag domain
820  //
821  HWREG(AON_WUC_BASE + AON_WUC_O_JTAGCFG) = 0;
822 }
823 
824 
825 //*****************************************************************************
826 //
827 // Support for DriverLib in ROM:
828 // Redirect to implementation in ROM when available.
829 //
830 //*****************************************************************************
831 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
832  #include <driverlib/rom.h>
833  #ifdef ROM_AONWUCAuxReset
834  #undef AONWUCAuxReset
835  #define AONWUCAuxReset ROM_AONWUCAuxReset
836  #endif
837  #ifdef ROM_AONWUCRechargeCtrlConfigSet
838  #undef AONWUCRechargeCtrlConfigSet
839  #define AONWUCRechargeCtrlConfigSet ROM_AONWUCRechargeCtrlConfigSet
840  #endif
841  #ifdef ROM_AONWUCOscConfig
842  #undef AONWUCOscConfig
843  #define AONWUCOscConfig ROM_AONWUCOscConfig
844  #endif
845 #endif
846 
847 //*****************************************************************************
848 //
849 // Mark the end of the C bindings section for C++ compilers.
850 //
851 //*****************************************************************************
852 #ifdef __cplusplus
853 }
854 #endif
855 
856 #endif // __AON_WUC_H__
857 
858 //*****************************************************************************
859 //
863 //
864 //*****************************************************************************
#define MCU_IMM_WAKE_UP
Definition: aon_wuc.h:126
static void AONWUCAuxWakeupEvent(uint32_t ui32Mode)
Control the wake up procedure of the AUX domain.
Definition: aon_wuc.h:476
static uint32_t AONWUCPowerStatusGet(void)
Get the power status of the device.
Definition: aon_wuc.h:556
#define AONWUC_MCU_WARM_RESET
Definition: aon_wuc.h:196
#define MCU_VIRT_PWOFF_ENABLE
Definition: aon_wuc.h:125
static void AONWUCAuxSRamConfig(uint32_t ui32Retention)
Configure the retention on the AUX SRAM.
Definition: aon_wuc.h:441
void AONWUCOscConfig(uint32_t ui32Period)
Configure the interval for oscillator amplitude calibration.
Definition: aon_wuc.c:210
void AONWUCAuxReset(void)
Reset the AUX domain.
Definition: aon_wuc.c:63
#define AONWUC_CLOCK_SRC_LF
Definition: aon_wuc.h:98
static void AONWUCAuxImageInvalid(void)
Tells the Sensor Controller that the image in memory is invalid.
Definition: aon_wuc.h:531
static void AONWUCMcuPowerDownConfig(uint32_t ui32ClkSrc)
Configure the power down clock for the MCU domain.
Definition: aon_wuc.h:226
void AONWUCRechargeCtrlConfigSet(bool bAdaptEnable, uint32_t ui32AdaptRate, uint32_t ui32Period, uint32_t ui32MaxPeriod)
Configure the recharge controller.
Definition: aon_wuc.c:86
#define MCU_FIXED_WAKE_UP
Definition: aon_wuc.h:127
static void AONWUCMcuResetClear(uint32_t ui32Status)
Use this function to clear specific status bits.
Definition: aon_wuc.h:656
#define AONWUC_MCU_RESET_SRC
Definition: aon_wuc.h:194
static void AONWUCDomainPowerDownEnable(void)
Enable power down mode on AUX and MCU domain.
Definition: aon_wuc.h:605
#define AONWUC_AUX_ALLOW_SLEEP
Definition: aon_wuc.h:153
#define AONWUC_AUX_WAKEUP
Definition: aon_wuc.h:152
static void AONWUCDomainPowerDownDisable(void)
Use this function to disable power down mode of the MCU and AUX domain.
Definition: aon_wuc.h:627
#define ASSERT(expr)
Definition: debug.h:74
static void AONWUCAuxImageValid(void)
Tells the Sensor Controller that the image in memory is valid.
Definition: aon_wuc.h:514
#define AONWUC_NO_CLOCK
Definition: aon_wuc.h:100
static void AONWUCShutDownEnable(void)
Enable shut-down of the device.
Definition: aon_wuc.h:581
#define MCU_RAM_BLOCK_RETENTION
Definition: aon_wuc.h:143
static uint32_t AONWUCRechargeCtrlConfigGet(void)
Get the current configuration of the recharge controller.
Definition: aon_wuc.h:756
static void AONWUCAuxPowerDownConfig(uint32_t ui32ClkSrc)
Configure the power down mode for the AUX domain.
Definition: aon_wuc.h:400
#define MCU_VIRT_PWOFF_DISABLE
Definition: aon_wuc.h:124
static uint32_t AONWUCAuxClockConfigGet(void)
Return the clock configuration for the AUX domain.
Definition: aon_wuc.h:371
static uint32_t AONWUCMcuResetStatusGet(void)
Return the reset status.
Definition: aon_wuc.h:680
static void AONWUCMcuWakeUpConfig(uint32_t ui32WakeUp)
Configure the wake-up procedure for the MCU domain.
Definition: aon_wuc.h:294
static void AONWUCMcuPowerOffConfig(uint32_t ui32Mode)
Configure the power down mode for the MCU domain.
Definition: aon_wuc.h:265
static void AONWUCJtagPowerOff(void)
Request power off of the JTAG domain.
Definition: aon_wuc.h:816
static void AONWUCMcuSRamConfig(uint32_t ui32Retention)
Configure the retention on the block RAM in the MCU domain.
Definition: aon_wuc.h:331