1 /**********************************************************************************
2  *
3  * @file    reg_cmu.h
4  * @brief   CMU Head File
5  *
6  * @date    14 Dec. 2022
7  * @author  AE Team
8  * @note
9  *          Change Logs:
10  *          Date            Author          Notes
11  *          14 Dec. 2022    Lisq            the first version
12  *
13  * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved.
14  *
15  * SPDX-License-Identifier: Apache-2.0
16  *
17  * Licensed under the Apache License, Version 2.0 (the License); you may
18  * not use this file except in compliance with the License.
19  * You may obtain a copy of the License at
20  *
21  * www.apache.org/licenses/LICENSE-2.0
22  *
23  * Unless required by applicable law or agreed to in writing, software
24  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
25  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  * See the License for the specific language governing permissions and
27  * limitations under the License.
28  *
29  **********************************************************************************
30  */
31 
32 #ifndef __REG_CMU_H__
33 #define __REG_CMU_H__
34 
35 /****************** Bit definition for CMU_CSR register ************************/
36 
37 #define CMU_CSR_CFT_RDYN_POS    25U
38 #define CMU_CSR_CFT_RDYN_MSK    BIT(CMU_CSR_CFT_RDYN_POS)
39 
40 #define CMU_CSR_CFT_STU_POS 24U
41 #define CMU_CSR_CFT_STU_MSK BIT(CMU_CSR_CFT_STU_POS)
42 
43 #define CMU_CSR_CFT_CMD_POSS    16U
44 #define CMU_CSR_CFT_CMD_POSE    23U
45 #define CMU_CSR_CFT_CMD_MSK BITS(CMU_CSR_CFT_CMD_POSS,CMU_CSR_CFT_CMD_POSE)
46 
47 #define CMU_CSR_SYS_RDYN_POS    12U
48 #define CMU_CSR_SYS_RDYN_MSK    BIT(CMU_CSR_SYS_RDYN_POS)
49 
50 #define CMU_CSR_SYS_STU_POSS    8U
51 #define CMU_CSR_SYS_STU_POSE    10U
52 #define CMU_CSR_SYS_STU_MSK BITS(CMU_CSR_SYS_STU_POSS,CMU_CSR_SYS_STU_POSE)
53 
54 #define CMU_CSR_SYS_CMD_POSS    0U
55 #define CMU_CSR_SYS_CMD_POSE    2U
56 #define CMU_CSR_SYS_CMD_MSK BITS(CMU_CSR_SYS_CMD_POSS,CMU_CSR_SYS_CMD_POSE)
57 
58 /****************** Bit definition for CMU_CFGR register ************************/
59 
60 #define CMU_CFGR_PCLKDIV_POSS   16U
61 #define CMU_CFGR_PCLKDIV_POSE   19U
62 #define CMU_CFGR_PCLKDIV_MSK    BITS(CMU_CFGR_PCLKDIV_POSS,CMU_CFGR_PCLKDIV_POSE)
63 
64 #define CMU_CFGR_SYSDIV_POSS    12U
65 #define CMU_CFGR_SYSDIV_POSE    15U
66 #define CMU_CFGR_SYSDIV_MSK BITS(CMU_CFGR_SYSDIV_POSS,CMU_CFGR_SYSDIV_POSE)
67 
68 #define CMU_CFGR_USBSW_POS  4U
69 #define CMU_CFGR_USBSW_MSK  BIT(CMU_CFGR_USBSW_POS)
70 
71 #define CMU_CFGR_I2SSW_POS  0U
72 #define CMU_CFGR_I2SSW_MSK  BIT(CMU_CFGR_I2SSW_POS)
73 
74 /****************** Bit definition for CMU_CLKENR register ************************/
75 
76 #define CMU_CLKENR_HOSCFLYBPS_POS   10U
77 #define CMU_CLKENR_HOSCFLYBPS_MSK   BIT(CMU_CLKENR_HOSCFLYBPS_POS)
78 
79 #define CMU_CLKENR_HOSCBPS_POS  9U
80 #define CMU_CLKENR_HOSCBPS_MSK  BIT(CMU_CLKENR_HOSCBPS_POS)
81 
82 #define CMU_CLKENR_HOSC32K_POS  8U
83 #define CMU_CLKENR_HOSC32K_MSK  BIT(CMU_CLKENR_HOSC32K_POS)
84 
85 #define CMU_CLKENR_USBCKEN_POS  7U
86 #define CMU_CLKENR_USBCKEN_MSK  BIT(CMU_CLKENR_USBCKEN_POS)
87 
88 #define CMU_CLKENR_I2SCKEN_POS  6U
89 #define CMU_CLKENR_I2SCKEN_MSK  BIT(CMU_CLKENR_I2SCKEN_POS)
90 
91 #define CMU_CLKENR_HRC48MFLYBPS_POS 4U
92 #define CMU_CLKENR_HRC48MFLYBPS_MSK BIT(CMU_CLKENR_HRC48MFLYBPS_POS)
93 
94 #define CMU_CLKENR_PLLEN_POS    3U
95 #define CMU_CLKENR_PLLEN_MSK    BIT(CMU_CLKENR_PLLEN_POS)
96 
97 #define CMU_CLKENR_HRC4MEN_POS  2U
98 #define CMU_CLKENR_HRC4MEN_MSK  BIT(CMU_CLKENR_HRC4MEN_POS)
99 
100 #define CMU_CLKENR_HRC48MEN_POS 1U
101 #define CMU_CLKENR_HRC48MEN_MSK BIT(CMU_CLKENR_HRC48MEN_POS)
102 
103 #define CMU_CLKENR_HOSCEN_POS   0U
104 #define CMU_CLKENR_HOSCEN_MSK   BIT(CMU_CLKENR_HOSCEN_POS)
105 
106 /****************** Bit definition for CMU_CLKSR register ************************/
107 
108 #define CMU_CLKSR_PLLRDY_POS    24U
109 #define CMU_CLKSR_PLLRDY_MSK    BIT(CMU_CLKSR_PLLRDY_POS)
110 
111 #define CMU_CLKSR_LRCRDY_POS    19U
112 #define CMU_CLKSR_LRCRDY_MSK    BIT(CMU_CLKSR_LRCRDY_POS)
113 
114 #define CMU_CLKSR_HRC48MRDY_POS 18U
115 #define CMU_CLKSR_HRC48MRDY_MSK BIT(CMU_CLKSR_HRC48MRDY_POS)
116 
117 #define CMU_CLKSR_HRC4MRDY_POS  17U
118 #define CMU_CLKSR_HRC4MRDY_MSK  BIT(CMU_CLKSR_HRC4MRDY_POS)
119 
120 #define CMU_CLKSR_HOSCRDY_POS   16U
121 #define CMU_CLKSR_HOSCRDY_MSK   BIT(CMU_CLKSR_HOSCRDY_POS)
122 
123 #define CMU_CLKSR_HRC48MACT_POS 3U
124 #define CMU_CLKSR_HRC48MACT_MSK BIT(CMU_CLKSR_HRC48MACT_POS)
125 
126 #define CMU_CLKSR_HRC4MACT_POS  2U
127 #define CMU_CLKSR_HRC4MACT_MSK  BIT(CMU_CLKSR_HRC4MACT_POS)
128 
129 #define CMU_CLKSR_PLLACT_POS    1U
130 #define CMU_CLKSR_PLLACT_MSK    BIT(CMU_CLKSR_PLLACT_POS)
131 
132 #define CMU_CLKSR_HOSCACT_POS   0U
133 #define CMU_CLKSR_HOSCACT_MSK   BIT(CMU_CLKSR_HOSCACT_POS)
134 
135 /****************** Bit definition for CMU_PLLCFG register ************************/
136 
137 #define CMU_PLLCFG_REFS_POSS    2U
138 #define CMU_PLLCFG_REFS_POSE    3U
139 #define CMU_PLLCFG_REFS_MSK BITS(CMU_PLLCFG_REFS_POSS,CMU_PLLCFG_REFS_POSE)
140 
141 #define CMU_PLLCFG_CLKOS_POSS   0U
142 #define CMU_PLLCFG_CLKOS_POSE   1U
143 #define CMU_PLLCFG_CLKOS_MSK    BITS(CMU_PLLCFG_CLKOS_POSS,CMU_PLLCFG_CLKOS_POSE)
144 
145 /****************** Bit definition for CMU_HOSCCFG register ************************/
146 
147 #define CMU_HOSCCFG_FREQ_POSS   0U
148 #define CMU_HOSCCFG_FREQ_POSE   2U
149 #define CMU_HOSCCFG_FREQ_MSK    BITS(CMU_HOSCCFG_FREQ_POSS,CMU_HOSCCFG_FREQ_POSE)
150 
151 /****************** Bit definition for CMU_HOSMCR register ************************/
152 
153 #define CMU_HOSMCR_NMIE_POS 20U
154 #define CMU_HOSMCR_NMIE_MSK BIT(CMU_HOSMCR_NMIE_POS)
155 
156 #define CMU_HOSMCR_STPIF_POS    19U
157 #define CMU_HOSMCR_STPIF_MSK    BIT(CMU_HOSMCR_STPIF_POS)
158 
159 #define CMU_HOSMCR_STRIF_POS    18U
160 #define CMU_HOSMCR_STRIF_MSK    BIT(CMU_HOSMCR_STRIF_POS)
161 
162 #define CMU_HOSMCR_STPIE_POS    17U
163 #define CMU_HOSMCR_STPIE_MSK    BIT(CMU_HOSMCR_STPIE_POS)
164 
165 #define CMU_HOSMCR_STRIE_POS    16U
166 #define CMU_HOSMCR_STRIE_MSK    BIT(CMU_HOSMCR_STRIE_POS)
167 
168 #define CMU_HOSMCR_FRQS_POSS    8U
169 #define CMU_HOSMCR_FRQS_POSE    10U
170 #define CMU_HOSMCR_FRQS_MSK     BITS(CMU_HOSMCR_FRQS_POSS,CMU_HOSMCR_FRQS_POSE)
171 
172 #define CMU_HOSMCR_FLAG_POS     1U
173 #define CMU_HOSMCR_FLAG_MSK     BIT(CMU_HOSMCR_FLAG_POS)
174 
175 #define CMU_HOSMCR_EN_POS       0U
176 #define CMU_HOSMCR_EN_MSK       BIT(CMU_HOSMCR_EN_POS)
177 
178 /****************** Bit definition for CMU_PULMCR register ************************/
179 
180 #define CMU_PULMCR_NMIE_POS 20U
181 #define CMU_PULMCR_NMIE_MSK BIT(CMU_PULMCR_NMIE_POS)
182 
183 #define CMU_PULMCR_ULKIF_POS    19U
184 #define CMU_PULMCR_ULKIF_MSK    BIT(CMU_PULMCR_ULKIF_POS)
185 
186 #define CMU_PULMCR_LCKIF_POS    18U
187 #define CMU_PULMCR_LCKIF_MSK    BIT(CMU_PULMCR_LCKIF_POS)
188 
189 #define CMU_PULMCR_ULKIE_POS    17U
190 #define CMU_PULMCR_ULKIE_MSK    BIT(CMU_PULMCR_ULKIE_POS)
191 
192 #define CMU_PULMCR_LCKIE_POS    16U
193 #define CMU_PULMCR_LCKIE_MSK    BIT(CMU_PULMCR_LCKIE_POS)
194 
195 #define CMU_PULMCR_MODE_POSS    8U
196 #define CMU_PULMCR_MODE_POSE    9U
197 #define CMU_PULMCR_MODE_MSK     BITS(CMU_PULMCR_MODE_POSS,CMU_PULMCR_MODE_POSE)
198 
199 #define CMU_PULMCR_CLKS_POS     1U
200 #define CMU_PULMCR_CLKS_MSK     BIT(CMU_PULMCR_CLKS_POS)
201 
202 #define CMU_PULMCR_EN_POS       0U
203 #define CMU_PULMCR_EN_MSK       BIT(CMU_PULMCR_EN_POS)
204 
205 /****************** Bit definition for CMU_CLKOCR register ************************/
206 
207 #define CMU_CLKOCR_LSCOS_POSS   24U
208 #define CMU_CLKOCR_LSCOS_POSE   25U
209 #define CMU_CLKOCR_LSCOS_MSK    BITS(CMU_CLKOCR_LSCOS_POSS,CMU_CLKOCR_LSCOS_POSE)
210 
211 #define CMU_CLKOCR_LSCOEN_POS   16U
212 #define CMU_CLKOCR_LSCOEN_MSK   BIT(CMU_CLKOCR_LSCOEN_POS)
213 
214 #define CMU_CLKOCR_HSCODIV_POSS 12U
215 #define CMU_CLKOCR_HSCODIV_POSE 14U
216 #define CMU_CLKOCR_HSCODIV_MSK  BITS(CMU_CLKOCR_HSCODIV_POSS,CMU_CLKOCR_HSCODIV_POSE)
217 
218 #define CMU_CLKOCR_HSCOS_POSS   8U
219 #define CMU_CLKOCR_HSCOS_POSE   11U
220 #define CMU_CLKOCR_HSCOS_MSK    BITS(CMU_CLKOCR_HSCOS_POSS,CMU_CLKOCR_HSCOS_POSE)
221 
222 #define CMU_CLKOCR_HSCOEN_POS   0U
223 #define CMU_CLKOCR_HSCOEN_MSK   BIT(CMU_CLKOCR_HSCOEN_POS)
224 
225 /****************** Bit definition for CMU_BUZZCR register ************************/
226 
227 #define CMU_BUZZCR_DAT_POSS 16U
228 #define CMU_BUZZCR_DAT_POSE 31U
229 #define CMU_BUZZCR_DAT_MSK  BITS(CMU_BUZZCR_DAT_POSS,CMU_BUZZCR_DAT_POSE)
230 
231 #define CMU_BUZZCR_DIV_POSS 8U
232 #define CMU_BUZZCR_DIV_POSE 10U
233 #define CMU_BUZZCR_DIV_MSK  BITS(CMU_BUZZCR_DIV_POSS,CMU_BUZZCR_DIV_POSE)
234 
235 #define CMU_BUZZCR_EN_POS   0U
236 #define CMU_BUZZCR_EN_MSK   BIT(CMU_BUZZCR_EN_POS)
237 
238 /****************** Bit definition for CMU_AHBENR register ************************/
239 #define CMU_AHBENR_CSUEN_POS    7U
240 #define CMU_AHBENR_CSUEN_MSK    BIT(CMU_AHBENR_CSUEN_POS)
241 
242 #define CMU_AHBENR_USBEN_POS    6U
243 #define CMU_AHBENR_USBEN_MSK    BIT(CMU_AHBENR_USBEN_POS)
244 
245 #define CMU_AHBENR_PISEN_POS    5U
246 #define CMU_AHBENR_PISEN_MSK    BIT(CMU_AHBENR_PISEN_POS)
247 
248 #define CMU_AHBENR_DMAEN_POS    2U
249 #define CMU_AHBENR_DMAEN_MSK    BIT(CMU_AHBENR_DMAEN_POS)
250 
251 #define CMU_AHBENR_CRCEN_POS    1U
252 #define CMU_AHBENR_CRCEN_MSK    BIT(CMU_AHBENR_CRCEN_POS)
253 
254 #define CMU_AHBENR_GPIOEN_POS   0U
255 #define CMU_AHBENR_GPIOEN_MSK   BIT(CMU_AHBENR_GPIOEN_POS)
256 
257 /****************** Bit definition for CMU_APBENR register ************************/
258 
259 #define CMU_APBENR_ADCEN_POS    25U
260 #define CMU_APBENR_ADCEN_MSK    BIT(CMU_APBENR_ADCEN_POS)
261 
262 #define CMU_APBENR_DBGCEN_POS   24U
263 #define CMU_APBENR_DBGCEN_MSK   BIT(CMU_APBENR_DBGCEN_POS)
264 
265 #define CMU_APBENR_IWDTEN_POS   23U
266 #define CMU_APBENR_IWDTEN_MSK   BIT(CMU_APBENR_IWDTEN_POS)
267 
268 #define CMU_APBENR_WWDTEN_POS   22U
269 #define CMU_APBENR_WWDTEN_MSK   BIT(CMU_APBENR_WWDTEN_POS)
270 
271 #define CMU_APBENR_I2C1EN_POS   21U
272 #define CMU_APBENR_I2C1EN_MSK   BIT(CMU_APBENR_I2C1EN_POS)
273 
274 #define CMU_APBENR_I2C0EN_POS   20U
275 #define CMU_APBENR_I2C0EN_MSK   BIT(CMU_APBENR_I2C0EN_POS)
276 
277 #define CMU_APBENR_SPI1EN_POS   17U
278 #define CMU_APBENR_SPI1EN_MSK   BIT(CMU_APBENR_SPI1EN_POS)
279 
280 #define CMU_APBENR_SPI0EN_POS   16U
281 #define CMU_APBENR_SPI0EN_MSK   BIT(CMU_APBENR_SPI0EN_POS)
282 
283 #define CMU_APBENR_CUART2EN_POS 14U
284 #define CMU_APBENR_CUART2EN_MSK BIT(CMU_APBENR_CUART2EN_POS)
285 
286 #define CMU_APBENR_CUART1EN_POS 13U
287 #define CMU_APBENR_CUART1EN_MSK BIT(CMU_APBENR_CUART1EN_POS)
288 
289 #define CMU_APBENR_CUART0EN_POS 12U
290 #define CMU_APBENR_CUART0EN_MSK BIT(CMU_APBENR_CUART0EN_POS)
291 
292 #define CMU_APBENR_EUART1EN_POS 9U
293 #define CMU_APBENR_EUART1EN_MSK BIT(CMU_APBENR_EUART1EN_POS)
294 
295 #define CMU_APBENR_EUART0EN_POS 8U
296 #define CMU_APBENR_EUART0EN_MSK BIT(CMU_APBENR_EUART0EN_POS)
297 
298 #define CMU_APBENR_GP16C4T2EN_POS   4U
299 #define CMU_APBENR_GP16C4T2EN_MSK   BIT(CMU_APBENR_GP16C4T2EN_POS)
300 
301 #define CMU_APBENR_GP16C4T1EN_POS   3U
302 #define CMU_APBENR_GP16C4T1EN_MSK   BIT(CMU_APBENR_GP16C4T1EN_POS)
303 
304 #define CMU_APBENR_GP16C4T0EN_POS   2U
305 #define CMU_APBENR_GP16C4T0EN_MSK   BIT(CMU_APBENR_GP16C4T0EN_POS)
306 
307 #define CMU_APBENR_BS16T0EN_POS 1U
308 #define CMU_APBENR_BS16T0EN_MSK BIT(CMU_APBENR_BS16T0EN_POS)
309 
310 #define CMU_APBENR_AD16C4T0EN_POS   0U
311 #define CMU_APBENR_AD16C4T0EN_MSK   BIT(CMU_APBENR_AD16C4T0EN_POS)
312 
313 /****************** Bit definition for CMU_LPENR register ************************/
314 
315 #define CMU_LPENR_HOSCEN_POS    3U
316 #define CMU_LPENR_HOSCEN_MSK    BIT(CMU_LPENR_HOSCEN_POS)
317 
318 #define CMU_LPENR_HRC48MEN_POS  2U
319 #define CMU_LPENR_HRC48MEN_MSK  BIT(CMU_LPENR_HRC48MEN_POS)
320 
321 #define CMU_LPENR_HRC4MEN_POS   2U
322 #define CMU_LPENR_HRC4MEN_MSK   BIT(CMU_LPENR_HRC4MEN_POS)
323 
324 #define CMU_LPENR_PLLEN_POS 0U
325 #define CMU_LPENR_PLLEN_MSK BIT(CMU_LPENR_PLLEN_POS)
326 
327 typedef struct
328 {
329     __O uint32_t CSR;
330     __IO uint32_t CFGR;
331     uint32_t RESERVED0[2] ;
332     __IO uint32_t CLKENR;
333     __I uint32_t CLKSR;
334     __IO uint32_t PLLCFG;
335     __IO uint32_t HOSCCFG;
336     __IO uint32_t HOSMCR;
337     uint32_t RESERVED1[1] ;
338     __IO uint32_t PULMCR;
339     uint32_t RESERVED2[1] ;
340     __IO uint32_t CLKOCR;
341     __IO uint32_t BUZZCR;
342     uint32_t RESERVED3[2] ;
343     __IO uint32_t AHBENR;
344     uint32_t RESERVED4[3] ;
345     __IO uint32_t APBENR;
346     uint32_t RESERVED5[3] ;
347     __IO uint32_t LPENR;
348 } CMU_TypeDef;
349 
350 
351 
352 
353 
354 #endif  /*__REG_CMU_H__*/
355