MSP432E4 DriverLib API Guide  1.11.00.03
hibernate.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // hibernate.h - API definition for the Hibernation module.
4 //
5 // Copyright (c) 2007-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 //*****************************************************************************
37 
38 #ifndef __DRIVERLIB_HIBERNATE_H__
39 #define __DRIVERLIB_HIBERNATE_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 #include <time.h>
44 
45 //*****************************************************************************
46 //
47 // If building with a C++ compiler, make all of the definitions in this header
48 // have a C binding.
49 //
50 //*****************************************************************************
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #endif
55 
56 //*****************************************************************************
57 //
58 // Macros need to configure wake events for HibernateWakeSet()
59 //
60 //*****************************************************************************
61 #define HIBERNATE_WAKE_PIN 0x00000010
62 #define HIBERNATE_WAKE_RTC 0x00000008
63 #define HIBERNATE_WAKE_LOW_BAT 0x00000200
64 #define HIBERNATE_WAKE_GPIO 0x00000010
65 #define HIBERNATE_WAKE_RESET 0x00100010
66 
67 //*****************************************************************************
68 //
69 // Macros needed to configure low battery detect for HibernateLowBatSet()
70 //
71 //*****************************************************************************
72 #define HIBERNATE_LOW_BAT_DETECT \
73  0x00000020
74 #define HIBERNATE_LOW_BAT_ABORT 0x000000A0
75 #define HIBERNATE_LOW_BAT_1_9V 0x00000000
76 #define HIBERNATE_LOW_BAT_2_1V 0x00002000
77 #define HIBERNATE_LOW_BAT_2_3V 0x00004000
78 #define HIBERNATE_LOW_BAT_2_5V 0x00006000
79 
80 //*****************************************************************************
81 //
82 // Macros defining interrupt source bits for the interrupt functions.
83 //
84 //*****************************************************************************
85 #define HIBERNATE_INT_VDDFAIL 0x00000080
86 #define HIBERNATE_INT_RESET_WAKE \
87  0x00000040
88 #define HIBERNATE_INT_GPIO_WAKE 0x00000020
89 #define HIBERNATE_INT_WR_COMPLETE \
90  0x00000010
91 #define HIBERNATE_INT_PIN_WAKE 0x00000008
92 #define HIBERNATE_INT_LOW_BAT 0x00000004
93 #define HIBERNATE_INT_RTC_MATCH_0 \
94  0x00000001
95 
96 //*****************************************************************************
97 //
98 // Macros defining oscillator configuration options for the
99 // HibernateClockConfig() function.
100 //
101 //*****************************************************************************
102 #define HIBERNATE_OSC_LFIOSC 0x00080000
103 #define HIBERNATE_OSC_LOWDRIVE 0x00000000
104 #define HIBERNATE_OSC_HIGHDRIVE 0x00020000
105 #define HIBERNATE_OSC_DISABLE 0x00010000
106 #define HIBERNATE_OUT_WRSTALL 0x20000000
107 #define HIBERNATE_OUT_SYSCLK 0x00000001
108 #define HIBERNATE_OUT_ALT1CLK 0x00000002
109 
110 //*****************************************************************************
111 //
112 // The following defines are used with the HibernateCounterMode() API.
113 //
114 //*****************************************************************************
115 #define HIBERNATE_COUNTER_RTC 0x00000000
116 #define HIBERNATE_COUNTER_12HR 0x00000001
117 #define HIBERNATE_COUNTER_24HR 0x00000005
118 
119 //*****************************************************************************
120 //
121 // Tamper event configuration options used with HibernateTamperEventsConfig().
122 //
123 //*****************************************************************************
124 #define HIBERNATE_TAMPER_EVENTS_NO_HIB_WAKE \
125  0x00000000
126 #define HIBERNATE_TAMPER_EVENTS_HIB_WAKE \
127  0x00000800
128 #define HIBERNATE_TAMPER_EVENTS_NO_ERASE_HIB_MEM \
129  0x00000000
130 #define HIBERNATE_TAMPER_EVENTS_ERASE_LOW_HIB_MEM \
131  0x00000100
132 #define HIBERNATE_TAMPER_EVENTS_ERASE_HIGH_HIB_MEM \
133  0x00000200
134 #define HIBERNATE_TAMPER_EVENTS_ERASE_ALL_HIB_MEM \
135  0x00000300
136 
137 //*****************************************************************************
138 //
139 // Status flags returned by the HibernateTamperStatus() function.
140 //
141 //*****************************************************************************
142 #define HIBERNATE_TAMPER_STATUS_INACTIVE \
143  0x00000010
144 #define HIBERNATE_TAMPER_STATUS_ACTIVE \
145  0x00000020
146 #define HIBERNATE_TAMPER_STATUS_EVENT \
147  0x00000040
148 #define HIBERNATE_TAMPER_STATUS_EXT_OSC_ACTIVE \
149  0x00000008
150 #define HIBERNATE_TAMPER_STATUS_EXT_OSC_INACTIVE \
151  0x00000002
152 #define HIBERNATE_TAMPER_STATUS_EXT_OSC_VALID \
153  0x00000004
154 #define HIBERNATE_TAMPER_STATUS_EXT_OSC_FAILED \
155  0x00000001
156 
157 //*****************************************************************************
158 //
159 // Configuration options used with HibernateTamperIOEnable().
160 //
161 //*****************************************************************************
162 #define HIBERNATE_TAMPER_IO_TRIGGER_LOW \
163  0x00000000
164 #define HIBERNATE_TAMPER_IO_TRIGGER_HIGH \
165  0x00000002
166 #define HIBERNATE_TAMPER_IO_WPU_DISABLED \
167  0x00000000
168 #define HIBERNATE_TAMPER_IO_WPU_ENABLED \
169  0x00000004
170 #define HIBERNATE_TAMPER_IO_MATCH_SHORT \
171  0x00000000
172 #define HIBERNATE_TAMPER_IO_MATCH_LONG \
173  0x00000008
174 
175 //*****************************************************************************
176 //
177 // Tamper log event flags.
178 //
179 //*****************************************************************************
180 #define HIBERNATE_TAMPER_EVENT_0 \
181  0x00000001
182 #define HIBERNATE_TAMPER_EVENT_1 \
183  0x00000002
184 #define HIBERNATE_TAMPER_EVENT_2 \
185  0x00000004
186 #define HIBERNATE_TAMPER_EVENT_3 \
187  0x00000008
188 #define HIBERNATE_TAMPER_EVENT_EXT_OSC \
189  0x00010000
190 
191 //*****************************************************************************
192 //
193 // API Function prototypes
194 //
195 //*****************************************************************************
196 extern void HibernateGPIORetentionEnable(void);
197 extern void HibernateGPIORetentionDisable(void);
198 extern bool HibernateGPIORetentionGet(void);
199 extern void HibernateEnableExpClk(uint32_t ui32HibClk);
200 extern void HibernateDisable(void);
201 extern void HibernateRTCEnable(void);
202 extern void HibernateRTCDisable(void);
203 extern void HibernateWakeSet(uint32_t ui32WakeFlags);
204 extern uint32_t HibernateWakeGet(void);
205 extern void HibernateLowBatSet(uint32_t ui32LowBatFlags);
206 extern uint32_t HibernateLowBatGet(void);
207 extern void HibernateRTCSet(uint32_t ui32RTCValue);
208 extern uint32_t HibernateRTCGet(void);
209 extern void HibernateRTCMatchSet(uint32_t ui32Match, uint32_t ui32Value);
210 extern uint32_t HibernateRTCMatchGet(uint32_t ui32Match);
211 extern void HibernateRTCTrimSet(uint32_t ui32Trim);
212 extern uint32_t HibernateRTCTrimGet(void);
213 extern void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count);
214 extern void HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count);
215 extern void HibernateRequest(void);
216 extern void HibernateIntEnable(uint32_t ui32IntFlags);
217 extern void HibernateIntDisable(uint32_t ui32IntFlags);
218 extern void HibernateIntRegister(void (*pfnHandler)(void));
219 extern void HibernateIntUnregister(void);
220 extern uint32_t HibernateIntStatus(bool bMasked);
221 extern void HibernateIntClear(uint32_t ui32IntFlags);
222 extern uint32_t HibernateIsActive(void);
223 extern void HibernateRTCSSMatchSet(uint32_t ui32Match, uint32_t ui32Value);
224 extern uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match);
225 extern uint32_t HibernateRTCSSGet(void);
226 extern void HibernateClockConfig(uint32_t ui32Config);
227 extern void HibernateBatCheckStart(void);
228 extern uint32_t HibernateBatCheckDone(void);
229 extern void HibernateCounterMode(uint32_t ui32Config);
230 extern void HibernateCalendarSet(struct tm *psTime);
231 extern int HibernateCalendarGet(struct tm *psTime);
232 extern void HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime);
233 extern void HibernateCalendarMatchGet(uint32_t ui32Index, struct tm *psTime);
234 extern void HibernateTamperEnable(void);
235 extern void HibernateTamperEventsConfig(uint32_t ui32Config);
236 extern bool HibernateTamperEventsGet(uint32_t ui32Index, uint32_t *pui32RTC,
237  uint32_t *pui32Event);
238 extern void HibernateTamperEventsClear(void);
239 extern void HibernateTamperEventsClearNoLock(void);
240 extern void HibernateTamperUnLock(void);
241 extern void HibernateTamperLock(void);
242 extern void HibernateTamperDisable(void);
243 extern void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config);
244 extern void HibernateTamperIODisable(uint32_t ui32Input);
245 extern uint32_t HibernateTamperStatusGet(void);
246 extern void HibernateTamperExtOscRecover(void);
247 extern bool HibernateTamperExtOscValid(void);
248 
249 //*****************************************************************************
250 //
251 // Mark the end of the C bindings section for C++ compilers.
252 //
253 //*****************************************************************************
254 #ifdef __cplusplus
255 }
256 #endif
257 
258 #endif // __DRIVERLIB_HIBERNATE_H__
uint32_t HibernateWakeGet(void)
Definition: hibernate.c:473
void HibernateRTCDisable(void)
Definition: hibernate.c:292
uint32_t HibernateIsActive(void)
Definition: hibernate.c:1247
void HibernateTamperUnLock(void)
Definition: hibernate.c:2124
void HibernateRTCSSMatchSet(uint32_t ui32Match, uint32_t ui32Value)
Definition: hibernate.c:699
void HibernateRequest(void)
Definition: hibernate.c:941
bool HibernateGPIORetentionGet(void)
Definition: hibernate.c:1324
void HibernateIntEnable(uint32_t ui32IntFlags)
Definition: hibernate.c:978
void HibernateTamperEnable(void)
Definition: hibernate.c:1845
void HibernateTamperEventsConfig(uint32_t ui32Config)
Definition: hibernate.c:1800
void HibernateIntDisable(uint32_t ui32IntFlags)
Definition: hibernate.c:1017
void HibernateDataGet(uint32_t *pui32Data, uint32_t ui32Count)
Definition: hibernate.c:882
void HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime)
Definition: hibernate.c:1663
uint32_t HibernateIntStatus(bool bMasked)
Definition: hibernate.c:1161
void HibernateTamperIODisable(uint32_t ui32Input)
Definition: hibernate.c:2006
uint32_t HibernateBatCheckDone(void)
Definition: hibernate.c:355
void HibernateGPIORetentionDisable(void)
Definition: hibernate.c:1298
void HibernateClockConfig(uint32_t ui32Config)
Definition: hibernate.c:204
void HibernateDisable(void)
Definition: hibernate.c:142
bool HibernateTamperEventsGet(uint32_t ui32Index, uint32_t *pui32RTC, uint32_t *pui32Event)
Definition: hibernate.c:2281
void HibernateRTCMatchSet(uint32_t ui32Match, uint32_t ui32Value)
Definition: hibernate.c:642
void HibernateIntUnregister(void)
Definition: hibernate.c:1119
void HibernateTamperEventsClearNoLock(void)
Definition: hibernate.c:2098
uint32_t HibernateRTCTrimGet(void)
Definition: hibernate.c:809
void HibernateGPIORetentionEnable(void)
Definition: hibernate.c:1271
void HibernateRTCEnable(void)
Definition: hibernate.c:267
void HibernateTamperDisable(void)
Definition: hibernate.c:1883
void HibernateTamperEventsClear(void)
Definition: hibernate.c:2052
uint32_t HibernateTamperStatusGet(void)
Definition: hibernate.c:2190
uint32_t HibernateRTCSSGet(void)
Definition: hibernate.c:752
void HibernateLowBatSet(uint32_t ui32LowBatFlags)
Definition: hibernate.c:524
void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count)
Definition: hibernate.c:836
void HibernateWakeSet(uint32_t ui32WakeFlags)
Definition: hibernate.c:391
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match)
Definition: hibernate.c:729
void HibernateCalendarSet(struct tm *psTime)
Definition: hibernate.c:1545
uint32_t HibernateRTCGet(void)
Definition: hibernate.c:618
uint32_t HibernateRTCMatchGet(uint32_t ui32Match)
Definition: hibernate.c:671
uint32_t HibernateLowBatGet(void)
Definition: hibernate.c:560
void HibernateCalendarMatchGet(uint32_t ui32Index, struct tm *psTime)
Definition: hibernate.c:1694
void HibernateEnableExpClk(uint32_t ui32HibClk)
Definition: hibernate.c:118
void HibernateTamperExtOscRecover(void)
Definition: hibernate.c:2353
void HibernateBatCheckStart(void)
Definition: hibernate.c:325
void HibernateRTCTrimSet(uint32_t ui32Trim)
Definition: hibernate.c:779
void HibernateIntRegister(void(*pfnHandler)(void))
Definition: hibernate.c:1082
int HibernateCalendarGet(struct tm *psTime)
Definition: hibernate.c:1578
void HibernateCounterMode(uint32_t ui32Config)
Definition: hibernate.c:1371
bool HibernateTamperExtOscValid(void)
Definition: hibernate.c:2392
void HibernateTamperLock(void)
Definition: hibernate.c:2145
void HibernateTamperIOEnable(uint32_t ui32Input, uint32_t ui32Config)
Definition: hibernate.c:1939
void HibernateRTCSet(uint32_t ui32RTCValue)
Definition: hibernate.c:583
void HibernateIntClear(uint32_t ui32IntFlags)
Definition: hibernate.c:1202
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale