Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
pmu_sfrs.h
Go to the documentation of this file.
1 
12 #ifndef __PMU_SFRS_H__
13 #define __PMU_SFRS_H__
14 
18 typedef struct {
19  union {
20  struct {
21  uint8_t PORF:1;
22  uint8_t BROUT:1;
23  uint8_t RESERVED:3;
24  uint8_t DLEEP:1;
25  uint8_t SWRST:1;
26  uint8_t HWRST:1;
27  };
28  uint8_t BYTE;
29  } PMURST;
30  union {
31  struct {
32  uint8_t BOUTVALUE:2;
33  uint8_t BORINT:1;
34  uint8_t BORRST:1;
35  uint8_t RESERVED:3;
36  uint8_t BOREN:1;
37  };
38  uint8_t BYTE;
39  } PMUBOR;
40  uint8_t RESERVED0;
41  union {
42  struct {
43  uint8_t EXP:4;
44  uint8_t MANT:4;
45  };
46  uint8_t BYTE;
47  } WKPTIME;
48  union {
49  struct {
50  uint8_t RTSELB:3;
51  uint8_t RTSELA:3;
52  uint8_t BATOP:1;
53  uint8_t SERFAST:1;
54  };
55  uint8_t BYTE;
56  } PMUCONF;
57 } PMU_SFRS_t;
58 
62 #define PMU_SFRS ((__IO PMU_SFRS_t *) (SDIO_BASE + 0x1))
63 
64 #define E_PMU_PMUBOR_BOUTVALUE_2V0 0
65 #define E_PMU_PMUBOR_BOUTVALUE_2V2 1
66 #define E_PMU_PMUBOR_BOUTVALUE_2V4 2
67 #define E_PMU_PMUBOR_BOUTVALUE_2V6 3
68 
69 #define E_PMU_POWER_MODE_LDO 0
70 #define E_PMU_POWER_MODE_BATTERY 1
71 
78 static __INLINE void f_PMU_WakeupTime(uint8_t mantissa, uint8_t exponent)
79 {
80  PMU_SFRS->WKPTIME.MANT = mantissa;
81  PMU_SFRS->WKPTIME.EXP = exponent;
82 }
83 
87 static __INLINE void f_PMU_HwReset( void )
88 {
89  PMU_SFRS->PMURST.HWRST = 1;
90 }
91 
95 static __INLINE void f_PMU_SwReset( void )
96 {
97  PMU_SFRS->PMURST.SWRST = 1;
98 }
99 
103 static __INLINE void f_PMU_SleepContinue(void)
104 {
105  PMU_SFRS->PMURST.DLEEP = 1;
106 }
107 
111 static __INLINE void f_PMU_SleepReboot(void)
112 {
113  PMU_SFRS->PMURST.DLEEP = 1;
114 }
115 
121 static __INLINE void f_PMU_SetPowerMode(uint8_t mode)
122 {
123  PMU_SFRS->PMUCONF.BATOP = mode;
124 }
125 
129 static __INLINE void f_PMU_EnableBrownOut(void)
130 {
131  PMU_SFRS->PMUBOR.BOREN = 1;
132 }
133 
137 static __INLINE void f_PMU_DisableBrownOut(void)
138 {
139  PMU_SFRS->PMUBOR.BOREN = 0;
140 }
141 
145 static __INLINE void f_PMU_EnableBrownOutReset(void)
146 {
147  PMU_SFRS->PMUBOR.BORRST = 1;
148 }
149 
153 static __INLINE void f_PMU_DisableBrownOutReset(void)
154 {
155  PMU_SFRS->PMUBOR.BORRST = 0;
156 }
157 
161 static __INLINE void f_PMU_EnableBrownOutInterrupt(void)
162 {
163  PMU_SFRS->PMUBOR.BORINT = 1;
164 }
165 
169 static __INLINE void f_PMU_DisableBrownOutInterrupt(void)
170 {
171  PMU_SFRS->PMUBOR.BORINT = 0;
172 }
173 
179 static __INLINE void f_PMU_SetBrownOutLevel(uint8_t level)
180 {
181  PMU_SFRS->PMUBOR.BOUTVALUE = level;
182 }
183 
184 #endif /* __PMU_SFRS_H__ */
static __INLINE void f_PMU_DisableBrownOutReset(void)
Disable brownout reset.
Definition: pmu_sfrs.h:153
static __INLINE void f_PMU_SleepReboot(void)
Put system in sleep mode and then reboot at wakeup.
Definition: pmu_sfrs.h:111
static __INLINE void f_PMU_WakeupTime(uint8_t mantissa, uint8_t exponent)
Set wake up timer.
Definition: pmu_sfrs.h:78
#define PMU_SFRS
The starting address of PMU SFRS.
Definition: pmu_sfrs.h:62
uint8_t BYTE
Definition: pmu_sfrs.h:28
static __INLINE void f_PMU_SetBrownOutLevel(uint8_t level)
Set brown out voltage level.
Definition: pmu_sfrs.h:179
static __INLINE void f_PMU_HwReset(void)
Force a hardware reset.
Definition: pmu_sfrs.h:87
static __INLINE void f_PMU_DisableBrownOutInterrupt(void)
Disable brownout interrupt.
Definition: pmu_sfrs.h:169
static __INLINE void f_PMU_DisableBrownOut(void)
Disable brownout.
Definition: pmu_sfrs.h:137
static __INLINE void f_PMU_EnableBrownOut(void)
Enable brownout.
Definition: pmu_sfrs.h:129
static __INLINE void f_PMU_EnableBrownOutReset(void)
Enable brownout reset.
Definition: pmu_sfrs.h:145
static __INLINE void f_PMU_SleepContinue(void)
Put system in sleep mode and then continue at wakeup.
Definition: pmu_sfrs.h:103
static __INLINE void f_PMU_SetPowerMode(uint8_t mode)
Set system power mode.
Definition: pmu_sfrs.h:121
static __INLINE void f_PMU_SwReset(void)
Force a software reset.
Definition: pmu_sfrs.h:95
A structure to represent Special Function Registers for PMU.
Definition: pmu_sfrs.h:18
uint8_t RESERVED0
Definition: pmu_sfrs.h:40
static __INLINE void f_PMU_EnableBrownOutInterrupt(void)
Enable brownout interrupt.
Definition: pmu_sfrs.h:161