Kamcho Library 02.00.03  lib.kamcho.02.00.03.287
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  uint8_t RESERVED1[98325];
58  union {
59  struct {
60  uint8_t RESERVED:7;
61  uint8_t VSRAMEN:1;
62  };
63  uint8_t BYTE;
64  } PMUCONF2;
65 } PMU_SFRS_t;
66 
70 #define PMU_SFRS ((__IO PMU_SFRS_t *) (SDIO_BASE + 0x1))
71 
72 #define E_PMU_PMUBOR_BOUTVALUE_2V0 0
73 #define E_PMU_PMUBOR_BOUTVALUE_2V2 1
74 #define E_PMU_PMUBOR_BOUTVALUE_2V4 2
75 #define E_PMU_PMUBOR_BOUTVALUE_2V6 3
76 
77 #define E_PMU_POWER_MODE_LDO 0
78 #define E_PMU_POWER_MODE_BATTERY 1
79 
86 static __INLINE void f_PMU_WakeupTime(uint8_t mantissa, uint8_t exponent)
87 {
88  PMU_SFRS->WKPTIME.MANT = mantissa;
89  PMU_SFRS->WKPTIME.EXP = exponent;
90 }
91 
95 static __INLINE void f_PMU_HwReset( void )
96 {
97  PMU_SFRS->PMURST.HWRST = 1;
98 }
99 
103 static __INLINE void f_PMU_SwReset( void )
104 {
105  PMU_SFRS->PMURST.SWRST = 1;
106 }
107 
111 static __INLINE void f_PMU_SleepContinue(void)
112 {
113  PMU_SFRS->PMUCONF2.VSRAMEN = 1;
114  PMU_SFRS->PMURST.DLEEP = 1;
115 }
116 
120 static __INLINE void f_PMU_SleepReboot(void)
121 {
122  PMU_SFRS->PMUCONF2.VSRAMEN = 0;
123  PMU_SFRS->PMURST.DLEEP = 1;
124 }
125 
131 static __INLINE void f_PMU_SetPowerMode(uint8_t mode)
132 {
133  PMU_SFRS->PMUCONF.BATOP = mode;
134 }
135 
139 static __INLINE void f_PMU_EnableBrownOut(void)
140 {
141  PMU_SFRS->PMUBOR.BOREN = 1;
142 }
143 
147 static __INLINE void f_PMU_DisableBrownOut(void)
148 {
149  PMU_SFRS->PMUBOR.BOREN = 0;
150 }
151 
155 static __INLINE void f_PMU_EnableBrownOutReset(void)
156 {
157  PMU_SFRS->PMUBOR.BORRST = 1;
158 }
159 
163 static __INLINE void f_PMU_DisableBrownOutReset(void)
164 {
165  PMU_SFRS->PMUBOR.BORRST = 0;
166 }
167 
171 static __INLINE void f_PMU_EnableBrownOutInterrupt(void)
172 {
173  PMU_SFRS->PMUBOR.BORINT = 1;
174 }
175 
179 static __INLINE void f_PMU_DisableBrownOutInterrupt(void)
180 {
181  PMU_SFRS->PMUBOR.BORINT = 0;
182 }
183 
189 static __INLINE void f_PMU_SetBrownOutLevel(uint8_t level)
190 {
191  PMU_SFRS->PMUBOR.BOUTVALUE = level;
192 }
193 
194 #endif /* __PMU_SFRS_H__ */
static __INLINE void f_PMU_DisableBrownOutReset(void)
Disable brownout reset.
Definition: pmu_sfrs.h:163
static __INLINE void f_PMU_SleepReboot(void)
Put system in sleep mode and then reboot at wakeup.
Definition: pmu_sfrs.h:120
static __INLINE void f_PMU_WakeupTime(uint8_t mantissa, uint8_t exponent)
Set wake up timer.
Definition: pmu_sfrs.h:86
#define PMU_SFRS
The starting address of PMU SFRS.
Definition: pmu_sfrs.h:70
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:189
static __INLINE void f_PMU_HwReset(void)
Force a hardware reset.
Definition: pmu_sfrs.h:95
static __INLINE void f_PMU_DisableBrownOutInterrupt(void)
Disable brownout interrupt.
Definition: pmu_sfrs.h:179
static __INLINE void f_PMU_DisableBrownOut(void)
Disable brownout.
Definition: pmu_sfrs.h:147
static __INLINE void f_PMU_EnableBrownOut(void)
Enable brownout.
Definition: pmu_sfrs.h:139
static __INLINE void f_PMU_EnableBrownOutReset(void)
Enable brownout reset.
Definition: pmu_sfrs.h:155
static __INLINE void f_PMU_SleepContinue(void)
Put system in sleep mode and then continue at wakeup.
Definition: pmu_sfrs.h:111
static __INLINE void f_PMU_SetPowerMode(uint8_t mode)
Set system power mode.
Definition: pmu_sfrs.h:131
static __INLINE void f_PMU_SwReset(void)
Force a software reset.
Definition: pmu_sfrs.h:103
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:171