1 /***************************************************************************//**
\r
3 * @brief Clock management unit (CMU) API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
32 #ifndef __SILICON_LABS_EM_CMU_H__
\r
33 #define __SILICON_LABS_EM_CMU_H__
\r
35 #include "em_device.h"
\r
36 #if defined( CMU_PRESENT )
\r
38 #include <stdbool.h>
\r
39 #include "em_assert.h"
\r
46 /***************************************************************************//**
\r
47 * @addtogroup EM_Library
\r
49 ******************************************************************************/
\r
51 /***************************************************************************//**
\r
54 ******************************************************************************/
\r
56 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
\r
58 /* Select register id's, for internal use. */
\r
59 #define CMU_NOSEL_REG 0
\r
60 #define CMU_HFCLKSEL_REG 1
\r
61 #define CMU_LFACLKSEL_REG 2
\r
62 #define CMU_LFBCLKSEL_REG 3
\r
63 #define CMU_LFCCLKSEL_REG 4
\r
64 #define CMU_LFECLKSEL_REG 5
\r
65 #define CMU_DBGCLKSEL_REG 6
\r
66 #define CMU_USBCCLKSEL_REG 7
\r
68 #define CMU_SEL_REG_POS 0
\r
69 #define CMU_SEL_REG_MASK 0xf
\r
71 /* Divisor/prescaler register id's, for internal use. */
\r
72 #define CMU_NODIV_REG 0
\r
73 #define CMU_NOPRESC_REG 0
\r
74 #define CMU_HFPRESC_REG 1
\r
75 #define CMU_HFCLKDIV_REG 1
\r
76 #define CMU_HFEXPPRESC_REG 2
\r
77 #define CMU_HFCLKLEPRESC_REG 3
\r
78 #define CMU_HFPERPRESC_REG 4
\r
79 #define CMU_HFPERCLKDIV_REG 4
\r
80 #define CMU_HFCOREPRESC_REG 5
\r
81 #define CMU_HFCORECLKDIV_REG 5
\r
82 #define CMU_HFRADIOPRESC_REG 6
\r
83 #define CMU_LFAPRESC0_REG 7
\r
84 #define CMU_LFBPRESC0_REG 8
\r
85 #define CMU_LFEPRESC0_REG 9
\r
87 #define CMU_PRESC_REG_POS 4
\r
88 #define CMU_DIV_REG_POS CMU_PRESC_REG_POS
\r
89 #define CMU_PRESC_REG_MASK 0xf
\r
90 #define CMU_DIV_REG_MASK CMU_PRESC_REG_MASK
\r
92 /* Enable register id's, for internal use. */
\r
93 #define CMU_NO_EN_REG 0
\r
94 #define CMU_CTRL_EN_REG 1
\r
95 #define CMU_HFPERCLKDIV_EN_REG 1
\r
96 #define CMU_HFPERCLKEN0_EN_REG 2
\r
97 #define CMU_HFCORECLKEN0_EN_REG 3
\r
98 #define CMU_HFRADIOCLKEN0_EN_REG 4
\r
99 #define CMU_HFBUSCLKEN0_EN_REG 5
\r
100 #define CMU_LFACLKEN0_EN_REG 6
\r
101 #define CMU_LFBCLKEN0_EN_REG 7
\r
102 #define CMU_LFCCLKEN0_EN_REG 8
\r
103 #define CMU_LFECLKEN0_EN_REG 9
\r
104 #define CMU_PCNT_EN_REG 10
\r
106 #define CMU_EN_REG_POS 8
\r
107 #define CMU_EN_REG_MASK 0xf
\r
109 /* Enable register bit positions, for internal use. */
\r
110 #define CMU_EN_BIT_POS 12
\r
111 #define CMU_EN_BIT_MASK 0x1f
\r
113 /* Clock branch bitfield positions, for internal use. */
\r
114 #define CMU_HF_CLK_BRANCH 0
\r
115 #define CMU_HFCORE_CLK_BRANCH 1
\r
116 #define CMU_HFPER_CLK_BRANCH 2
\r
117 #define CMU_HFRADIO_CLK_BRANCH 3
\r
118 #define CMU_HFBUS_CLK_BRANCH 4
\r
119 #define CMU_HFEXP_CLK_BRANCH 5
\r
120 #define CMU_DBG_CLK_BRANCH 6
\r
121 #define CMU_AUX_CLK_BRANCH 7
\r
122 #define CMU_RTC_CLK_BRANCH 8
\r
123 #define CMU_RTCC_CLK_BRANCH 8
\r
124 #define CMU_LETIMER_CLK_BRANCH 9
\r
125 #define CMU_LETIMER0_CLK_BRANCH 9
\r
126 #define CMU_LEUART0_CLK_BRANCH 10
\r
127 #define CMU_LEUART1_CLK_BRANCH 11
\r
128 #define CMU_LFA_CLK_BRANCH 12
\r
129 #define CMU_LFB_CLK_BRANCH 13
\r
130 #define CMU_LFC_CLK_BRANCH 14
\r
131 #define CMU_LFE_CLK_BRANCH 15
\r
132 #define CMU_USBC_CLK_BRANCH 16
\r
133 #define CMU_USBLE_CLK_BRANCH 17
\r
134 #define CMU_LCDPRE_CLK_BRANCH 18
\r
135 #define CMU_LCD_CLK_BRANCH 19
\r
136 #define CMU_LESENSE_CLK_BRANCH 20
\r
138 #define CMU_CLK_BRANCH_POS 17
\r
139 #define CMU_CLK_BRANCH_MASK 0x1f
\r
143 /*******************************************************************************
\r
144 ******************************** ENUMS ************************************
\r
145 ******************************************************************************/
\r
147 /** Clock divisors. These values are valid for prescalers. */
\r
148 #define cmuClkDiv_1 1 /**< Divide clock by 1. */
\r
149 #define cmuClkDiv_2 2 /**< Divide clock by 2. */
\r
150 #define cmuClkDiv_4 4 /**< Divide clock by 4. */
\r
151 #define cmuClkDiv_8 8 /**< Divide clock by 8. */
\r
152 #define cmuClkDiv_16 16 /**< Divide clock by 16. */
\r
153 #define cmuClkDiv_32 32 /**< Divide clock by 32. */
\r
154 #define cmuClkDiv_64 64 /**< Divide clock by 64. */
\r
155 #define cmuClkDiv_128 128 /**< Divide clock by 128. */
\r
156 #define cmuClkDiv_256 256 /**< Divide clock by 256. */
\r
157 #define cmuClkDiv_512 512 /**< Divide clock by 512. */
\r
158 #define cmuClkDiv_1024 1024 /**< Divide clock by 1024. */
\r
159 #define cmuClkDiv_2048 2048 /**< Divide clock by 2048. */
\r
160 #define cmuClkDiv_4096 4096 /**< Divide clock by 4096. */
\r
161 #define cmuClkDiv_8192 8192 /**< Divide clock by 8192. */
\r
162 #define cmuClkDiv_16384 16384 /**< Divide clock by 16384. */
\r
163 #define cmuClkDiv_32768 32768 /**< Divide clock by 32768. */
\r
165 /** Clock divider configuration */
\r
166 typedef uint32_t CMU_ClkDiv_TypeDef;
\r
168 #if defined( _SILICON_LABS_32B_PLATFORM_2 )
\r
169 /** Clockprescaler configuration */
\r
170 typedef uint32_t CMU_ClkPresc_TypeDef;
\r
173 #if defined( _CMU_HFRCOCTRL_BAND_MASK )
\r
174 /** High frequency system RCO bands */
\r
177 cmuHFRCOBand_1MHz = _CMU_HFRCOCTRL_BAND_1MHZ, /**< 1MHz HFRCO band */
\r
178 cmuHFRCOBand_7MHz = _CMU_HFRCOCTRL_BAND_7MHZ, /**< 7MHz HFRCO band */
\r
179 cmuHFRCOBand_11MHz = _CMU_HFRCOCTRL_BAND_11MHZ, /**< 11MHz HFRCO band */
\r
180 cmuHFRCOBand_14MHz = _CMU_HFRCOCTRL_BAND_14MHZ, /**< 14MHz HFRCO band */
\r
181 cmuHFRCOBand_21MHz = _CMU_HFRCOCTRL_BAND_21MHZ, /**< 21MHz HFRCO band */
\r
182 #if defined( CMU_HFRCOCTRL_BAND_28MHZ )
\r
183 cmuHFRCOBand_28MHz = _CMU_HFRCOCTRL_BAND_28MHZ, /**< 28MHz HFRCO band */
\r
185 } CMU_HFRCOBand_TypeDef;
\r
186 #endif /* _CMU_HFRCOCTRL_BAND_MASK */
\r
188 #if defined( _CMU_AUXHFRCOCTRL_BAND_MASK )
\r
189 /** AUX High frequency RCO bands */
\r
192 cmuAUXHFRCOBand_1MHz = _CMU_AUXHFRCOCTRL_BAND_1MHZ, /**< 1MHz RC band */
\r
193 cmuAUXHFRCOBand_7MHz = _CMU_AUXHFRCOCTRL_BAND_7MHZ, /**< 7MHz RC band */
\r
194 cmuAUXHFRCOBand_11MHz = _CMU_AUXHFRCOCTRL_BAND_11MHZ, /**< 11MHz RC band */
\r
195 cmuAUXHFRCOBand_14MHz = _CMU_AUXHFRCOCTRL_BAND_14MHZ, /**< 14MHz RC band */
\r
196 cmuAUXHFRCOBand_21MHz = _CMU_AUXHFRCOCTRL_BAND_21MHZ, /**< 21MHz RC band */
\r
197 #if defined( CMU_AUXHFRCOCTRL_BAND_28MHZ )
\r
198 cmuAUXHFRCOBand_28MHz = _CMU_AUXHFRCOCTRL_BAND_28MHZ, /**< 28MHz RC band */
\r
200 } CMU_AUXHFRCOBand_TypeDef;
\r
203 #if defined( _CMU_USHFRCOCONF_BAND_MASK )
\r
204 /** USB High frequency RC bands. */
\r
207 /** 24MHz RC band. */
\r
208 cmuUSHFRCOBand_24MHz = _CMU_USHFRCOCONF_BAND_24MHZ,
\r
209 /** 48MHz RC band. */
\r
210 cmuUSHFRCOBand_48MHz = _CMU_USHFRCOCONF_BAND_48MHZ,
\r
211 } CMU_USHFRCOBand_TypeDef;
\r
214 #if defined( _CMU_HFRCOCTRL_FREQRANGE_MASK )
\r
215 /** High frequency system RCO bands */
\r
218 cmuHFRCOFreq_1M0Hz = 1000000U, /**< 1MHz RC band */
\r
219 cmuHFRCOFreq_2M0Hz = 2000000U, /**< 2MHz RC band */
\r
220 cmuHFRCOFreq_4M0Hz = 4000000U, /**< 4MHz RC band */
\r
221 cmuHFRCOFreq_7M0Hz = 7000000U, /**< 7MHz RC band */
\r
222 cmuHFRCOFreq_13M0Hz = 13000000U, /**< 13MHz RC band */
\r
223 cmuHFRCOFreq_16M0Hz = 16000000U, /**< 16MHz RC band */
\r
224 cmuHFRCOFreq_19M0Hz = 19000000U, /**< 19MHz RC band */
\r
225 cmuHFRCOFreq_26M0Hz = 26000000U, /**< 26MHz RC band */
\r
226 cmuHFRCOFreq_32M0Hz = 32000000U, /**< 32MHz RC band */
\r
227 cmuHFRCOFreq_38M0Hz = 38000000U, /**< 38MHz RC band */
\r
228 cmuHFRCOFreq_UserDefined = 0,
\r
229 } CMU_HFRCOFreq_TypeDef;
\r
230 #define CMU_HFRCO_MIN cmuHFRCOFreq_1M0Hz
\r
231 #define CMU_HFRCO_MAX cmuHFRCOFreq_38M0Hz
\r
234 #if defined( _CMU_AUXHFRCOCTRL_FREQRANGE_MASK )
\r
235 /** AUX High frequency RCO bands */
\r
238 cmuAUXHFRCOFreq_1M0Hz = 1000000U, /**< 1MHz RC band */
\r
239 cmuAUXHFRCOFreq_2M0Hz = 2000000U, /**< 2MHz RC band */
\r
240 cmuAUXHFRCOFreq_4M0Hz = 4000000U, /**< 4MHz RC band */
\r
241 cmuAUXHFRCOFreq_7M0Hz = 7000000U, /**< 7MHz RC band */
\r
242 cmuAUXHFRCOFreq_13M0Hz = 13000000U, /**< 13MHz RC band */
\r
243 cmuAUXHFRCOFreq_16M0Hz = 16000000U, /**< 16MHz RC band */
\r
244 cmuAUXHFRCOFreq_19M0Hz = 19000000U, /**< 19MHz RC band */
\r
245 cmuAUXHFRCOFreq_26M0Hz = 26000000U, /**< 26MHz RC band */
\r
246 cmuAUXHFRCOFreq_32M0Hz = 32000000U, /**< 32MHz RC band */
\r
247 cmuAUXHFRCOFreq_38M0Hz = 38000000U, /**< 38MHz RC band */
\r
248 cmuAUXHFRCOFreq_UserDefined = 0,
\r
249 } CMU_AUXHFRCOFreq_TypeDef;
\r
250 #define CMU_AUXHFRCO_MIN cmuAUXHFRCOFreq_1M0Hz
\r
251 #define CMU_AUXHFRCO_MAX cmuAUXHFRCOFreq_38M0Hz
\r
255 /** Clock points in CMU. Please refer to CMU overview in reference manual. */
\r
258 /*******************/
\r
259 /* HF clock branch */
\r
260 /*******************/
\r
262 /** High frequency clock */
\r
263 #if defined( _CMU_CTRL_HFCLKDIV_MASK ) \
\r
264 || defined( _CMU_HFPRESC_MASK )
\r
265 cmuClock_HF = (CMU_HFCLKDIV_REG << CMU_DIV_REG_POS)
\r
266 | (CMU_HFCLKSEL_REG << CMU_SEL_REG_POS)
\r
267 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
268 | (0 << CMU_EN_BIT_POS)
\r
269 | (CMU_HF_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
271 cmuClock_HF = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
272 | (CMU_HFCLKSEL_REG << CMU_SEL_REG_POS)
\r
273 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
274 | (0 << CMU_EN_BIT_POS)
\r
275 | (CMU_HF_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
279 cmuClock_DBG = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
280 | (CMU_DBGCLKSEL_REG << CMU_SEL_REG_POS)
\r
281 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
282 | (0 << CMU_EN_BIT_POS)
\r
283 | (CMU_DBG_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
286 cmuClock_AUX = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
287 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
288 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
289 | (0 << CMU_EN_BIT_POS)
\r
290 | (CMU_AUX_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
292 #if defined( _CMU_HFEXPPRESC_MASK )
\r
293 /**********************/
\r
294 /* HF export sub-branch */
\r
295 /**********************/
\r
297 /** Export clock */
\r
298 cmuClock_EXPORT = (CMU_HFEXPPRESC_REG << CMU_PRESC_REG_POS)
\r
299 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
300 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
301 | (0 << CMU_EN_BIT_POS)
\r
302 | (CMU_HFEXP_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
305 #if defined( _CMU_HFBUSCLKEN0_MASK )
\r
306 /**********************************/
\r
307 /* HF bus clock sub-branch */
\r
308 /**********************************/
\r
310 /** High frequency bus clock. */
\r
311 cmuClock_BUS = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
312 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
313 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
314 | (0 << CMU_EN_BIT_POS)
\r
315 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
317 #if defined( CMU_HFBUSCLKEN0_CRYPTO )
\r
318 /** Cryptography accelerator clock. */
\r
319 cmuClock_CRYPTO = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
320 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
321 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
322 | (_CMU_HFBUSCLKEN0_CRYPTO_SHIFT << CMU_EN_BIT_POS)
\r
323 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
326 #if defined( CMU_HFBUSCLKEN0_LDMA )
\r
327 /** Direct memory access controller clock. */
\r
328 cmuClock_LDMA = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
329 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
330 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
331 | (_CMU_HFBUSCLKEN0_LDMA_SHIFT << CMU_EN_BIT_POS)
\r
332 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
335 #if defined( CMU_HFBUSCLKEN0_GPCRC )
\r
336 /** General purpose cyclic redundancy checksum clock. */
\r
337 cmuClock_GPCRC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
338 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
339 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
340 | (_CMU_HFBUSCLKEN0_GPCRC_SHIFT << CMU_EN_BIT_POS)
\r
341 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
344 #if defined( CMU_HFBUSCLKEN0_GPIO )
\r
345 /** General purpose input/output clock. */
\r
346 cmuClock_GPIO = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
347 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
348 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
349 | (_CMU_HFBUSCLKEN0_GPIO_SHIFT << CMU_EN_BIT_POS)
\r
350 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
353 /** Low energy clocking module clock. */
\r
354 cmuClock_CORELE = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
355 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
356 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
357 | (_CMU_HFBUSCLKEN0_LE_SHIFT << CMU_EN_BIT_POS)
\r
358 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
360 #if defined( CMU_HFBUSCLKEN0_PRS )
\r
361 /** Peripheral reflex system clock. */
\r
362 cmuClock_PRS = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
363 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
364 | (CMU_HFBUSCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
365 | (_CMU_HFBUSCLKEN0_PRS_SHIFT << CMU_EN_BIT_POS)
\r
366 | (CMU_HFBUS_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
370 /**********************************/
\r
371 /* HF peripheral clock sub-branch */
\r
372 /**********************************/
\r
374 /** High frequency peripheral clock */
\r
375 #if defined( _CMU_HFPRESC_MASK )
\r
376 cmuClock_HFPER = (CMU_HFPERPRESC_REG << CMU_PRESC_REG_POS)
\r
377 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
378 | (CMU_CTRL_EN_REG << CMU_EN_REG_POS)
\r
379 | (_CMU_CTRL_HFPERCLKEN_SHIFT << CMU_EN_BIT_POS)
\r
380 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
382 cmuClock_HFPER = (CMU_HFPERCLKDIV_REG << CMU_DIV_REG_POS)
\r
383 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
384 | (CMU_HFPERCLKDIV_EN_REG << CMU_EN_REG_POS)
\r
385 | (_CMU_HFPERCLKDIV_HFPERCLKEN_SHIFT << CMU_EN_BIT_POS)
\r
386 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
389 #if defined( CMU_HFPERCLKEN0_USART0 )
\r
390 /** Universal sync/async receiver/transmitter 0 clock. */
\r
391 cmuClock_USART0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
392 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
393 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
394 | (_CMU_HFPERCLKEN0_USART0_SHIFT << CMU_EN_BIT_POS)
\r
395 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
398 #if defined( CMU_HFPERCLKEN0_USARTRF0 )
\r
399 /** Universal sync/async receiver/transmitter 0 clock. */
\r
400 cmuClock_USARTRF0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
401 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
402 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
403 | (_CMU_HFPERCLKEN0_USARTRF0_SHIFT << CMU_EN_BIT_POS)
\r
404 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
407 #if defined( CMU_HFPERCLKEN0_USARTRF1 )
\r
408 /** Universal sync/async receiver/transmitter 0 clock. */
\r
409 cmuClock_USARTRF1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
410 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
411 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
412 | (_CMU_HFPERCLKEN0_USARTRF1_SHIFT << CMU_EN_BIT_POS)
\r
413 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
416 #if defined( CMU_HFPERCLKEN0_USART1 )
\r
417 /** Universal sync/async receiver/transmitter 1 clock. */
\r
418 cmuClock_USART1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
419 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
420 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
421 | (_CMU_HFPERCLKEN0_USART1_SHIFT << CMU_EN_BIT_POS)
\r
422 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
425 #if defined( CMU_HFPERCLKEN0_USART2 )
\r
426 /** Universal sync/async receiver/transmitter 2 clock. */
\r
427 cmuClock_USART2 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
428 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
429 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
430 | (_CMU_HFPERCLKEN0_USART2_SHIFT << CMU_EN_BIT_POS)
\r
431 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
434 #if defined( CMU_HFPERCLKEN0_USART3 )
\r
435 /** Universal sync/async receiver/transmitter 3 clock. */
\r
436 cmuClock_USART3 = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
437 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
438 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
439 | (_CMU_HFPERCLKEN0_USART3_SHIFT << CMU_EN_BIT_POS)
\r
440 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
443 #if defined( CMU_HFPERCLKEN0_USART4 )
\r
444 /** Universal sync/async receiver/transmitter 4 clock. */
\r
445 cmuClock_USART4 = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
446 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
447 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
448 | (_CMU_HFPERCLKEN0_USART4_SHIFT << CMU_EN_BIT_POS)
\r
449 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
452 #if defined( CMU_HFPERCLKEN0_USART5 )
\r
453 /** Universal sync/async receiver/transmitter 5 clock. */
\r
454 cmuClock_USART5 = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
455 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
456 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
457 | (_CMU_HFPERCLKEN0_USART5_SHIFT << CMU_EN_BIT_POS)
\r
458 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
462 #if defined( CMU_HFPERCLKEN0_UART0 )
\r
463 /** Universal async receiver/transmitter 0 clock. */
\r
464 cmuClock_UART0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
465 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
466 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
467 | (_CMU_HFPERCLKEN0_UART0_SHIFT << CMU_EN_BIT_POS)
\r
468 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
471 #if defined( CMU_HFPERCLKEN0_UART1 )
\r
472 /** Universal async receiver/transmitter 1 clock. */
\r
473 cmuClock_UART1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
474 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
475 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
476 | (_CMU_HFPERCLKEN0_UART1_SHIFT << CMU_EN_BIT_POS)
\r
477 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
480 #if defined( CMU_HFPERCLKEN0_TIMER0 )
\r
481 /** Timer 0 clock. */
\r
482 cmuClock_TIMER0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
483 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
484 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
485 | (_CMU_HFPERCLKEN0_TIMER0_SHIFT << CMU_EN_BIT_POS)
\r
486 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
489 #if defined( CMU_HFPERCLKEN0_TIMER1 )
\r
490 /** Timer 1 clock. */
\r
491 cmuClock_TIMER1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
492 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
493 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
494 | (_CMU_HFPERCLKEN0_TIMER1_SHIFT << CMU_EN_BIT_POS)
\r
495 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
498 #if defined( CMU_HFPERCLKEN0_TIMER2 )
\r
499 /** Timer 2 clock. */
\r
500 cmuClock_TIMER2 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
501 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
502 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
503 | (_CMU_HFPERCLKEN0_TIMER2_SHIFT << CMU_EN_BIT_POS)
\r
504 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
507 #if defined( CMU_HFPERCLKEN0_TIMER3 )
\r
508 /** Timer 3 clock. */
\r
509 cmuClock_TIMER3 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
510 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
511 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
512 | (_CMU_HFPERCLKEN0_TIMER3_SHIFT << CMU_EN_BIT_POS)
\r
513 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
516 #if defined( CMU_HFPERCLKEN0_CRYOTIMER )
\r
517 /** CRYOtimer clock. */
\r
518 cmuClock_CRYOTIMER = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
519 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
520 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
521 | (_CMU_HFPERCLKEN0_CRYOTIMER_SHIFT << CMU_EN_BIT_POS)
\r
522 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
525 #if defined( CMU_HFPERCLKEN0_ACMP0 )
\r
526 /** Analog comparator 0 clock. */
\r
527 cmuClock_ACMP0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
528 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
529 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
530 | (_CMU_HFPERCLKEN0_ACMP0_SHIFT << CMU_EN_BIT_POS)
\r
531 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
534 #if defined( CMU_HFPERCLKEN0_ACMP1 )
\r
535 /** Analog comparator 1 clock. */
\r
536 cmuClock_ACMP1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
537 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
538 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
539 | (_CMU_HFPERCLKEN0_ACMP1_SHIFT << CMU_EN_BIT_POS)
\r
540 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
543 #if defined( CMU_HFPERCLKEN0_PRS )
\r
544 /** Peripheral reflex system clock. */
\r
545 cmuClock_PRS = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
546 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
547 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
548 | (_CMU_HFPERCLKEN0_PRS_SHIFT << CMU_EN_BIT_POS)
\r
549 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
552 #if defined( CMU_HFPERCLKEN0_DAC0 )
\r
553 /** Digital to analog converter 0 clock. */
\r
554 cmuClock_DAC0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
555 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
556 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
557 | (_CMU_HFPERCLKEN0_DAC0_SHIFT << CMU_EN_BIT_POS)
\r
558 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
561 #if defined( CMU_HFPERCLKEN0_IDAC0 )
\r
562 /** Digital to analog converter 0 clock. */
\r
563 cmuClock_IDAC0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
564 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
565 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
566 | (_CMU_HFPERCLKEN0_IDAC0_SHIFT << CMU_EN_BIT_POS)
\r
567 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
570 #if defined( CMU_HFPERCLKEN0_GPIO )
\r
571 /** General purpose input/output clock. */
\r
572 cmuClock_GPIO = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
573 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
574 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
575 | (_CMU_HFPERCLKEN0_GPIO_SHIFT << CMU_EN_BIT_POS)
\r
576 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
579 #if defined( CMU_HFPERCLKEN0_VCMP )
\r
580 /** Voltage comparator clock. */
\r
581 cmuClock_VCMP = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
582 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
583 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
584 | (_CMU_HFPERCLKEN0_VCMP_SHIFT << CMU_EN_BIT_POS)
\r
585 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
588 #if defined( CMU_HFPERCLKEN0_ADC0 )
\r
589 /** Analog to digital converter 0 clock. */
\r
590 cmuClock_ADC0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
591 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
592 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
593 | (_CMU_HFPERCLKEN0_ADC0_SHIFT << CMU_EN_BIT_POS)
\r
594 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
597 #if defined( CMU_HFPERCLKEN0_I2C0 )
\r
598 /** I2C 0 clock. */
\r
599 cmuClock_I2C0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
600 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
601 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
602 | (_CMU_HFPERCLKEN0_I2C0_SHIFT << CMU_EN_BIT_POS)
\r
603 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
606 #if defined( CMU_HFPERCLKEN0_I2C1 )
\r
607 /** I2C 1 clock. */
\r
608 cmuClock_I2C1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
609 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
610 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
611 | (_CMU_HFPERCLKEN0_I2C1_SHIFT << CMU_EN_BIT_POS)
\r
612 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
615 #if defined( CMU_HFPERCLKEN0_I2C2 )
\r
616 /** I2C 2 clock. */
\r
617 cmuClock_I2C2 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
618 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
619 | (CMU_HFPERCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
620 | (_CMU_HFPERCLKEN0_I2C2_SHIFT << CMU_EN_BIT_POS)
\r
621 | (CMU_HFPER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
624 /**********************/
\r
625 /* HF core sub-branch */
\r
626 /**********************/
\r
629 cmuClock_CORE = (CMU_HFCORECLKDIV_REG << CMU_DIV_REG_POS)
\r
630 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
631 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
632 | (0 << CMU_EN_BIT_POS)
\r
633 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
635 #if defined( CMU_HFCORECLKEN0_AES )
\r
636 /** Advanced encryption standard accelerator clock. */
\r
637 cmuClock_AES = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
638 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
639 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
640 | (_CMU_HFCORECLKEN0_AES_SHIFT << CMU_EN_BIT_POS)
\r
641 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
644 #if defined( CMU_HFCORECLKEN0_DMA )
\r
645 /** Direct memory access controller clock. */
\r
646 cmuClock_DMA = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
647 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
648 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
649 | (_CMU_HFCORECLKEN0_DMA_SHIFT << CMU_EN_BIT_POS)
\r
650 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
653 #if defined( CMU_HFCORECLKEN0_LE )
\r
654 /** Low energy clocking module clock. */
\r
655 cmuClock_CORELE = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
656 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
657 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
658 | (_CMU_HFCORECLKEN0_LE_SHIFT << CMU_EN_BIT_POS)
\r
659 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
662 #if defined( CMU_HFCORECLKEN0_EBI )
\r
663 /** External bus interface clock. */
\r
664 cmuClock_EBI = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
665 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
666 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
667 | (_CMU_HFCORECLKEN0_EBI_SHIFT << CMU_EN_BIT_POS)
\r
668 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
671 #if defined( CMU_HFCORECLKEN0_USBC )
\r
672 /** USB Core clock. */
\r
673 cmuClock_USBC = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
674 | (CMU_USBCCLKSEL_REG << CMU_SEL_REG_POS)
\r
675 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
676 | (_CMU_HFCORECLKEN0_USBC_SHIFT << CMU_EN_BIT_POS)
\r
677 | (CMU_USBC_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
681 #if defined( CMU_HFCORECLKEN0_USB )
\r
683 cmuClock_USB = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
684 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
685 | (CMU_HFCORECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
686 | (_CMU_HFCORECLKEN0_USB_SHIFT << CMU_EN_BIT_POS)
\r
687 | (CMU_HFCORE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
690 #if defined( CMU_CTRL_HFRADIOCLKEN )
\r
691 /**********************************/
\r
692 /* HF radio clock sub-branch */
\r
693 /**********************************/
\r
695 /** High frequency radio clock. */
\r
696 cmuClock_RADIO = (CMU_HFRADIOPRESC_REG << CMU_PRESC_REG_POS)
\r
697 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
698 | (CMU_CTRL_EN_REG << CMU_EN_REG_POS)
\r
699 | (_CMU_CTRL_HFRADIOCLKEN_SHIFT << CMU_EN_BIT_POS)
\r
700 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
702 #if defined( CMU_HFRADIOCLKEN0_MODEM )
\r
703 /** Modulator/demodulator clock. */
\r
704 cmuClock_MODEM = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
705 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
706 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
707 | (_CMU_HFRADIOCLKEN0_MODEM_SHIFT << CMU_EN_BIT_POS)
\r
708 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
711 #if defined( CMU_HFRADIOCLKEN0_PROTIMER )
\r
712 /** Protocol timer clock. */
\r
713 cmuClock_PROTIMER = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
714 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
715 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
716 | (_CMU_HFRADIOCLKEN0_PROTIMER_SHIFT << CMU_EN_BIT_POS)
\r
717 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
720 #if defined( CMU_HFRADIOCLKEN0_CRC )
\r
721 /** Cyclic Redundancy Check clock. */
\r
722 cmuClock_CRC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
723 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
724 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
725 | (_CMU_HFRADIOCLKEN0_CRC_SHIFT << CMU_EN_BIT_POS)
\r
726 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
729 #if defined( CMU_HFRADIOCLKEN0_AGC )
\r
730 /** Automatic Gain Control clock. */
\r
731 cmuClock_AGC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
732 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
733 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
734 | (_CMU_HFRADIOCLKEN0_AGC_SHIFT << CMU_EN_BIT_POS)
\r
735 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
738 #if defined( CMU_HFRADIOCLKEN0_FRC )
\r
739 /** Frame Controller clock. */
\r
740 cmuClock_FRC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
741 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
742 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
743 | (_CMU_HFRADIOCLKEN0_FRC_SHIFT << CMU_EN_BIT_POS)
\r
744 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
747 #if defined( CMU_HFRADIOCLKEN0_SYNTH )
\r
748 /** Frequency Synthesizer clock. */
\r
749 cmuClock_SYNTH = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
750 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
751 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
752 | (_CMU_HFRADIOCLKEN0_SYNTH_SHIFT << CMU_EN_BIT_POS)
\r
753 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
756 #if defined( CMU_HFRADIOCLKEN0_BUFC )
\r
757 /** Buffer Controller Check clock. */
\r
758 cmuClock_BUFC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
759 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
760 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
761 | (_CMU_HFRADIOCLKEN0_BUFC_SHIFT << CMU_EN_BIT_POS)
\r
762 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
765 #if defined( CMU_HFRADIOCLKEN0_RAC )
\r
766 /** Radio Controller clock. */
\r
767 cmuClock_RAC = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
768 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
769 | (CMU_HFRADIOCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
770 | (_CMU_HFRADIOCLKEN0_RAC_SHIFT << CMU_EN_BIT_POS)
\r
771 | (CMU_HFRADIO_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
779 /** Low frequency A clock */
\r
780 cmuClock_LFA = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
781 | (CMU_LFACLKSEL_REG << CMU_SEL_REG_POS)
\r
782 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
783 | (0 << CMU_EN_BIT_POS)
\r
784 | (CMU_LFA_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
786 #if defined( CMU_LFACLKEN0_RTC )
\r
787 /** Real time counter clock. */
\r
788 cmuClock_RTC = (CMU_LFAPRESC0_REG << CMU_DIV_REG_POS)
\r
789 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
790 | (CMU_LFACLKEN0_EN_REG << CMU_EN_REG_POS)
\r
791 | (_CMU_LFACLKEN0_RTC_SHIFT << CMU_EN_BIT_POS)
\r
792 | (CMU_RTC_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
795 #if defined( CMU_LFACLKEN0_LETIMER0 )
\r
796 /** Low energy timer 0 clock. */
\r
797 cmuClock_LETIMER0 = (CMU_LFAPRESC0_REG << CMU_DIV_REG_POS)
\r
798 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
799 | (CMU_LFACLKEN0_EN_REG << CMU_EN_REG_POS)
\r
800 | (_CMU_LFACLKEN0_LETIMER0_SHIFT << CMU_EN_BIT_POS)
\r
801 | (CMU_LETIMER_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
804 #if defined( CMU_LFACLKEN0_LCD )
\r
805 /** Liquid crystal display, pre FDIV clock. */
\r
806 cmuClock_LCDpre = (CMU_LFAPRESC0_REG << CMU_DIV_REG_POS)
\r
807 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
808 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
809 | (0 << CMU_EN_BIT_POS)
\r
810 | (CMU_LCDPRE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
812 /** Liquid crystal display clock. Please notice that FDIV prescaler
\r
813 * must be set by special API. */
\r
814 cmuClock_LCD = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
815 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
816 | (CMU_LFACLKEN0_EN_REG << CMU_EN_REG_POS)
\r
817 | (_CMU_LFACLKEN0_LCD_SHIFT << CMU_EN_BIT_POS)
\r
818 | (CMU_LCD_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
821 #if defined( CMU_PCNTCTRL_PCNT0CLKEN )
\r
822 /** Pulse counter 0 clock. */
\r
823 cmuClock_PCNT0 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
824 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
825 | (CMU_PCNT_EN_REG << CMU_EN_REG_POS)
\r
826 | (_CMU_PCNTCTRL_PCNT0CLKEN_SHIFT << CMU_EN_BIT_POS)
\r
827 | (CMU_LFA_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
830 #if defined( CMU_PCNTCTRL_PCNT1CLKEN )
\r
831 /** Pulse counter 1 clock. */
\r
832 cmuClock_PCNT1 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
833 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
834 | (CMU_PCNT_EN_REG << CMU_EN_REG_POS)
\r
835 | (_CMU_PCNTCTRL_PCNT1CLKEN_SHIFT << CMU_EN_BIT_POS)
\r
836 | (CMU_LFA_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
839 #if defined( CMU_PCNTCTRL_PCNT2CLKEN )
\r
840 /** Pulse counter 2 clock. */
\r
841 cmuClock_PCNT2 = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
842 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
843 | (CMU_PCNT_EN_REG << CMU_EN_REG_POS)
\r
844 | (_CMU_PCNTCTRL_PCNT2CLKEN_SHIFT << CMU_EN_BIT_POS)
\r
845 | (CMU_LFA_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
847 #if defined( CMU_LFACLKEN0_LESENSE )
\r
848 /** LESENSE clock. */
\r
849 cmuClock_LESENSE = (CMU_LFAPRESC0_REG << CMU_DIV_REG_POS)
\r
850 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
851 | (CMU_LFACLKEN0_EN_REG << CMU_EN_REG_POS)
\r
852 | (_CMU_LFACLKEN0_LESENSE_SHIFT << CMU_EN_BIT_POS)
\r
853 | (CMU_LESENSE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
860 /** Low frequency B clock */
\r
861 cmuClock_LFB = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
862 | (CMU_LFBCLKSEL_REG << CMU_SEL_REG_POS)
\r
863 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
864 | (0 << CMU_EN_BIT_POS)
\r
865 | (CMU_LFB_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
867 #if defined( CMU_LFBCLKEN0_LEUART0 )
\r
868 /** Low energy universal asynchronous receiver/transmitter 0 clock. */
\r
869 cmuClock_LEUART0 = (CMU_LFBPRESC0_REG << CMU_DIV_REG_POS)
\r
870 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
871 | (CMU_LFBCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
872 | (_CMU_LFBCLKEN0_LEUART0_SHIFT << CMU_EN_BIT_POS)
\r
873 | (CMU_LEUART0_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
876 #if defined( CMU_LFBCLKEN0_LEUART1 )
\r
877 /** Low energy universal asynchronous receiver/transmitter 1 clock. */
\r
878 cmuClock_LEUART1 = (CMU_LFBPRESC0_REG << CMU_DIV_REG_POS)
\r
879 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
880 | (CMU_LFBCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
881 | (_CMU_LFBCLKEN0_LEUART1_SHIFT << CMU_EN_BIT_POS)
\r
882 | (CMU_LEUART1_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
885 #if defined( _CMU_LFCCLKEN0_MASK )
\r
890 /** Low frequency C clock */
\r
891 cmuClock_LFC = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
892 | (CMU_LFCCLKSEL_REG << CMU_SEL_REG_POS)
\r
893 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
894 | (0 << CMU_EN_BIT_POS)
\r
895 | (CMU_LFC_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
897 #if defined( CMU_LFCCLKEN0_USBLE )
\r
898 /** USB LE clock. */
\r
899 cmuClock_USBLE = (CMU_NODIV_REG << CMU_DIV_REG_POS)
\r
900 | (CMU_LFCCLKSEL_REG << CMU_SEL_REG_POS)
\r
901 | (CMU_LFCCLKEN0_EN_REG << CMU_EN_REG_POS)
\r
902 | (_CMU_LFCCLKEN0_USBLE_SHIFT << CMU_EN_BIT_POS)
\r
903 | (CMU_USBLE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
907 #if defined( _CMU_LFECLKEN0_MASK )
\r
912 /** Low frequency A clock */
\r
913 cmuClock_LFE = (CMU_NOPRESC_REG << CMU_PRESC_REG_POS)
\r
914 | (CMU_LFECLKSEL_REG << CMU_SEL_REG_POS)
\r
915 | (CMU_NO_EN_REG << CMU_EN_REG_POS)
\r
916 | (0 << CMU_EN_BIT_POS)
\r
917 | (CMU_LFE_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
919 /** Real time counter and calendar clock. */
\r
920 #if defined ( CMU_LFECLKEN0_RTCC )
\r
921 cmuClock_RTCC = (CMU_LFEPRESC0_REG << CMU_PRESC_REG_POS)
\r
922 | (CMU_NOSEL_REG << CMU_SEL_REG_POS)
\r
923 | (CMU_LFECLKEN0_EN_REG << CMU_EN_REG_POS)
\r
924 | (_CMU_LFECLKEN0_RTCC_SHIFT << CMU_EN_BIT_POS)
\r
925 | (CMU_RTCC_CLK_BRANCH << CMU_CLK_BRANCH_POS),
\r
929 } CMU_Clock_TypeDef;
\r
932 /** Oscillator types. */
\r
935 cmuOsc_LFXO, /**< Low frequency crystal oscillator. */
\r
936 cmuOsc_LFRCO, /**< Low frequency RC oscillator. */
\r
937 cmuOsc_HFXO, /**< High frequency crystal oscillator. */
\r
938 cmuOsc_HFRCO, /**< High frequency RC oscillator. */
\r
939 cmuOsc_AUXHFRCO, /**< Auxiliary high frequency RC oscillator. */
\r
940 #if defined( _CMU_STATUS_USHFRCOENS_MASK )
\r
941 cmuOsc_USHFRCO, /**< USB high frequency RC oscillator */
\r
943 #if defined( CMU_LFCLKSEL_LFAE_ULFRCO ) || defined( CMU_LFACLKSEL_LFA_ULFRCO )
\r
944 cmuOsc_ULFRCO /**< Ultra low frequency RC oscillator. */
\r
949 /** Selectable clock sources. */
\r
952 cmuSelect_Error, /**< Usage error. */
\r
953 cmuSelect_Disabled, /**< Clock selector disabled. */
\r
954 cmuSelect_LFXO, /**< Low frequency crystal oscillator. */
\r
955 cmuSelect_LFRCO, /**< Low frequency RC oscillator. */
\r
956 cmuSelect_HFXO, /**< High frequency crystal oscillator. */
\r
957 cmuSelect_HFRCO, /**< High frequency RC oscillator. */
\r
958 #if defined( CMU_LFACLKSEL_LFA_HFCLKLE ) || defined( CMU_LFBCLKSEL_LFB_HFCLKLE )
\r
959 cmuSelect_HFCLKLE, /**< High frequency clock to LE divided by 2 or 4. */
\r
961 cmuSelect_CORELEDIV2, /**< Core low energy clock divided by 2. */
\r
962 cmuSelect_AUXHFRCO, /**< Auxilliary clock source can be used for debug clock */
\r
963 cmuSelect_HFCLK, /**< Divided HFCLK on Giant for debug clock, undivided on Tiny Gecko and for USBC (not used on Gecko) */
\r
964 #if defined( CMU_STATUS_USHFRCOENS )
\r
965 cmuSelect_USHFRCO, /**< USB high frequency RC oscillator */
\r
967 #if defined( CMU_CMD_HFCLKSEL_USHFRCODIV2 )
\r
968 cmuSelect_USHFRCODIV2,/**< USB high frequency RC oscillator */
\r
970 #if defined( CMU_LFCLKSEL_LFAE_ULFRCO ) || defined( CMU_LFACLKSEL_LFA_ULFRCO )
\r
971 cmuSelect_ULFRCO, /**< Ultra low frequency RC oscillator. */
\r
973 } CMU_Select_TypeDef;
\r
976 /*******************************************************************************
\r
977 ******************************* STRUCTS ***********************************
\r
978 ******************************************************************************/
\r
980 #if defined( _CMU_LFXOCTRL_MASK )
\r
981 /** LFXO initialization structure. Init values should be obtained from a configuration tool,
\r
982 app note or xtal datasheet */
\r
985 uint8_t ctune; /**< CTUNE (load capacitance) value */
\r
986 uint8_t gain; /**< Gain / max startup margin */
\r
987 uint8_t timeout; /**< Startup delay */
\r
988 } CMU_LFXOInit_TypeDef;
\r
990 /** Default LFXO initialization */
\r
991 #define CMU_LFXOINIT_DEFAULT \
\r
993 _CMU_LFXOCTRL_TUNING_DEFAULT, \
\r
994 _CMU_LFXOCTRL_GAIN_DEFAULT, \
\r
995 _CMU_LFXOCTRL_TIMEOUT_DEFAULT, \
\r
999 #if defined( _CMU_HFXOCTRL_MASK )
\r
1000 /** HFXO initialization structure. Init values should be obtained from a configuration tool,
\r
1001 app note or xtal datasheet */
\r
1004 bool lowPowerMode; /**< Enable low-power mode */
\r
1005 bool autoStartEm01; /**< Enable auto-start on entry to EM0/1 */
\r
1006 bool autoSelEm01; /**< Enable auto-select on entry to EM0/1 */
\r
1007 bool autoStartSelOnRacWakeup; /**< Enable auto-start and select on RAC wakeup */
\r
1008 uint16_t ctuneStartup; /**< Startup phase CTUNE (load capacitance) value */
\r
1009 uint16_t ctuneSteadyState; /**< Steady-state phase CTUNE (load capacitance) value */
\r
1010 uint8_t regIshStartup; /**< Shunt startup current */
\r
1011 uint8_t regIshSteadyState; /**< Shunt steady-state current */
\r
1012 uint8_t xoCoreBiasTrimStartup; /**< Startup XO core bias current trim */
\r
1013 uint8_t xoCoreBiasTrimSteadyState; /**< Steady-state XO core bias current trim */
\r
1014 uint8_t thresholdPeakDetect; /**< Peak detection threshold */
\r
1015 uint8_t timeoutShuntOptimization; /**< Timeout - shunt optimization */
\r
1016 uint8_t timeoutPeakDetect; /**< Timeout - peak detection */
\r
1017 uint8_t timeoutWarmSteady; /**< Timeout - warmup */
\r
1018 uint8_t timeoutSteady; /**< Timeout - steady-state */
\r
1019 uint8_t timeoutStartup; /**< Timeout - startup */
\r
1020 } CMU_HFXOInit_TypeDef;
\r
1022 /** Default HFXO initialization */
\r
1023 #if defined( _EFR_DEVICE )
\r
1024 #define CMU_HFXOINIT_DEFAULT \
\r
1026 false, /* Low-noise mode for EFR32 */ \
\r
1027 false, /* Disable auto-start on EM0/1 entry */ \
\r
1028 false, /* Disable auto-select on EM0/1 entry */ \
\r
1029 false, /* Disable auto-start and select on RAC wakeup */ \
\r
1030 _CMU_HFXOSTARTUPCTRL_CTUNE_DEFAULT, \
\r
1031 _CMU_HFXOSTEADYSTATECTRL_CTUNE_DEFAULT, \
\r
1032 _CMU_HFXOSTARTUPCTRL_REGISHWARM_DEFAULT, \
\r
1033 _CMU_HFXOSTEADYSTATECTRL_REGISH_DEFAULT, \
\r
1034 _CMU_HFXOSTARTUPCTRL_IBTRIMXOCORE_DEFAULT, \
\r
1035 0x7, /* Recommended steady-state XO core bias current */ \
\r
1036 0x6, /* Recommended peak detection threshold */ \
\r
1037 _CMU_HFXOTIMEOUTCTRL_SHUNTOPTTIMEOUT_DEFAULT, \
\r
1038 0xA, /* Recommended peak detection timeout */ \
\r
1039 _CMU_HFXOTIMEOUTCTRL_WARMSTEADYTIMEOUT_DEFAULT, \
\r
1040 _CMU_HFXOTIMEOUTCTRL_STEADYTIMEOUT_DEFAULT, \
\r
1041 _CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_DEFAULT, \
\r
1043 /* EFM32 device */
\r
1045 #define CMU_HFXOINIT_DEFAULT \
\r
1047 true, /* Low-power mode for EFM32 */ \
\r
1048 false, /* Disable auto-start on EM0/1 entry */ \
\r
1049 false, /* Disable auto-select on EM0/1 entry */ \
\r
1050 false, /* Disable auto-start and select on RAC wakeup */ \
\r
1051 _CMU_HFXOSTARTUPCTRL_CTUNE_DEFAULT, \
\r
1052 _CMU_HFXOSTEADYSTATECTRL_CTUNE_DEFAULT, \
\r
1053 _CMU_HFXOSTARTUPCTRL_REGISHWARM_DEFAULT, \
\r
1054 _CMU_HFXOSTEADYSTATECTRL_REGISH_DEFAULT, \
\r
1055 _CMU_HFXOSTARTUPCTRL_IBTRIMXOCORE_DEFAULT, \
\r
1056 0x7, /* Recommended steady-state osc core bias current */ \
\r
1057 0x6, /* Recommended peak detection threshold */ \
\r
1058 _CMU_HFXOTIMEOUTCTRL_SHUNTOPTTIMEOUT_DEFAULT, \
\r
1059 0xA, /* Recommended peak detection timeout */ \
\r
1060 _CMU_HFXOTIMEOUTCTRL_WARMSTEADYTIMEOUT_DEFAULT, \
\r
1061 _CMU_HFXOTIMEOUTCTRL_STEADYTIMEOUT_DEFAULT, \
\r
1062 _CMU_HFXOTIMEOUTCTRL_STARTUPTIMEOUT_DEFAULT, \
\r
1065 #endif /* _CMU_HFXOCTRL_MASK */
\r
1068 /*******************************************************************************
\r
1069 ***************************** PROTOTYPES **********************************
\r
1070 ******************************************************************************/
\r
1072 #if defined( _CMU_AUXHFRCOCTRL_BAND_MASK )
\r
1073 CMU_AUXHFRCOBand_TypeDef CMU_AUXHFRCOBandGet(void);
\r
1074 void CMU_AUXHFRCOBandSet(CMU_AUXHFRCOBand_TypeDef band);
\r
1076 #elif defined( _CMU_AUXHFRCOCTRL_FREQRANGE_MASK )
\r
1077 CMU_AUXHFRCOFreq_TypeDef CMU_AUXHFRCOFreqGet(void);
\r
1078 void CMU_AUXHFRCOFreqSet(CMU_AUXHFRCOFreq_TypeDef freqEnum);
\r
1081 uint32_t CMU_Calibrate(uint32_t HFCycles, CMU_Osc_TypeDef reference);
\r
1083 #if defined( _CMU_CALCTRL_UPSEL_MASK ) && defined( _CMU_CALCTRL_DOWNSEL_MASK )
\r
1084 void CMU_CalibrateConfig(uint32_t downCycles, CMU_Osc_TypeDef downSel,
\r
1085 CMU_Osc_TypeDef upSel);
\r
1088 uint32_t CMU_CalibrateCountGet(void);
\r
1089 void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable);
\r
1090 CMU_ClkDiv_TypeDef CMU_ClockDivGet(CMU_Clock_TypeDef clock);
\r
1091 void CMU_ClockDivSet(CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div);
\r
1092 uint32_t CMU_ClockFreqGet(CMU_Clock_TypeDef clock);
\r
1094 #if defined( _SILICON_LABS_32B_PLATFORM_2 )
\r
1095 void CMU_ClockPrescSet(CMU_Clock_TypeDef clock, uint32_t presc);
\r
1096 uint32_t CMU_ClockPrescGet(CMU_Clock_TypeDef clock);
\r
1099 void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref);
\r
1100 CMU_Select_TypeDef CMU_ClockSelectGet(CMU_Clock_TypeDef clock);
\r
1101 void CMU_FreezeEnable(bool enable);
\r
1103 #if defined( _CMU_HFRCOCTRL_BAND_MASK )
\r
1104 CMU_HFRCOBand_TypeDef CMU_HFRCOBandGet(void);
\r
1105 void CMU_HFRCOBandSet(CMU_HFRCOBand_TypeDef band);
\r
1107 #elif defined( _CMU_HFRCOCTRL_FREQRANGE_MASK )
\r
1108 CMU_HFRCOFreq_TypeDef CMU_HFRCOFreqGet(void);
\r
1109 void CMU_HFRCOFreqSet(CMU_HFRCOFreq_TypeDef freqEnum);
\r
1112 uint32_t CMU_HFRCOStartupDelayGet(void);
\r
1113 void CMU_HFRCOStartupDelaySet(uint32_t delay);
\r
1115 #if defined( _CMU_HFXOCTRL_AUTOSTARTRDYSELRAC_MASK )
\r
1116 void CMU_HFXOAutostartEnable(bool enRACStartSel,
\r
1117 bool enEM0EM1Start,
\r
1118 bool enEM0EM1StartSel);
\r
1121 #if defined( _CMU_HFXOCTRL_MASK )
\r
1122 void CMU_HFXOInit(CMU_HFXOInit_TypeDef *hfxoInit);
\r
1126 uint32_t CMU_LCDClkFDIVGet(void);
\r
1127 void CMU_LCDClkFDIVSet(uint32_t div);
\r
1129 #if defined( _CMU_LFXOCTRL_MASK )
\r
1130 void CMU_LFXOInit(CMU_LFXOInit_TypeDef *lfxoInit);
\r
1133 void CMU_OscillatorEnable(CMU_Osc_TypeDef osc, bool enable, bool wait);
\r
1134 uint32_t CMU_OscillatorTuningGet(CMU_Osc_TypeDef osc);
\r
1135 void CMU_OscillatorTuningSet(CMU_Osc_TypeDef osc, uint32_t val);
\r
1136 bool CMU_PCNTClockExternalGet(unsigned int instance);
\r
1137 void CMU_PCNTClockExternalSet(unsigned int instance, bool external);
\r
1139 #if defined( _CMU_USHFRCOCONF_BAND_MASK )
\r
1140 CMU_USHFRCOBand_TypeDef CMU_USHFRCOBandGet(void);
\r
1141 void CMU_USHFRCOBandSet(CMU_USHFRCOBand_TypeDef band);
\r
1145 #if defined( CMU_CALCTRL_CONT )
\r
1146 /***************************************************************************//**
\r
1148 * Configures continuous calibration mode
\r
1149 * @param[in] enable
\r
1150 * If true, enables continuous calibration, if false disables continuous
\r
1152 ******************************************************************************/
\r
1153 __STATIC_INLINE void CMU_CalibrateCont(bool enable)
\r
1155 BUS_RegBitWrite(&(CMU->CALCTRL), _CMU_CALCTRL_CONT_SHIFT, enable);
\r
1160 /***************************************************************************//**
\r
1162 * Starts calibration
\r
1164 * This call is usually invoked after CMU_CalibrateConfig() and possibly
\r
1165 * CMU_CalibrateCont()
\r
1166 ******************************************************************************/
\r
1167 __STATIC_INLINE void CMU_CalibrateStart(void)
\r
1169 CMU->CMD = CMU_CMD_CALSTART;
\r
1173 #if defined( CMU_CMD_CALSTOP )
\r
1174 /***************************************************************************//**
\r
1176 * Stop the calibration counters
\r
1177 ******************************************************************************/
\r
1178 __STATIC_INLINE void CMU_CalibrateStop(void)
\r
1180 CMU->CMD = CMU_CMD_CALSTOP;
\r
1185 /***************************************************************************//**
\r
1187 * Convert dividend to logarithmic value. Only works for even
\r
1188 * numbers equal to 2^n.
\r
1191 * Unscaled dividend.
\r
1194 * Logarithm of 2, as used by fixed prescalers.
\r
1195 ******************************************************************************/
\r
1196 __STATIC_INLINE uint32_t CMU_DivToLog2(CMU_ClkDiv_TypeDef div)
\r
1200 /* Fixed 2^n prescalers take argument of 32768 or less. */
\r
1201 EFM_ASSERT((div > 0U) && (div <= 32768U));
\r
1203 /* Count leading zeroes and "reverse" result */
\r
1204 log2 = (31U - __CLZ(div));
\r
1210 /***************************************************************************//**
\r
1212 * Clear one or more pending CMU interrupts.
\r
1214 * @param[in] flags
\r
1215 * CMU interrupt sources to clear.
\r
1216 ******************************************************************************/
\r
1217 __STATIC_INLINE void CMU_IntClear(uint32_t flags)
\r
1223 /***************************************************************************//**
\r
1225 * Disable one or more CMU interrupts.
\r
1227 * @param[in] flags
\r
1228 * CMU interrupt sources to disable.
\r
1229 ******************************************************************************/
\r
1230 __STATIC_INLINE void CMU_IntDisable(uint32_t flags)
\r
1232 CMU->IEN &= ~flags;
\r
1236 /***************************************************************************//**
\r
1238 * Enable one or more CMU interrupts.
\r
1241 * Depending on the use, a pending interrupt may already be set prior to
\r
1242 * enabling the interrupt. Consider using CMU_IntClear() prior to enabling
\r
1243 * if such a pending interrupt should be ignored.
\r
1245 * @param[in] flags
\r
1246 * CMU interrupt sources to enable.
\r
1247 ******************************************************************************/
\r
1248 __STATIC_INLINE void CMU_IntEnable(uint32_t flags)
\r
1250 CMU->IEN |= flags;
\r
1254 /***************************************************************************//**
\r
1256 * Get pending CMU interrupts.
\r
1259 * CMU interrupt sources pending.
\r
1260 ******************************************************************************/
\r
1261 __STATIC_INLINE uint32_t CMU_IntGet(void)
\r
1267 /***************************************************************************//**
\r
1269 * Get enabled and pending CMU interrupt flags.
\r
1272 * Useful for handling more interrupt sources in the same interrupt handler.
\r
1275 * The event bits are not cleared by the use of this function.
\r
1278 * Pending and enabled CMU interrupt sources
\r
1279 * The return value is the bitwise AND of
\r
1280 * - the enabled interrupt sources in CMU_IEN and
\r
1281 * - the pending interrupt flags CMU_IF
\r
1282 ******************************************************************************/
\r
1283 __STATIC_INLINE uint32_t CMU_IntGetEnabled(void)
\r
1288 return CMU->IF & ien;
\r
1292 /**************************************************************************//**
\r
1294 * Set one or more pending CMU interrupts.
\r
1296 * @param[in] flags
\r
1297 * CMU interrupt sources to set to pending.
\r
1298 *****************************************************************************/
\r
1299 __STATIC_INLINE void CMU_IntSet(uint32_t flags)
\r
1305 /***************************************************************************//**
\r
1307 * Lock the CMU in order to protect some of its registers against unintended
\r
1311 * Please refer to the reference manual for CMU registers that will be
\r
1315 * If locking the CMU registers, they must be unlocked prior to using any
\r
1316 * CMU API functions modifying CMU registers protected by the lock.
\r
1317 ******************************************************************************/
\r
1318 __STATIC_INLINE void CMU_Lock(void)
\r
1320 CMU->LOCK = CMU_LOCK_LOCKKEY_LOCK;
\r
1324 /***************************************************************************//**
\r
1326 * Convert logarithm of 2 prescaler to division factor.
\r
1329 * Logarithm of 2, as used by fixed prescalers.
\r
1333 ******************************************************************************/
\r
1334 __STATIC_INLINE uint32_t CMU_Log2ToDiv(uint32_t log2)
\r
1340 #if defined( _SILICON_LABS_32B_PLATFORM_2 )
\r
1341 /***************************************************************************//**
\r
1343 * Convert prescaler dividend to logarithmic value. Only works for even
\r
1344 * numbers equal to 2^n.
\r
1346 * @param[in] presc
\r
1347 * Unscaled dividend (dividend = presc + 1).
\r
1350 * Logarithm of 2, as used by fixed 2^n prescalers.
\r
1351 ******************************************************************************/
\r
1352 __STATIC_INLINE uint32_t CMU_PrescToLog2(CMU_ClkPresc_TypeDef presc)
\r
1356 /* Integer prescalers take argument less than 32768. */
\r
1357 EFM_ASSERT(presc < 32768U);
\r
1359 /* Count leading zeroes and "reverse" result */
\r
1360 log2 = (31U - __CLZ(presc + 1));
\r
1362 /* Check that presc is a 2^n number */
\r
1363 EFM_ASSERT(presc == (CMU_Log2ToDiv(log2) - 1));
\r
1370 /***************************************************************************//**
\r
1372 * Unlock the CMU so that writing to locked registers again is possible.
\r
1373 ******************************************************************************/
\r
1374 __STATIC_INLINE void CMU_Unlock(void)
\r
1376 CMU->LOCK = CMU_LOCK_LOCKKEY_UNLOCK;
\r
1379 /** @} (end addtogroup CMU) */
\r
1380 /** @} (end addtogroup EM_Library) */
\r
1382 #ifdef __cplusplus
\r
1386 #endif /* defined( CMU_PRESENT ) */
\r
1387 #endif /* __SILICON_LABS_EM_CMU_H__ */
\r