HPM SDK
HPMicro Software Development Kit
hpm_bcfg_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 
9 #ifndef HPM_BCFG_H
10 #define HPM_BCFG_H
11 
12 typedef struct {
13  __RW uint32_t VBG_CFG; /* 0x0: Bandgap config */
14  __RW uint32_t LDO_CFG; /* 0x4: LDO config */
15  __RW uint32_t IRC32K_CFG; /* 0x8: On-chip 32k oscillator config */
16  __RW uint32_t XTAL32K_CFG; /* 0xC: XTAL 32K config */
17  __RW uint32_t CLK_CFG; /* 0x10: Clock config */
18 } BCFG_Type;
19 
20 
21 /* Bitfield definition for register: VBG_CFG */
22 /*
23  * VBG_TRIMMED (RW)
24  *
25  * Bandgap trim happened, this bit set by hardware after trim value loaded, and stop load, write 0 will clear this bit and reload trim value
26  * 0: bandgap is not trimmed
27  * 1: bandgap is trimmed
28  */
29 #define BCFG_VBG_CFG_VBG_TRIMMED_MASK (0x80000000UL)
30 #define BCFG_VBG_CFG_VBG_TRIMMED_SHIFT (31U)
31 #define BCFG_VBG_CFG_VBG_TRIMMED_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_VBG_TRIMMED_SHIFT) & BCFG_VBG_CFG_VBG_TRIMMED_MASK)
32 #define BCFG_VBG_CFG_VBG_TRIMMED_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_VBG_TRIMMED_MASK) >> BCFG_VBG_CFG_VBG_TRIMMED_SHIFT)
33 
34 /*
35  * LP_MODE (RW)
36  *
37  * Bandgap works in low power mode
38  * 0: not in low power mode
39  * 1: bandgap work in low power mode
40  */
41 #define BCFG_VBG_CFG_LP_MODE_MASK (0x2000000UL)
42 #define BCFG_VBG_CFG_LP_MODE_SHIFT (25U)
43 #define BCFG_VBG_CFG_LP_MODE_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_LP_MODE_SHIFT) & BCFG_VBG_CFG_LP_MODE_MASK)
44 #define BCFG_VBG_CFG_LP_MODE_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_LP_MODE_MASK) >> BCFG_VBG_CFG_LP_MODE_SHIFT)
45 
46 /*
47  * POWER_SAVE (RW)
48  *
49  * Bandgap works in power save mode
50  * 0: not in power save mode
51  * 1: bandgap work in power save mode
52  */
53 #define BCFG_VBG_CFG_POWER_SAVE_MASK (0x1000000UL)
54 #define BCFG_VBG_CFG_POWER_SAVE_SHIFT (24U)
55 #define BCFG_VBG_CFG_POWER_SAVE_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_POWER_SAVE_SHIFT) & BCFG_VBG_CFG_POWER_SAVE_MASK)
56 #define BCFG_VBG_CFG_POWER_SAVE_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_POWER_SAVE_MASK) >> BCFG_VBG_CFG_POWER_SAVE_SHIFT)
57 
58 /*
59  * VBG_1P0 (RW)
60  *
61  * Bandgap 1.0V output trim
62  */
63 #define BCFG_VBG_CFG_VBG_1P0_MASK (0x1F0000UL)
64 #define BCFG_VBG_CFG_VBG_1P0_SHIFT (16U)
65 #define BCFG_VBG_CFG_VBG_1P0_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_VBG_1P0_SHIFT) & BCFG_VBG_CFG_VBG_1P0_MASK)
66 #define BCFG_VBG_CFG_VBG_1P0_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_VBG_1P0_MASK) >> BCFG_VBG_CFG_VBG_1P0_SHIFT)
67 
68 /*
69  * VBG_P65 (RW)
70  *
71  * Bandgap 0.65V output trim
72  */
73 #define BCFG_VBG_CFG_VBG_P65_MASK (0x1F00U)
74 #define BCFG_VBG_CFG_VBG_P65_SHIFT (8U)
75 #define BCFG_VBG_CFG_VBG_P65_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_VBG_P65_SHIFT) & BCFG_VBG_CFG_VBG_P65_MASK)
76 #define BCFG_VBG_CFG_VBG_P65_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_VBG_P65_MASK) >> BCFG_VBG_CFG_VBG_P65_SHIFT)
77 
78 /*
79  * VBG_P50 (RW)
80  *
81  * Bandgap 0.50V output trim
82  */
83 #define BCFG_VBG_CFG_VBG_P50_MASK (0x1FU)
84 #define BCFG_VBG_CFG_VBG_P50_SHIFT (0U)
85 #define BCFG_VBG_CFG_VBG_P50_SET(x) (((uint32_t)(x) << BCFG_VBG_CFG_VBG_P50_SHIFT) & BCFG_VBG_CFG_VBG_P50_MASK)
86 #define BCFG_VBG_CFG_VBG_P50_GET(x) (((uint32_t)(x) & BCFG_VBG_CFG_VBG_P50_MASK) >> BCFG_VBG_CFG_VBG_P50_SHIFT)
87 
88 /* Bitfield definition for register: LDO_CFG */
89 /*
90  * RES_TRIM (RW)
91  *
92  * Resistor trim
93  */
94 #define BCFG_LDO_CFG_RES_TRIM_MASK (0x3000000UL)
95 #define BCFG_LDO_CFG_RES_TRIM_SHIFT (24U)
96 #define BCFG_LDO_CFG_RES_TRIM_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_RES_TRIM_SHIFT) & BCFG_LDO_CFG_RES_TRIM_MASK)
97 #define BCFG_LDO_CFG_RES_TRIM_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_RES_TRIM_MASK) >> BCFG_LDO_CFG_RES_TRIM_SHIFT)
98 
99 /*
100  * CP_TRIM (RW)
101  *
102  * Capacitor trim
103  */
104 #define BCFG_LDO_CFG_CP_TRIM_MASK (0x300000UL)
105 #define BCFG_LDO_CFG_CP_TRIM_SHIFT (20U)
106 #define BCFG_LDO_CFG_CP_TRIM_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_CP_TRIM_SHIFT) & BCFG_LDO_CFG_CP_TRIM_MASK)
107 #define BCFG_LDO_CFG_CP_TRIM_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_CP_TRIM_MASK) >> BCFG_LDO_CFG_CP_TRIM_SHIFT)
108 
109 /*
110  * EN_SL (RW)
111  *
112  * enable selfload, this bit helps improve LDO performance when current less than 200nA
113  * 0: self load disabled
114  * 1: selfload enabled
115  */
116 #define BCFG_LDO_CFG_EN_SL_MASK (0x40000UL)
117 #define BCFG_LDO_CFG_EN_SL_SHIFT (18U)
118 #define BCFG_LDO_CFG_EN_SL_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_EN_SL_SHIFT) & BCFG_LDO_CFG_EN_SL_MASK)
119 #define BCFG_LDO_CFG_EN_SL_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_EN_SL_MASK) >> BCFG_LDO_CFG_EN_SL_SHIFT)
120 
121 /*
122  * DIS_PD (RW)
123  *
124  * disable pull down resistor, enable pull down may lead to more power but better response
125  * 0: pulldown resistor enabled
126  * 1: pulldown resistor disabled
127  */
128 #define BCFG_LDO_CFG_DIS_PD_MASK (0x20000UL)
129 #define BCFG_LDO_CFG_DIS_PD_SHIFT (17U)
130 #define BCFG_LDO_CFG_DIS_PD_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_DIS_PD_SHIFT) & BCFG_LDO_CFG_DIS_PD_MASK)
131 #define BCFG_LDO_CFG_DIS_PD_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_DIS_PD_MASK) >> BCFG_LDO_CFG_DIS_PD_SHIFT)
132 
133 /*
134  * ENABLE (RW)
135  *
136  * LDO enable
137  * 0: LDO is disabled
138  * 1: LDO is enabled
139  */
140 #define BCFG_LDO_CFG_ENABLE_MASK (0x10000UL)
141 #define BCFG_LDO_CFG_ENABLE_SHIFT (16U)
142 #define BCFG_LDO_CFG_ENABLE_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_ENABLE_SHIFT) & BCFG_LDO_CFG_ENABLE_MASK)
143 #define BCFG_LDO_CFG_ENABLE_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_ENABLE_MASK) >> BCFG_LDO_CFG_ENABLE_SHIFT)
144 
145 /*
146  * VOLT (RW)
147  *
148  * LDO voltage setting in mV, valid range through 600mV to 1100mV, step 20mV. Hardware select voltage no less than target if not on valid steps, with maximum 1100mV.
149  * 600: 600mV
150  * 620: 620mV
151  * . . .
152  * 1100:1100mV
153  */
154 #define BCFG_LDO_CFG_VOLT_MASK (0xFFFU)
155 #define BCFG_LDO_CFG_VOLT_SHIFT (0U)
156 #define BCFG_LDO_CFG_VOLT_SET(x) (((uint32_t)(x) << BCFG_LDO_CFG_VOLT_SHIFT) & BCFG_LDO_CFG_VOLT_MASK)
157 #define BCFG_LDO_CFG_VOLT_GET(x) (((uint32_t)(x) & BCFG_LDO_CFG_VOLT_MASK) >> BCFG_LDO_CFG_VOLT_SHIFT)
158 
159 /* Bitfield definition for register: IRC32K_CFG */
160 /*
161  * IRC_TRIMMED (RW)
162  *
163  * IRC32K trim happened, this bit set by hardware after trim value loaded, and stop load, write 0 will clear this bit and reload trim value
164  * 0: irc is not trimmed
165  * 1: irc is trimmed
166  */
167 #define BCFG_IRC32K_CFG_IRC_TRIMMED_MASK (0x80000000UL)
168 #define BCFG_IRC32K_CFG_IRC_TRIMMED_SHIFT (31U)
169 #define BCFG_IRC32K_CFG_IRC_TRIMMED_SET(x) (((uint32_t)(x) << BCFG_IRC32K_CFG_IRC_TRIMMED_SHIFT) & BCFG_IRC32K_CFG_IRC_TRIMMED_MASK)
170 #define BCFG_IRC32K_CFG_IRC_TRIMMED_GET(x) (((uint32_t)(x) & BCFG_IRC32K_CFG_IRC_TRIMMED_MASK) >> BCFG_IRC32K_CFG_IRC_TRIMMED_SHIFT)
171 
172 /*
173  * CAPEX7_TRIM (RW)
174  *
175  * IRC32K bit 7
176  */
177 #define BCFG_IRC32K_CFG_CAPEX7_TRIM_MASK (0x800000UL)
178 #define BCFG_IRC32K_CFG_CAPEX7_TRIM_SHIFT (23U)
179 #define BCFG_IRC32K_CFG_CAPEX7_TRIM_SET(x) (((uint32_t)(x) << BCFG_IRC32K_CFG_CAPEX7_TRIM_SHIFT) & BCFG_IRC32K_CFG_CAPEX7_TRIM_MASK)
180 #define BCFG_IRC32K_CFG_CAPEX7_TRIM_GET(x) (((uint32_t)(x) & BCFG_IRC32K_CFG_CAPEX7_TRIM_MASK) >> BCFG_IRC32K_CFG_CAPEX7_TRIM_SHIFT)
181 
182 /*
183  * CAPEX6_TRIM (RW)
184  *
185  * IRC32K bit 6
186  */
187 #define BCFG_IRC32K_CFG_CAPEX6_TRIM_MASK (0x400000UL)
188 #define BCFG_IRC32K_CFG_CAPEX6_TRIM_SHIFT (22U)
189 #define BCFG_IRC32K_CFG_CAPEX6_TRIM_SET(x) (((uint32_t)(x) << BCFG_IRC32K_CFG_CAPEX6_TRIM_SHIFT) & BCFG_IRC32K_CFG_CAPEX6_TRIM_MASK)
190 #define BCFG_IRC32K_CFG_CAPEX6_TRIM_GET(x) (((uint32_t)(x) & BCFG_IRC32K_CFG_CAPEX6_TRIM_MASK) >> BCFG_IRC32K_CFG_CAPEX6_TRIM_SHIFT)
191 
192 /*
193  * CAP_TRIM (RW)
194  *
195  * capacitor trim bits
196  */
197 #define BCFG_IRC32K_CFG_CAP_TRIM_MASK (0x1FFU)
198 #define BCFG_IRC32K_CFG_CAP_TRIM_SHIFT (0U)
199 #define BCFG_IRC32K_CFG_CAP_TRIM_SET(x) (((uint32_t)(x) << BCFG_IRC32K_CFG_CAP_TRIM_SHIFT) & BCFG_IRC32K_CFG_CAP_TRIM_MASK)
200 #define BCFG_IRC32K_CFG_CAP_TRIM_GET(x) (((uint32_t)(x) & BCFG_IRC32K_CFG_CAP_TRIM_MASK) >> BCFG_IRC32K_CFG_CAP_TRIM_SHIFT)
201 
202 /* Bitfield definition for register: XTAL32K_CFG */
203 /*
204  * HYST_EN (RW)
205  *
206  * crystal 32k hysteres enable
207  */
208 #define BCFG_XTAL32K_CFG_HYST_EN_MASK (0x1000U)
209 #define BCFG_XTAL32K_CFG_HYST_EN_SHIFT (12U)
210 #define BCFG_XTAL32K_CFG_HYST_EN_SET(x) (((uint32_t)(x) << BCFG_XTAL32K_CFG_HYST_EN_SHIFT) & BCFG_XTAL32K_CFG_HYST_EN_MASK)
211 #define BCFG_XTAL32K_CFG_HYST_EN_GET(x) (((uint32_t)(x) & BCFG_XTAL32K_CFG_HYST_EN_MASK) >> BCFG_XTAL32K_CFG_HYST_EN_SHIFT)
212 
213 /*
214  * GMSEL (RW)
215  *
216  * crystal 32k gm selection
217  */
218 #define BCFG_XTAL32K_CFG_GMSEL_MASK (0x300U)
219 #define BCFG_XTAL32K_CFG_GMSEL_SHIFT (8U)
220 #define BCFG_XTAL32K_CFG_GMSEL_SET(x) (((uint32_t)(x) << BCFG_XTAL32K_CFG_GMSEL_SHIFT) & BCFG_XTAL32K_CFG_GMSEL_MASK)
221 #define BCFG_XTAL32K_CFG_GMSEL_GET(x) (((uint32_t)(x) & BCFG_XTAL32K_CFG_GMSEL_MASK) >> BCFG_XTAL32K_CFG_GMSEL_SHIFT)
222 
223 /*
224  * CFG (RW)
225  *
226  * crystal 32k config
227  */
228 #define BCFG_XTAL32K_CFG_CFG_MASK (0x10U)
229 #define BCFG_XTAL32K_CFG_CFG_SHIFT (4U)
230 #define BCFG_XTAL32K_CFG_CFG_SET(x) (((uint32_t)(x) << BCFG_XTAL32K_CFG_CFG_SHIFT) & BCFG_XTAL32K_CFG_CFG_MASK)
231 #define BCFG_XTAL32K_CFG_CFG_GET(x) (((uint32_t)(x) & BCFG_XTAL32K_CFG_CFG_MASK) >> BCFG_XTAL32K_CFG_CFG_SHIFT)
232 
233 /*
234  * AMP (RW)
235  *
236  * crystal 32k amplifier
237  */
238 #define BCFG_XTAL32K_CFG_AMP_MASK (0x3U)
239 #define BCFG_XTAL32K_CFG_AMP_SHIFT (0U)
240 #define BCFG_XTAL32K_CFG_AMP_SET(x) (((uint32_t)(x) << BCFG_XTAL32K_CFG_AMP_SHIFT) & BCFG_XTAL32K_CFG_AMP_MASK)
241 #define BCFG_XTAL32K_CFG_AMP_GET(x) (((uint32_t)(x) & BCFG_XTAL32K_CFG_AMP_MASK) >> BCFG_XTAL32K_CFG_AMP_SHIFT)
242 
243 /* Bitfield definition for register: CLK_CFG */
244 /*
245  * XTAL_SEL (RO)
246  *
247  * crystal selected
248  */
249 #define BCFG_CLK_CFG_XTAL_SEL_MASK (0x10000000UL)
250 #define BCFG_CLK_CFG_XTAL_SEL_SHIFT (28U)
251 #define BCFG_CLK_CFG_XTAL_SEL_GET(x) (((uint32_t)(x) & BCFG_CLK_CFG_XTAL_SEL_MASK) >> BCFG_CLK_CFG_XTAL_SEL_SHIFT)
252 
253 /*
254  * KEEP_IRC (RW)
255  *
256  * force irc32k run
257  */
258 #define BCFG_CLK_CFG_KEEP_IRC_MASK (0x10000UL)
259 #define BCFG_CLK_CFG_KEEP_IRC_SHIFT (16U)
260 #define BCFG_CLK_CFG_KEEP_IRC_SET(x) (((uint32_t)(x) << BCFG_CLK_CFG_KEEP_IRC_SHIFT) & BCFG_CLK_CFG_KEEP_IRC_MASK)
261 #define BCFG_CLK_CFG_KEEP_IRC_GET(x) (((uint32_t)(x) & BCFG_CLK_CFG_KEEP_IRC_MASK) >> BCFG_CLK_CFG_KEEP_IRC_SHIFT)
262 
263 /*
264  * FORCE_XTAL (RW)
265  *
266  * force switch to crystal
267  */
268 #define BCFG_CLK_CFG_FORCE_XTAL_MASK (0x10U)
269 #define BCFG_CLK_CFG_FORCE_XTAL_SHIFT (4U)
270 #define BCFG_CLK_CFG_FORCE_XTAL_SET(x) (((uint32_t)(x) << BCFG_CLK_CFG_FORCE_XTAL_SHIFT) & BCFG_CLK_CFG_FORCE_XTAL_MASK)
271 #define BCFG_CLK_CFG_FORCE_XTAL_GET(x) (((uint32_t)(x) & BCFG_CLK_CFG_FORCE_XTAL_MASK) >> BCFG_CLK_CFG_FORCE_XTAL_SHIFT)
272 
273 
274 
275 
276 #endif /* HPM_BCFG_H */
Definition: hpm_bcfg_regs.h:12