1 |
610 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// hibernate.h - API definition for the Hibernation module.
|
4 |
|
|
//
|
5 |
|
|
// Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// Software License Agreement
|
8 |
|
|
//
|
9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
10 |
|
|
// exclusively on LMI's microcontroller products.
|
11 |
|
|
//
|
12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
13 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
14 |
|
|
// this software with "viral" open-source software in order to form a larger
|
15 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
16 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
17 |
|
|
// liability for the breach of the terms and conditions of this license.
|
18 |
|
|
//
|
19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
//
|
25 |
|
|
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
|
26 |
|
|
//
|
27 |
|
|
//*****************************************************************************
|
28 |
|
|
|
29 |
|
|
#ifndef __HIBERNATE_H__
|
30 |
|
|
#define __HIBERNATE_H__
|
31 |
|
|
|
32 |
|
|
//*****************************************************************************
|
33 |
|
|
//
|
34 |
|
|
// If building with a C++ compiler, make all of the definitions in this header
|
35 |
|
|
// have a C binding.
|
36 |
|
|
//
|
37 |
|
|
//*****************************************************************************
|
38 |
|
|
#ifdef __cplusplus
|
39 |
|
|
extern "C"
|
40 |
|
|
{
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
//*****************************************************************************
|
44 |
|
|
//
|
45 |
|
|
// Macros needed for selecting the clock source for HibernateClockSelect()
|
46 |
|
|
//
|
47 |
|
|
//*****************************************************************************
|
48 |
|
|
#define HIBERNATE_CLOCK_SEL_RAW 0x04
|
49 |
|
|
#define HIBERNATE_CLOCK_SEL_DIV128 0x00
|
50 |
|
|
|
51 |
|
|
//*****************************************************************************
|
52 |
|
|
//
|
53 |
|
|
// Macros need to configure wake events for HibernateWakeSet()
|
54 |
|
|
//
|
55 |
|
|
//*****************************************************************************
|
56 |
|
|
#define HIBERNATE_WAKE_PIN 0x10
|
57 |
|
|
#define HIBERNATE_WAKE_RTC 0x08
|
58 |
|
|
|
59 |
|
|
//*****************************************************************************
|
60 |
|
|
//
|
61 |
|
|
// Macros needed to configure low battery detect for HibernateLowBatSet()
|
62 |
|
|
//
|
63 |
|
|
//*****************************************************************************
|
64 |
|
|
#define HIBERNATE_LOW_BAT_DETECT 0x20
|
65 |
|
|
#define HIBERNATE_LOW_BAT_ABORT 0xA0
|
66 |
|
|
|
67 |
|
|
//*****************************************************************************
|
68 |
|
|
//
|
69 |
|
|
// Macros defining interrupt source bits for the interrupt functions.
|
70 |
|
|
//
|
71 |
|
|
//*****************************************************************************
|
72 |
|
|
#define HIBERNATE_INT_PIN_WAKE 0x08
|
73 |
|
|
#define HIBERNATE_INT_LOW_BAT 0x04
|
74 |
|
|
#define HIBERNATE_INT_RTC_MATCH_0 0x01
|
75 |
|
|
#define HIBERNATE_INT_RTC_MATCH_1 0x02
|
76 |
|
|
|
77 |
|
|
//*****************************************************************************
|
78 |
|
|
//
|
79 |
|
|
// API Function prototypes
|
80 |
|
|
//
|
81 |
|
|
//*****************************************************************************
|
82 |
|
|
extern void HibernateEnableExpClk(unsigned long ulHibClk);
|
83 |
|
|
extern void HibernateDisable(void);
|
84 |
|
|
extern void HibernateClockSelect(unsigned long ulClockInput);
|
85 |
|
|
extern void HibernateRTCEnable(void);
|
86 |
|
|
extern void HibernateRTCDisable(void);
|
87 |
|
|
extern void HibernateWakeSet(unsigned long ulWakeFlags);
|
88 |
|
|
extern unsigned long HibernateWakeGet(void);
|
89 |
|
|
extern void HibernateLowBatSet(unsigned long ulLowBatFlags);
|
90 |
|
|
extern unsigned long HibernateLowBatGet(void);
|
91 |
|
|
extern void HibernateRTCSet(unsigned long ulRTCValue);
|
92 |
|
|
extern unsigned long HibernateRTCGet(void);
|
93 |
|
|
extern void HibernateRTCMatch0Set(unsigned long ulMatch);
|
94 |
|
|
extern unsigned long HibernateRTCMatch0Get(void);
|
95 |
|
|
extern void HibernateRTCMatch1Set(unsigned long ulMatch);
|
96 |
|
|
extern unsigned long HibernateRTCMatch1Get(void);
|
97 |
|
|
extern void HibernateRTCTrimSet(unsigned long ulTrim);
|
98 |
|
|
extern unsigned long HibernateRTCTrimGet(void);
|
99 |
|
|
extern void HibernateDataSet(unsigned long *pulData, unsigned long ulCount);
|
100 |
|
|
extern void HibernateDataGet(unsigned long *pulData, unsigned long ulCount);
|
101 |
|
|
extern void HibernateRequest(void);
|
102 |
|
|
extern void HibernateIntEnable(unsigned long ulIntFlags);
|
103 |
|
|
extern void HibernateIntDisable(unsigned long ulIntFlags);
|
104 |
|
|
extern void HibernateIntRegister(void (*pfnHandler)(void));
|
105 |
|
|
extern void HibernateIntUnregister(void);
|
106 |
|
|
extern unsigned long HibernateIntStatus(tBoolean bMasked);
|
107 |
|
|
extern void HibernateIntClear(unsigned long ulIntFlags);
|
108 |
|
|
extern unsigned int HibernateIsActive(void);
|
109 |
|
|
|
110 |
|
|
//*****************************************************************************
|
111 |
|
|
//
|
112 |
|
|
// Several Hibernate module APIs have been renamed, with the original function
|
113 |
|
|
// name being deprecated. These defines provide backward compatibility.
|
114 |
|
|
//
|
115 |
|
|
//*****************************************************************************
|
116 |
|
|
#ifndef DEPRECATED
|
117 |
|
|
#include "sysctl.h"
|
118 |
|
|
#define HibernateEnable(a) \
|
119 |
|
|
HibernateEnableExpClk(a, SysCtlClockGet())
|
120 |
|
|
#endif
|
121 |
|
|
|
122 |
|
|
//*****************************************************************************
|
123 |
|
|
//
|
124 |
|
|
// Mark the end of the C bindings section for C++ compilers.
|
125 |
|
|
//
|
126 |
|
|
//*****************************************************************************
|
127 |
|
|
#ifdef __cplusplus
|
128 |
|
|
}
|
129 |
|
|
#endif
|
130 |
|
|
|
131 |
|
|
#endif // __HIBERNATE_H__
|