rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_clock.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright (c) 2016 - 2017 , NXP
4 * All rights reserved.
5 *
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 */
9
10#ifndef _FSL_CLOCK_H_
11#define _FSL_CLOCK_H_
12
13#include "fsl_common.h"
14
15/*! @addtogroup clock */
16/*! @{ */
17
18/*! @file */
19
20/*******************************************************************************
21 * Configurations
22 ******************************************************************************/
23
24/*! @brief Configure whether driver controls clock
25 *
26 * When set to 0, peripheral drivers will enable clock in initialize function
27 * and disable clock in de-initialize function. When set to 1, peripheral
28 * driver will not control the clock, application could control the clock out of
29 * the driver.
30 *
31 * @note All drivers share this feature switcher. If it is set to 1, application
32 * should handle clock enable and disable for all drivers.
33 */
34#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL))
35#define FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL 0
36#endif
37
38/*******************************************************************************
39 * Definitions
40 ******************************************************************************/
41
42/*! @name Driver version */
43/*@{*/
44/*! @brief CLOCK driver version 2.1.2. */
45#define FSL_CLOCK_DRIVER_VERSION (MAKE_VERSION(2, 1, 2))
46/*@}*/
47
48/*! @brief External XTAL0 (OSC0/SYSOSC) clock frequency.
49 *
50 * The XTAL0/EXTAL0 (OSC0/SYSOSC) clock frequency in Hz. When the clock is set up, use the
51 * function CLOCK_SetXtal0Freq to set the value in the clock driver. For example,
52 * if XTAL0 is 8 MHz:
53 * @code
54 * CLOCK_InitSysOsc(...); // Set up the OSC0/SYSOSC
55 * CLOCK_SetXtal0Freq(80000000); // Set the XTAL0 value in the clock driver.
56 * @endcode
57 *
58 * This is important for the multicore platforms where only one core needs to set up the
59 * OSC0/SYSOSC using CLOCK_InitSysOsc. All other cores need to call the CLOCK_SetXtal0Freq
60 * to get a valid clock frequency.
61 */
62extern volatile uint32_t g_xtal0Freq;
63
64/*! @brief External XTAL32/EXTAL32 clock frequency.
65 *
66 * The XTAL32/EXTAL32 clock frequency in Hz. When the clock is set up, use the
67 * function CLOCK_SetXtal32Freq to set the value in the clock driver.
68 *
69 * This is important for the multicore platforms where only one core needs to set up
70 * the clock. All other cores need to call the CLOCK_SetXtal32Freq
71 * to get a valid clock frequency.
72 */
73extern volatile uint32_t g_xtal32Freq;
74
75/*! @brief Clock ip name array for DMAMUX. */
76#define DMAMUX_CLOCKS \
77 { \
78 kCLOCK_Dmamux0 \
79 }
80
81/*! @brief Clock ip name array for RTC. */
82#define RTC_CLOCKS \
83 { \
84 kCLOCK_Rtc0 \
85 }
86
87/*! @brief Clock ip name array for RTCOSC. */
88#define RTCOSC_CLOCKS \
89 { \
90 kCLOCK_RtcOsc0 \
91 }
92
93/*! @brief Clock ip name array for PORT. */
94#define PORT_CLOCKS \
95 { \
96 kCLOCK_PortA, kCLOCK_PortB, kCLOCK_PortC, kCLOCK_PortD, kCLOCK_PortE \
97 }
98
99/*! @brief Clock ip name array for LPI2C. */
100#define LPI2C_CLOCKS \
101 { \
102 kCLOCK_Lpi2c0, kCLOCK_Lpi2c1 \
103 }
104
105/*! @brief Clock ip name array for FLEXIO. */
106#define FLEXIO_CLOCKS \
107 { \
108 kCLOCK_Flexio0 \
109 }
110
111/*! @brief Clock ip name array for EDMA. */
112#define EDMA_CLOCKS \
113 { \
114 kCLOCK_Dma0 \
115 }
116
117/*! @brief Clock ip name array for LPUART. */
118#define LPUART_CLOCKS \
119 { \
120 kCLOCK_Lpuart0, kCLOCK_Lpuart1, kCLOCK_Lpuart2 \
121 }
122
123/*! @brief Clock ip name array for DAC. */
124#define DAC_CLOCKS \
125 { \
126 kCLOCK_Dac0 \
127 }
128
129/*! @brief Clock ip name array for LPTMR. */
130#define LPTMR_CLOCKS \
131 { \
132 kCLOCK_Lptmr0 \
133 }
134
135/*! @brief Clock ip name array for ADC16. */
136#define ADC12_CLOCKS \
137 { \
138 kCLOCK_Adc0, kCLOCK_Adc1, kCLOCK_Adc2 \
139 }
140
141/*! @brief Clock ip name array for LPSPI. */
142#define LPSPI_CLOCKS \
143 { \
144 kCLOCK_Lpspi0, kCLOCK_Lpspi1 \
145 }
146
147/*! @brief Clock ip name array for LPIT. */
148#define LPIT_CLOCKS \
149 { \
150 kCLOCK_Lpit0 \
151 }
152
153/*! @brief Clock ip name array for CRC. */
154#define CRC_CLOCKS \
155 { \
156 kCLOCK_Crc0 \
157 }
158
159/*! @brief Clock ip name array for CMP. */
160#define CMP_CLOCKS \
161 { \
162 kCLOCK_Cmp0, kCLOCK_Cmp1, kCLOCK_Cmp2 \
163 }
164
165/*! @brief Clock ip name array for FLASH. */
166#define FLASH_CLOCKS \
167 { \
168 kCLOCK_Flash0 \
169 }
170
171/*! @brief Clock ip name array for MPU. */
172#define SYSMPU_CLOCKS \
173 { \
174 kCLOCK_Sysmpu0 \
175 }
176
177/*! @brief Clock ip name array for EWM. */
178#define EWM_CLOCKS \
179 { \
180 kCLOCK_Ewm0 \
181 }
182
183/*! @brief Clock ip name array for FLEXCAN. */
184#define FLEXCAN_CLOCKS \
185 { \
186 kCLOCK_Flexcan0, kCLOCK_Flexcan1 \
187 }
188
189/*! @brief Clock ip name array for FLEXTMR. */
190#define FTM_CLOCKS \
191 { \
192 kCLOCK_Ftm0, kCLOCK_Ftm1, kCLOCK_Ftm2, kCLOCK_Ftm3 \
193 }
194
195/*! @brief Clock ip name array for PDB. */
196#define PDB_CLOCKS \
197 { \
198 kCLOCK_Pdb0, kCLOCK_Pdb1, kCLOCK_Pdb2 \
199 }
200
201/*! @brief Clock ip name array for PWT. */
202#define PWT_CLOCKS \
203 { \
204 kCLOCK_Pwt0 \
205 }
206
207/*!
208 * @brief LPO clock frequency.
209 */
210#define LPO_CLK_FREQ 128000U
211
212/*! @brief Clock name used to get clock frequency. */
213typedef enum _clock_name
214{
215 /* ----------------------------- System layer clock -------------------------------*/
216 kCLOCK_CoreSysClk, /*!< Core/system clock */
217 kCLOCK_BusClk, /*!< Bus clock */
218 kCLOCK_FlexBusClk, /*!< FlexBus clock */
219 kCLOCK_FlashClk, /*!< Flash clock */
220
221 /* ------------------------------------ SCG clock ---------------------------------*/
222 kCLOCK_ScgSysOscClk, /*!< SCG system OSC clock. (SYSOSC) */
223 kCLOCK_ScgSircClk, /*!< SCG SIRC clock. */
224 kCLOCK_ScgFircClk, /*!< SCG FIRC clock. */
225 kCLOCK_ScgSysPllClk, /*!< SCG system PLL clock. (SYSPLL) */
226
227 kCLOCK_ScgSysOscAsyncDiv1Clk, /*!< SOSCDIV1_CLK. */
228 kCLOCK_ScgSysOscAsyncDiv2Clk, /*!< SOSCDIV2_CLK. */
229
230 kCLOCK_ScgSircAsyncDiv1Clk, /*!< SIRCDIV1_CLK. */
231 kCLOCK_ScgSircAsyncDiv2Clk, /*!< SIRCDIV2_CLK. */
232
233 kCLOCK_ScgFircAsyncDiv1Clk, /*!< FIRCDIV1_CLK. */
234 kCLOCK_ScgFircAsyncDiv2Clk, /*!< FIRCDIV2_CLK. */
235
236 kCLOCK_ScgSysPllAsyncDiv1Clk, /*!< SPLLDIV1_CLK. */
237 kCLOCK_ScgSysPllAsyncDiv2Clk, /*!< SPLLDIV2_CLK. */
238
239 /* --------------------------------- Other clock ----------------------------------*/
240 kCLOCK_LpoClk, /*!< LPO clock */
241 kCLOCK_Osc32kClk, /*!< External OSC 32K clock (OSC32KCLK) */
242 kCLOCK_ErClk, /*!< ERCLK. The external reference clock from SCG. */
244
245#define kCLOCK_Osc0ErClk kCLOCK_ErClk
246#define kCLOCK_Er32kClk kCLOCK_Osc32kClk
247#define CLOCK_GetOsc0ErClkFreq CLOCK_GetErClkFreq /*!< For compatible with other MCG platforms. */
248#define CLOCK_GetEr32kClkFreq CLOCK_GetOsc32kClkFreq /*!< For compatible with other MCG platforms. */
249
250/*!
251 * @brief Clock source for peripherals that support various clock selections.
252 */
253typedef enum _clock_ip_src
254{
255 kCLOCK_IpSrcNoneOrExt = 0U, /*!< Clock is off or external clock is used. */
256 kCLOCK_IpSrcSysOscAsync = 1U, /*!< System Oscillator async clock. */
257 kCLOCK_IpSrcSircAsync = 2U, /*!< Slow IRC async clock. */
258 kCLOCK_IpSrcFircAsync = 3U, /*!< Fast IRC async clock. */
259 kCLOCK_IpSrcSysPllAsync = 6U /*!< System PLL async clock. */
261
262/*!
263 * @brief Peripheral clock name difinition used for clock gate, clock source
264 * and clock divider setting. It is defined as the corresponding register address.
265 */
266typedef enum _clock_ip_name
267{
269
270 /* PCC 0 */
271 kCLOCK_Dma0 = 0x40065020U,
272 kCLOCK_Sysmpu0 = 0x40065034U,
273 kCLOCK_Flash0 = 0x40065080U,
274 kCLOCK_Dmamux0 = 0x40065084U,
275 kCLOCK_Flexcan0 = 0x40065090U,
276 kCLOCK_Flexcan1 = 0x40065094U,
277 kCLOCK_Ftm3 = 0x40065098U,
278 kCLOCK_Adc1 = 0x4006509CU,
279 kCLOCK_Lpspi0 = 0x400650B0U,
280 kCLOCK_Lpspi1 = 0x400650B4U,
281 kCLOCK_Pdb1 = 0x400650C4U,
282 kCLOCK_Crc0 = 0x400650C8U,
283 kCLOCK_Pdb2 = 0x400650CCU,
284 kCLOCK_Pdb0 = 0x400650D8U,
285 kCLOCK_Lpit0 = 0x400650DCU,
286 kCLOCK_Ftm0 = 0x400650E0U,
287 kCLOCK_Ftm1 = 0x400650E4U,
288 kCLOCK_Ftm2 = 0x400650E8U,
289 kCLOCK_Adc0 = 0x400650ECU,
290 kCLOCK_Adc2 = 0x400650F0U,
291 kCLOCK_Rtc0 = 0x400650F4U,
292 kCLOCK_Dac0 = 0x400650FCU,
293 kCLOCK_Lptmr0 = 0x40065100U,
294 kCLOCK_PortA = 0x40065124U,
295 kCLOCK_PortB = 0x40065128U,
296 kCLOCK_PortC = 0x4006512CU,
297 kCLOCK_PortD = 0x40065130U,
298 kCLOCK_PortE = 0x40065134U,
299 kCLOCK_Pwt0 = 0x40065158U,
300 kCLOCK_Flexio0 = 0x40065168U,
301 kCLOCK_RtcOsc0 = 0x40065180U,
302 kCLOCK_Ewm0 = 0x40065184U,
303 kCLOCK_Lpi2c0 = 0x40065198U,
304 kCLOCK_Lpi2c1 = 0x4006519CU,
305 kCLOCK_Lpuart0 = 0x400651A8U,
306 kCLOCK_Lpuart1 = 0x400651ACU,
307 kCLOCK_Lpuart2 = 0x400651B0U,
308 kCLOCK_Cmp0 = 0x400651CCU,
309 kCLOCK_Cmp1 = 0x400651D0U,
310 kCLOCK_Cmp2 = 0x400651D4U,
312
313/*!
314 * @brief OSC32 work mode.
315 */
316typedef enum _osc32_mode
317{
318 kOSC32_Bypass = OSC32_CR_ROSCEN_MASK, /*!< Bypass mode, use external input clock directly. */
319 kOSC32_Crystal = OSC32_CR_ROSCEN_MASK | OSC32_CR_ROSCEREFS_MASK, /*!< Crystal mode, does not work in stop mode. */
320 kOSC32_CrystalEnableInStop = OSC32_CR_ROSCEN_MASK | OSC32_CR_ROSCSTPEN_MASK |
321 OSC32_CR_ROSCEREFS_MASK, /*!< Crystal mode, still work in stop mode. */
323
324/*!
325 * @brief SCG status return codes.
326 */
328{
329 kStatus_SCG_Busy = MAKE_STATUS(kStatusGroup_SCG, 1), /*!< Clock is busy. */
330 kStatus_SCG_InvalidSrc = MAKE_STATUS(kStatusGroup_SCG, 2) /*!< Invalid source. */
332
333/*!
334 * @brief SCG system clock type.
335 */
336typedef enum _scg_sys_clk
337{
338 kSCG_SysClkSlow, /*!< System slow clock. */
339 kSCG_SysClkBus, /*!< Bus clock. */
340 kSCG_SysClkCore, /*!< Core clock. */
342
343/*!
344 * @brief SCG system clock source.
345 */
347{
348 kSCG_SysClkSrcSysOsc = 1U, /*!< System OSC. */
349 kSCG_SysClkSrcSirc = 2U, /*!< Slow IRC. */
350 kSCG_SysClkSrcFirc = 3U, /*!< Fast IRC. */
351 kSCG_SysClkSrcSysPll = 6U /*!< System PLL. */
353
354/*!
355 * @brief SCG system clock divider value.
356 */
358{
359 kSCG_SysClkDivBy1 = 0U, /*!< Divided by 1. */
360 kSCG_SysClkDivBy2 = 1U, /*!< Divided by 2. */
361 kSCG_SysClkDivBy3 = 2U, /*!< Divided by 3. */
362 kSCG_SysClkDivBy4 = 3U, /*!< Divided by 4. */
363 kSCG_SysClkDivBy5 = 4U, /*!< Divided by 5. */
364 kSCG_SysClkDivBy6 = 5U, /*!< Divided by 6. */
365 kSCG_SysClkDivBy7 = 6U, /*!< Divided by 7. */
366 kSCG_SysClkDivBy8 = 7U, /*!< Divided by 8. */
367 kSCG_SysClkDivBy9 = 8U, /*!< Divided by 9. */
368 kSCG_SysClkDivBy10 = 9U, /*!< Divided by 10. */
369 kSCG_SysClkDivBy11 = 10U, /*!< Divided by 11. */
370 kSCG_SysClkDivBy12 = 11U, /*!< Divided by 12. */
371 kSCG_SysClkDivBy13 = 12U, /*!< Divided by 13. */
372 kSCG_SysClkDivBy14 = 13U, /*!< Divided by 14. */
373 kSCG_SysClkDivBy15 = 14U, /*!< Divided by 15. */
374 kSCG_SysClkDivBy16 = 15U /*!< Divided by 16. */
376
377/*!
378 * @brief SCG system clock configuration.
379 */
381{
382 uint32_t divSlow : 4; /*!< Slow clock divider, see @ref scg_sys_clk_div_t. */
383 uint32_t divBus : 4; /*!< Bus clock divider, see @ref scg_sys_clk_div_t. */
384 uint32_t : 4; /*!< Reserved. */
385 uint32_t : 4; /*!< Reserved. */
386 uint32_t divCore : 4; /*!< Core clock divider, see @ref scg_sys_clk_div_t. */
387 uint32_t : 4; /*!< Reserved. */
388 uint32_t src : 4; /*!< System clock source, see @ref scg_sys_clk_src_t. */
389 uint32_t : 4; /*!< reserved. */
391
392/*!
393 * @brief SCG clock out configuration (CLKOUTSEL).
394 */
396{
397 kClockClkoutSelScgSlow = 0U, /*!< SCG slow clock. */
398 kClockClkoutSelSysOsc = 1U, /*!< System OSC. */
399 kClockClkoutSelSirc = 2U, /*!< Slow IRC. */
400 kClockClkoutSelFirc = 3U, /*!< Fast IRC. */
401 kClockClkoutSelSysPll = 6U /*!< System PLL. */
403
404/*!
405 * @brief SCG asynchronous clock type.
406 */
407typedef enum _scg_async_clk
408{
409 kSCG_AsyncDiv1Clk, /*!< The async clock by DIV1, e.g. SOSCDIV1_CLK, SIRCDIV1_CLK. */
410 kSCG_AsyncDiv2Clk, /*!< The async clock by DIV2, e.g. SOSCDIV2_CLK, SIRCDIV2_CLK. */
412
413/*!
414 * @brief SCG asynchronous clock divider value.
415 */
417{
418 kSCG_AsyncClkDisable = 0U, /*!< Clock output is disabled. */
419 kSCG_AsyncClkDivBy1 = 1U, /*!< Divided by 1. */
420 kSCG_AsyncClkDivBy2 = 2U, /*!< Divided by 2. */
421 kSCG_AsyncClkDivBy4 = 3U, /*!< Divided by 4. */
422 kSCG_AsyncClkDivBy8 = 4U, /*!< Divided by 8. */
423 kSCG_AsyncClkDivBy16 = 5U, /*!< Divided by 16. */
424 kSCG_AsyncClkDivBy32 = 6U, /*!< Divided by 32. */
425 kSCG_AsyncClkDivBy64 = 7U /*!< Divided by 64. */
427
428/*!
429 * @brief SCG system OSC monitor mode.
430 */
432{
433 kSCG_SysOscMonitorDisable = 0U, /*!< Monitor disabled. */
434 kSCG_SysOscMonitorInt = SCG_SOSCCSR_SOSCCM_MASK, /*!< Interrupt when the system OSC error is detected. */
436 SCG_SOSCCSR_SOSCCM_MASK | SCG_SOSCCSR_SOSCCMRE_MASK /*!< Reset when the system OSC error is detected. */
438
439/*! @brief OSC work mode. */
440typedef enum _scg_sosc_mode
441{
442 kSCG_SysOscModeExt = 0U, /*!< Use external clock. */
443 kSCG_SysOscModeOscLowPower = SCG_SOSCCFG_EREFS_MASK, /*!< Oscillator low power. */
444 kSCG_SysOscModeOscHighGain = SCG_SOSCCFG_EREFS_MASK | SCG_SOSCCFG_HGO_MASK /*!< Oscillator high gain. */
446
447/*! @brief OSC enable mode. */
449{
450 kSCG_SysOscEnable = SCG_SOSCCSR_SOSCEN_MASK, /*!< Enable OSC clock. */
451 kSCG_SysOscEnableInStop = SCG_SOSCCSR_SOSCSTEN_MASK, /*!< Enable OSC in stop mode. */
452 kSCG_SysOscEnableInLowPower = SCG_SOSCCSR_SOSCLPEN_MASK, /*!< Enable OSC in low power mode. */
453 kSCG_SysOscEnableErClk = SCG_SOSCCSR_SOSCERCLKEN_MASK /*!< Enable OSCERCLK. */
455
456/*!
457 * @brief SCG system OSC configuration.
458 */
459typedef struct _scg_sosc_config
460{
461 uint32_t freq; /*!< System OSC frequency. */
462 scg_sosc_monitor_mode_t monitorMode; /*!< Clock monitor mode selected. */
463 uint8_t enableMode; /*!< Enable mode, OR'ed value of _scg_sosc_enable_mode. */
464
465 scg_async_clk_div_t div1; /*!< SOSCDIV1 value. */
466 scg_async_clk_div_t div2; /*!< SOSCDIV2 value. */
467
468 scg_sosc_mode_t workMode; /*!< OSC work mode. */
470
471/*!
472 * @brief SCG slow IRC clock frequency range.
473 */
474typedef enum _scg_sirc_range
475{
476 kSCG_SircRangeLow, /*!< Slow IRC low range clock (2 MHz, 4 MHz for i.MX 7 ULP). */
477 kSCG_SircRangeHigh /*!< Slow IRC high range clock (8 MHz, 16 MHz for i.MX 7 ULP). */
479
480/*! @brief SIRC enable mode. */
482{
483 kSCG_SircEnable = SCG_SIRCCSR_SIRCEN_MASK, /*!< Enable SIRC clock. */
484 kSCG_SircEnableInStop = SCG_SIRCCSR_SIRCSTEN_MASK, /*!< Enable SIRC in stop mode. */
485 kSCG_SircEnableInLowPower = SCG_SIRCCSR_SIRCLPEN_MASK /*!< Enable SIRC in low power mode. */
487
488/*!
489 * @brief SCG slow IRC clock configuration.
490 */
491typedef struct _scg_sirc_config
492{
493 uint32_t enableMode; /*!< Enable mode, OR'ed value of _scg_sirc_enable_mode. */
494 scg_async_clk_div_t div1; /*!< SIRCDIV1 value. */
495 scg_async_clk_div_t div2; /*!< SIRCDIV2 value. */
496
497 scg_sirc_range_t range; /*!< Slow IRC frequency range. */
499
500/*!
501 * @brief SCG fast IRC trim mode.
502 */
504{
505 kSCG_FircTrimNonUpdate = SCG_FIRCCSR_FIRCTREN_MASK,
506 /*!< FIRC trim enable but not enable trim value update. In this mode, the
507 trim value is fixed to the initialized value which is defined by
508 trimCoar and trimFine in configure structure \ref scg_firc_trim_config_t.*/
509
510 kSCG_FircTrimUpdate = SCG_FIRCCSR_FIRCTREN_MASK | SCG_FIRCCSR_FIRCTRUP_MASK
511 /*!< FIRC trim enable and trim value update enable. In this mode, the trim
512 value is auto update. */
513
515
516/*!
517 * @brief SCG fast IRC trim predivided value for system OSC.
518 */
520{
521 kSCG_FircTrimDivBy1, /*!< Divided by 1. */
522 kSCG_FircTrimDivBy128, /*!< Divided by 128. */
523 kSCG_FircTrimDivBy256, /*!< Divided by 256. */
524 kSCG_FircTrimDivBy512, /*!< Divided by 512. */
525 kSCG_FircTrimDivBy1024, /*!< Divided by 1024. */
526 kSCG_FircTrimDivBy2048 /*!< Divided by 2048. */
528
529/*!
530 * @brief SCG fast IRC trim source.
531 */
533{
534 kSCG_FircTrimSrcSysOsc = 2U, /*!< System OSC. */
536
537/*!
538 * @brief SCG fast IRC clock trim configuration.
539 */
541{
542 scg_firc_trim_mode_t trimMode; /*!< FIRC trim mode. */
543 scg_firc_trim_src_t trimSrc; /*!< Trim source. */
544 scg_firc_trim_div_t trimDiv; /*!< Trim predivided value for the system OSC. */
545
546 uint8_t trimCoar; /*!< Trim coarse value; Irrelevant if trimMode is kSCG_FircTrimUpdate. */
547 uint8_t trimFine; /*!< Trim fine value; Irrelevant if trimMode is kSCG_FircTrimUpdate. */
549
550/*!
551 * @brief SCG fast IRC clock frequency range.
552 */
553typedef enum _scg_firc_range
554{
555 kSCG_FircRange48M, /*!< Fast IRC is trimmed to 48 MHz. */
556 kSCG_FircRange52M, /*!< Fast IRC is trimmed to 52 MHz. */
557 kSCG_FircRange56M, /*!< Fast IRC is trimmed to 56 MHz. */
558 kSCG_FircRange60M /*!< Fast IRC is trimmed to 60 MHz. */
560
561/*! @brief FIRC enable mode. */
563{
564 kSCG_FircEnable = SCG_FIRCCSR_FIRCEN_MASK, /*!< Enable FIRC clock. */
565 kSCG_FircEnableInStop = SCG_FIRCCSR_FIRCSTEN_MASK, /*!< Enable FIRC in stop mode. */
566 kSCG_FircEnableInLowPower = SCG_FIRCCSR_FIRCLPEN_MASK, /*!< Enable FIRC in low power mode. */
567 kSCG_FircDisableRegulator = SCG_FIRCCSR_FIRCREGOFF_MASK /*!< Disable regulator. */
569
570/*!
571 * @brief SCG fast IRC clock configuration.
572 */
573typedef struct _scg_firc_config_t
574{
575 uint32_t enableMode; /*!< Enable mode, OR'ed value of _scg_firc_enable_mode. */
576
577 scg_async_clk_div_t div1; /*!< FIRCDIV1 value. */
578 scg_async_clk_div_t div2; /*!< FIRCDIV2 value. */
579
580 scg_firc_range_t range; /*!< Fast IRC frequency range. */
581
582 const scg_firc_trim_config_t *trimConfig; /*!< Pointer to the FIRC trim configuration; set NULL to disable trim. */
584
585/*!
586 * @brief SCG system PLL clock source.
587 */
588typedef enum _scg_spll_src
589{
590 kSCG_SysPllSrcSysOsc, /*!< System PLL clock source is system OSC. */
591 kSCG_SysPllSrcFirc /*!< System PLL clock source is fast IRC. */
593
594/*!
595 * @brief SCG system PLL monitor mode.
596 */
598{
599 kSCG_SysPllMonitorDisable = 0U, /*!< Monitor disabled. */
600 kSCG_SysPllMonitorInt = SCG_SPLLCSR_SPLLCM_MASK, /*!< Interrupt when the system PLL error is detected. */
602 SCG_SPLLCSR_SPLLCM_MASK | SCG_SPLLCSR_SPLLCMRE_MASK /*!< Reset when the system PLL error is detected. */
604
605/*! @brief SPLL enable mode. */
607{
608 kSCG_SysPllEnable = SCG_SPLLCSR_SPLLEN_MASK, /*!< Enable SPLL clock. */
609 kSCG_SysPllEnableInStop = SCG_SPLLCSR_SPLLSTEN_MASK /*!< Enable SPLL in stop mode. */
611
612/*!
613 * @brief SCG system PLL configuration.
614 */
615typedef struct _scg_spll_config
616{
617 uint8_t enableMode; /*!< Enable mode, OR'ed value of _scg_spll_enable_mode */
618 scg_spll_monitor_mode_t monitorMode; /*!< Clock monitor mode selected. */
619
620 scg_async_clk_div_t div1; /*!< SPLLDIV1 value. */
621 scg_async_clk_div_t div2; /*!< SPLLDIV2 value. */
622
623 scg_spll_src_t src; /*!< Clock source. */
624 uint8_t prediv; /*!< PLL reference clock divider. */
625 uint8_t mult; /*!< System PLL multiplier. */
627
628/*******************************************************************************
629 * API
630 ******************************************************************************/
631
632#if defined(__cplusplus)
633extern "C" {
634#endif /* __cplusplus */
635
636/*!
637 * @brief Enable the clock for specific IP.
638 *
639 * @param name Which clock to enable, see \ref clock_ip_name_t.
640 */
641static inline void CLOCK_EnableClock(clock_ip_name_t name)
642{
643 assert((*(volatile uint32_t *)name) & PCC_CLKCFG_PR_MASK);
644
645 (*(volatile uint32_t *)name) |= PCC_CLKCFG_CGC_MASK;
646}
647
648/*!
649 * @brief Disable the clock for specific IP.
650 *
651 * @param name Which clock to disable, see \ref clock_ip_name_t.
652 */
653static inline void CLOCK_DisableClock(clock_ip_name_t name)
654{
655 assert((*(volatile uint32_t *)name) & PCC_CLKCFG_PR_MASK);
656
657 (*(volatile uint32_t *)name) &= ~PCC_CLKCFG_CGC_MASK;
658}
659
660/*!
661 * @brief Check whether the clock is already enabled and configured by
662 * any other core.
663 *
664 * @param name Which peripheral to check, see \ref clock_ip_name_t.
665 * @return True if clock is already enabled, otherwise false.
666 */
668{
669 assert((*(volatile uint32_t *)name) & PCC_CLKCFG_PR_MASK);
670
671 return ((*(volatile uint32_t *)name) & PCC_CLKCFG_INUSE_MASK) ? true : false;
672}
673
674/*!
675 * @brief Set the clock source for specific IP module.
676 *
677 * Set the clock source for specific IP, not all modules need to set the
678 * clock source, should only use this function for the modules need source
679 * setting.
680 *
681 * @param name Which peripheral to check, see \ref clock_ip_name_t.
682 * @param src Clock source to set.
683 */
684static inline void CLOCK_SetIpSrc(clock_ip_name_t name, clock_ip_src_t src)
685{
686 uint32_t reg = (*(volatile uint32_t *)name);
687
688 assert(reg & PCC_CLKCFG_PR_MASK);
689 assert(!(reg & PCC_CLKCFG_INUSE_MASK)); /* Should not change if clock has been enabled by other core. */
690
691 reg = (reg & ~PCC_CLKCFG_PCS_MASK) | PCC_CLKCFG_PCS(src);
692
693 /*
694 * If clock is already enabled, first disable it, then set the clock
695 * source and re-enable it.
696 */
697 (*(volatile uint32_t *)name) = reg & ~PCC_CLKCFG_CGC_MASK;
698 (*(volatile uint32_t *)name) = reg;
699}
700
701/*!
702 * @brief Gets the clock frequency for a specific clock name.
703 *
704 * This function checks the current clock configurations and then calculates
705 * the clock frequency for a specific clock name defined in clock_name_t.
706 *
707 * @param clockName Clock names defined in clock_name_t
708 * @return Clock frequency value in hertz
709 */
710uint32_t CLOCK_GetFreq(clock_name_t clockName);
711
712/*!
713 * @brief Get the core clock or system clock frequency.
714 *
715 * @return Clock frequency in Hz.
716 */
717uint32_t CLOCK_GetCoreSysClkFreq(void);
718
719/*!
720 * @brief Get the bus clock frequency.
721 *
722 * @return Clock frequency in Hz.
723 */
724uint32_t CLOCK_GetBusClkFreq(void);
725
726/*!
727 * @brief Get the flash clock frequency.
728 *
729 * @return Clock frequency in Hz.
730 */
731uint32_t CLOCK_GetFlashClkFreq(void);
732
733/*!
734 * @brief Get the OSC 32K clock frequency (OSC32KCLK).
735 *
736 * @return Clock frequency in Hz.
737 */
738uint32_t CLOCK_GetOsc32kClkFreq(void);
739
740/*!
741 * @brief Get the external reference clock frequency (ERCLK).
742 *
743 * @return Clock frequency in Hz.
744 */
745uint32_t CLOCK_GetErClkFreq(void);
746
747/*!
748 * @brief Gets the clock frequency for a specific IP module.
749 *
750 * This function gets the IP module clock frequency based on PCC registers. It is
751 * only used for the IP modules which could select clock source by PCC[PCS].
752 *
753 * @param name Which peripheral to get, see \ref clock_ip_name_t.
754 * @return Clock frequency value in hertz
755 */
756uint32_t CLOCK_GetIpFreq(clock_ip_name_t name);
757
758/*!
759 * @name MCU System Clock.
760 * @{
761 */
762
763/*!
764 * @brief Gets the SCG system clock frequency.
765 *
766 * This function gets the SCG system clock frequency. These clocks are used for
767 * core, platform, external, and bus clock domains.
768 *
769 * @param type Which type of clock to get, core clock or slow clock.
770 * @return Clock frequency.
771 */
773
774/*!
775 * @brief Sets the system clock configuration for VLPR mode.
776 *
777 * This function sets the system clock configuration for VLPR mode.
778 *
779 * @param config Pointer to the configuration.
780 */
782{
783 assert(config);
784
785 SCG->VCCR = *(const uint32_t *)config;
786}
787
788/*!
789 * @brief Sets the system clock configuration for RUN mode.
790 *
791 * This function sets the system clock configuration for RUN mode.
792 *
793 * @param config Pointer to the configuration.
794 */
796{
797 assert(config);
798
799 SCG->RCCR = *(const uint32_t *)config;
800}
801
802/*!
803 * @brief Sets the system clock configuration for HSRUN mode.
804 *
805 * This function sets the system clock configuration for HSRUN mode.
806 *
807 * @param config Pointer to the configuration.
808 */
810{
811 assert(config);
812
813 SCG->HCCR = *(const uint32_t *)config;
814}
815
816/*!
817 * @brief Gets the system clock configuration in the current power mode.
818 *
819 * This function gets the system configuration in the current power mode.
820 *
821 * @param config Pointer to the configuration.
822 */
824{
825 assert(config);
826
827 *(uint32_t *)config = SCG->CSR;
828}
829
830/*!
831 * @brief Sets the clock out selection.
832 *
833 * This function sets the clock out selection (CLKOUTSEL).
834 *
835 * @param setting The selection to set.
836 * @return The current clock out selection.
837 */
838static inline void CLOCK_SetClkOutSel(clock_clkout_src_t setting)
839{
840 SCG->CLKOUTCNFG = SCG_CLKOUTCNFG_CLKOUTSEL(setting);
841}
842/* @} */
843
844/*!
845 * @name SCG System OSC Clock.
846 * @{
847 */
848
849/*!
850 * @brief Initializes the SCG system OSC.
851 *
852 * This function enables the SCG system OSC clock according to the
853 * configuration.
854 *
855 * @param config Pointer to the configuration structure.
856 * @retval kStatus_Success System OSC is initialized.
857 * @retval kStatus_SCG_Busy System OSC has been enabled and is used by the system clock.
858 * @retval kStatus_ReadOnly System OSC control register is locked.
859 *
860 * @note This function can't detect whether the system OSC has been enabled and
861 * used by an IP.
862 */
864
865/*!
866 * @brief De-initializes the SCG system OSC.
867 *
868 * This function disables the SCG system OSC clock.
869 *
870 * @retval kStatus_Success System OSC is deinitialized.
871 * @retval kStatus_SCG_Busy System OSC is used by the system clock.
872 * @retval kStatus_ReadOnly System OSC control register is locked.
873 *
874 * @note This function can't detect whether the system OSC is used by an IP.
875 */
877
878/*!
879 * @brief Set the asynchronous clock divider.
880 *
881 * @param asyncClk Which asynchronous clock to configure.
882 * @param divider The divider value to set.
883 *
884 * @note There might be glitch when changing the asynchronous divider, so make sure
885 * the asynchronous clock is not used while changing divider.
886 */
888{
889 uint32_t reg = SCG->SOSCDIV;
890
891 switch (asyncClk)
892 {
894 reg = (reg & ~SCG_SOSCDIV_SOSCDIV2_MASK) | SCG_SOSCDIV_SOSCDIV2(divider);
895 break;
896 default:
897 reg = (reg & ~SCG_SOSCDIV_SOSCDIV1_MASK) | SCG_SOSCDIV_SOSCDIV1(divider);
898 break;
899 }
900
901 SCG->SOSCDIV = reg;
902}
903
904/*!
905 * @brief Gets the SCG system OSC clock frequency (SYSOSC).
906 *
907 * @return Clock frequency; If the clock is invalid, returns 0.
908 */
909uint32_t CLOCK_GetSysOscFreq(void);
910
911/*!
912 * @brief Gets the SCG asynchronous clock frequency from the system OSC.
913 *
914 * @param type The asynchronous clock type.
915 * @return Clock frequency; If the clock is invalid, returns 0.
916 */
918
919/*!
920 * @brief Checks whether the system OSC clock error occurs.
921 *
922 * @return True if the error occurs, false if not.
923 */
924static inline bool CLOCK_IsSysOscErr(void)
925{
926 return (bool)(SCG->SOSCCSR & SCG_SOSCCSR_SOSCERR_MASK);
927}
928
929/*!
930 * @brief Clears the system OSC clock error.
931 */
932static inline void CLOCK_ClearSysOscErr(void)
933{
934 SCG->SOSCCSR |= SCG_SOSCCSR_SOSCERR_MASK;
935}
936
937/*!
938 * @brief Sets the system OSC monitor mode.
939 *
940 * This function sets the system OSC monitor mode. The mode can be disabled,
941 * it can generate an interrupt when the error is disabled, or reset when the error is detected.
942 *
943 * @param mode Monitor mode to set.
944 */
946{
947 uint32_t reg = SCG->SOSCCSR;
948
949 reg &= ~(SCG_SOSCCSR_SOSCCM_MASK | SCG_SOSCCSR_SOSCCMRE_MASK);
950
951 reg |= (uint32_t)mode;
952
953 SCG->SOSCCSR = reg;
954}
955
956/*!
957 * @brief Checks whether the system OSC clock is valid.
958 *
959 * @return True if clock is valid, false if not.
960 */
961static inline bool CLOCK_IsSysOscValid(void)
962{
963 return (bool)(SCG->SOSCCSR & SCG_SOSCCSR_SOSCVLD_MASK);
964}
965/* @} */
966
967/*!
968 * @name SCG Slow IRC Clock.
969 * @{
970 */
971
972/*!
973 * @brief Initializes the SCG slow IRC clock.
974 *
975 * This function enables the SCG slow IRC clock according to the
976 * configuration.
977 *
978 * @param config Pointer to the configuration structure.
979 * @retval kStatus_Success SIRC is initialized.
980 * @retval kStatus_SCG_Busy SIRC has been enabled and is used by system clock.
981 * @retval kStatus_ReadOnly SIRC control register is locked.
982 *
983 * @note This function can't detect whether the system OSC has been enabled and
984 * used by an IP.
985 */
987
988/*!
989 * @brief De-initializes the SCG slow IRC.
990 *
991 * This function disables the SCG slow IRC.
992 *
993 * @retval kStatus_Success SIRC is deinitialized.
994 * @retval kStatus_SCG_Busy SIRC is used by system clock.
995 * @retval kStatus_ReadOnly SIRC control register is locked.
996 *
997 * @note This function can't detect whether the SIRC is used by an IP.
998 */
1000
1001/*!
1002 * @brief Set the asynchronous clock divider.
1003 *
1004 * @param asyncClk Which asynchronous clock to configure.
1005 * @param divider The divider value to set.
1006 *
1007 * @note There might be glitch when changing the asynchronous divider, so make sure
1008 * the asynchronous clock is not used while changing divider.
1009 */
1011{
1012 uint32_t reg = SCG->SIRCDIV;
1013
1014 switch (asyncClk)
1015 {
1016 case kSCG_AsyncDiv2Clk:
1017 reg = (reg & ~SCG_SIRCDIV_SIRCDIV2_MASK) | SCG_SIRCDIV_SIRCDIV2(divider);
1018 break;
1019 default:
1020 reg = (reg & ~SCG_SIRCDIV_SIRCDIV1_MASK) | SCG_SIRCDIV_SIRCDIV1(divider);
1021 break;
1022 }
1023
1024 SCG->SIRCDIV = reg;
1025}
1026
1027/*!
1028 * @brief Gets the SCG SIRC clock frequency.
1029 *
1030 * @return Clock frequency; If the clock is invalid, returns 0.
1031 */
1032uint32_t CLOCK_GetSircFreq(void);
1033
1034/*!
1035 * @brief Gets the SCG asynchronous clock frequency from the SIRC.
1036 *
1037 * @param type The asynchronous clock type.
1038 * @return Clock frequency; If the clock is invalid, returns 0.
1039 */
1041
1042/*!
1043 * @brief Checks whether the SIRC clock is valid.
1044 *
1045 * @return True if clock is valid, false if not.
1046 */
1047static inline bool CLOCK_IsSircValid(void)
1048{
1049 return (bool)(SCG->SIRCCSR & SCG_SIRCCSR_SIRCVLD_MASK);
1050}
1051/* @} */
1052
1053/*!
1054 * @name SCG Fast IRC Clock.
1055 * @{
1056 */
1057
1058/*!
1059 * @brief Initializes the SCG fast IRC clock.
1060 *
1061 * This function enables the SCG fast IRC clock according to the configuration.
1062 *
1063 * @param config Pointer to the configuration structure.
1064 * @retval kStatus_Success FIRC is initialized.
1065 * @retval kStatus_SCG_Busy FIRC has been enabled and is used by the system clock.
1066 * @retval kStatus_ReadOnly FIRC control register is locked.
1067 *
1068 * @note This function can't detect whether the FIRC has been enabled and
1069 * used by an IP.
1070 */
1072
1073/*!
1074 * @brief De-initializes the SCG fast IRC.
1075 *
1076 * This function disables the SCG fast IRC.
1077 *
1078 * @retval kStatus_Success FIRC is deinitialized.
1079 * @retval kStatus_SCG_Busy FIRC is used by the system clock.
1080 * @retval kStatus_ReadOnly FIRC control register is locked.
1081 *
1082 * @note This function can't detect whether the FIRC is used by an IP.
1083 */
1085
1086/*!
1087 * @brief Set the asynchronous clock divider.
1088 *
1089 * @param asyncClk Which asynchronous clock to configure.
1090 * @param divider The divider value to set.
1091 *
1092 * @note There might be glitch when changing the asynchronous divider, so make sure
1093 * the asynchronous clock is not used while changing divider.
1094 */
1096{
1097 uint32_t reg = SCG->FIRCDIV;
1098
1099 switch (asyncClk)
1100 {
1101 case kSCG_AsyncDiv2Clk:
1102 reg = (reg & ~SCG_FIRCDIV_FIRCDIV2_MASK) | SCG_FIRCDIV_FIRCDIV2(divider);
1103 break;
1104 default:
1105 reg = (reg & ~SCG_FIRCDIV_FIRCDIV1_MASK) | SCG_FIRCDIV_FIRCDIV1(divider);
1106 break;
1107 }
1108
1109 SCG->FIRCDIV = reg;
1110}
1111
1112/*!
1113 * @brief Gets the SCG FIRC clock frequency.
1114 *
1115 * @return Clock frequency; If the clock is invalid, returns 0.
1116 */
1117uint32_t CLOCK_GetFircFreq(void);
1118
1119/*!
1120 * @brief Gets the SCG asynchronous clock frequency from the FIRC.
1121 *
1122 * @param type The asynchronous clock type.
1123 * @return Clock frequency; If the clock is invalid, returns 0.
1124 */
1126
1127/*!
1128 * @brief Checks whether the FIRC clock error occurs.
1129 *
1130 * @return True if the error occurs, false if not.
1131 */
1132static inline bool CLOCK_IsFircErr(void)
1133{
1134 return (bool)(SCG->FIRCCSR & SCG_FIRCCSR_FIRCERR_MASK);
1135}
1136
1137/*!
1138 * @brief Clears the FIRC clock error.
1139 */
1140static inline void CLOCK_ClearFircErr(void)
1141{
1142 SCG->FIRCCSR |= SCG_FIRCCSR_FIRCERR_MASK;
1143}
1144
1145/*!
1146 * @brief Checks whether the FIRC clock is valid.
1147 *
1148 * @return True if clock is valid, false if not.
1149 */
1150static inline bool CLOCK_IsFircValid(void)
1151{
1152 return (bool)(SCG->FIRCCSR & SCG_FIRCCSR_FIRCVLD_MASK);
1153}
1154/* @} */
1155
1156/*!
1157 * @name SCG System PLL Clock.
1158 * @{
1159 */
1160
1161/*!
1162 * @brief Calculates the MULT and PREDIV for the PLL.
1163 *
1164 * This function calculates the proper MULT and PREDIV to generate the desired PLL
1165 * output frequency with the input reference clock frequency. It returns the closest
1166 * frequency match that the PLL can generate. The corresponding MULT/PREDIV are returned with
1167 * parameters. If the desired frequency is not valid, this function returns 0.
1168 *
1169 * @param refFreq The input reference clock frequency.
1170 * @param desireFreq The desired output clock frequency.
1171 * @param mult The value of MULT.
1172 * @param prediv The value of PREDIV.
1173 * @return The PLL output frequency with the MULT and PREDIV; If
1174 * the desired frequency can't be generated, this function returns 0U.
1175 */
1176uint32_t CLOCK_GetSysPllMultDiv(uint32_t refFreq, uint32_t desireFreq, uint8_t *mult, uint8_t *prediv);
1177
1178/*!
1179 * @brief Initializes the SCG system PLL.
1180 *
1181 * This function enables the SCG system PLL clock according to the
1182 * configuration. The system PLL can use the system OSC or FIRC as
1183 * the clock source. Ensure that the source clock is valid before
1184 * calling this function.
1185 *
1186 * Example code for initializing SPLL clock output:
1187 * @code
1188 * const scg_spll_config_t g_scgSysPllConfig = {.enableMode = kSCG_SysPllEnable,
1189 * .monitorMode = kSCG_SysPllMonitorDisable,
1190 * .div1 = kSCG_AsyncClkDivBy1,
1191 * .div2 = kSCG_AsyncClkDisable,
1192 * .div3 = kSCG_AsyncClkDivBy2,
1193 * .src = kSCG_SysPllSrcFirc,
1194 * .isBypassSelected = false,
1195 * .isPfdSelected = false, // Configure SPLL PFD as diabled
1196 * .prediv = 5U,
1197 * .pfdClkout = kSCG_AuxPllPfd0Clk, // No need to configure pfdClkout; only
1198 * needed for initialization
1199 * .mult = 20U,
1200 * .pllPostdiv1 = kSCG_SysClkDivBy3,
1201 * .pllPostdiv2 = kSCG_SysClkDivBy4};
1202 * CLOCK_InitSysPll(&g_scgSysPllConfig);
1203 * @endcode
1204 *
1205 * @param config Pointer to the configuration structure.
1206 * @retval kStatus_Success System PLL is initialized.
1207 * @retval kStatus_SCG_Busy System PLL has been enabled and is used by the system clock.
1208 * @retval kStatus_ReadOnly System PLL control register is locked.
1209 *
1210 * @note This function can't detect whether the system PLL has been enabled and
1211 * used by an IP.
1212 */
1214
1215/*!
1216 * @brief De-initializes the SCG system PLL.
1217 *
1218 * This function disables the SCG system PLL.
1219 *
1220 * @retval kStatus_Success system PLL is deinitialized.
1221 * @retval kStatus_SCG_Busy system PLL is used by the system clock.
1222 * @retval kStatus_ReadOnly System PLL control register is locked.
1223 *
1224 * @note This function can't detect whether the system PLL is used by an IP.
1225 */
1227
1228/*!
1229 * @brief Set the asynchronous clock divider.
1230 *
1231 * @param asyncClk Which asynchronous clock to configure.
1232 * @param divider The divider value to set.
1233 *
1234 * @note There might be glitch when changing the asynchronous divider, so make sure
1235 * the asynchronous clock is not used while changing divider.
1236 */
1238{
1239 uint32_t reg = SCG->SPLLDIV;
1240
1241 switch (asyncClk)
1242 {
1243 case kSCG_AsyncDiv2Clk:
1244 reg = (reg & ~SCG_SPLLDIV_SPLLDIV2_MASK) | SCG_SPLLDIV_SPLLDIV2(divider);
1245 break;
1246 default:
1247 reg = (reg & ~SCG_SPLLDIV_SPLLDIV1_MASK) | SCG_SPLLDIV_SPLLDIV1(divider);
1248 break;
1249 }
1250
1251 SCG->SPLLDIV = reg;
1252}
1253
1254/*!
1255 * @brief Gets the SCG system PLL clock frequency.
1256 *
1257 * @return Clock frequency; If the clock is invalid, returns 0.
1258 */
1259uint32_t CLOCK_GetSysPllFreq(void);
1260
1261/*!
1262 * @brief Gets the SCG asynchronous clock frequency from the system PLL.
1263 *
1264 * @param type The asynchronous clock type.
1265 * @return Clock frequency; If the clock is invalid, returns 0.
1266 */
1268
1269/*!
1270 * @brief Checks whether the system PLL clock error occurs.
1271 *
1272 * @return True if an error occurs, false if not.
1273 */
1274static inline bool CLOCK_IsSysPllErr(void)
1275{
1276 return (bool)(SCG->SPLLCSR & SCG_SPLLCSR_SPLLERR_MASK);
1277}
1278
1279/*!
1280 * @brief Clears the system PLL clock error.
1281 */
1282static inline void CLOCK_ClearSysPllErr(void)
1283{
1284 SCG->SPLLCSR |= SCG_SPLLCSR_SPLLERR_MASK;
1285}
1286
1287/*!
1288 * @brief Sets the system PLL monitor mode.
1289 *
1290 * This function sets the system PLL monitor mode. The mode can be disabled.
1291 * It can generate an interrupt when the error is disabled, or reset when the error is detected.
1292 *
1293 * @param mode Monitor mode to set.
1294 */
1296{
1297 uint32_t reg = SCG->SPLLCSR;
1298
1299 reg &= ~(SCG_SPLLCSR_SPLLCM_MASK | SCG_SPLLCSR_SPLLCMRE_MASK);
1300
1301 reg |= (uint32_t)mode;
1302
1303 SCG->SPLLCSR = reg;
1304}
1305
1306/*!
1307 * @brief Checks whether the system PLL clock is valid.
1308 *
1309 * @return True if the clock is valid, false if not.
1310 */
1311static inline bool CLOCK_IsSysPllValid(void)
1312{
1313 return (bool)(SCG->SPLLCSR & SCG_SPLLCSR_SPLLVLD_MASK);
1314}
1315/* @} */
1316
1317/*!
1318 * @name OSC32 operations
1319 * @{
1320 */
1321/*!
1322 * @brief Initializes OSC32.
1323 *
1324 * @param base OSC32 peripheral base address.
1325 * @param mode OSC32 work mode, see @ref osc32_mode_t
1326 */
1327void OSC32_Init(OSC32_Type *base, osc32_mode_t mode);
1328
1329/*!
1330 * @brief Deinitializes OSC32.
1331 *
1332 * @param base OSC32 peripheral base address.
1333 */
1334void OSC32_Deinit(OSC32_Type *base);
1335/* @} */
1336
1337/*!
1338 * @name External clock frequency
1339 * @{
1340 */
1341
1342/*!
1343 * @brief Sets the XTAL0 frequency based on board settings.
1344 *
1345 * @param freq The XTAL0/EXTAL0 input clock frequency in Hz.
1346 */
1347static inline void CLOCK_SetXtal0Freq(uint32_t freq)
1348{
1349 g_xtal0Freq = freq;
1350}
1351
1352/*!
1353 * @brief Sets the XTAL32 frequency based on board settings.
1354 *
1355 * @param freq The XTAL32/EXTAL32 input clock frequency in Hz.
1356 */
1357static inline void CLOCK_SetXtal32Freq(uint32_t freq)
1358{
1359 g_xtal32Freq = freq;
1360}
1361
1362/* @} */
1363
1364#if defined(__cplusplus)
1365}
1366#endif /* __cplusplus */
1367
1368/*! @} */
1369
1370#endif /* _FSL_CLOCK_H_ */
static constexpr persistent_config_s * config
_scg_firc_range
SCG fast IRC clock frequency range.
Definition fsl_clock.h:554
enum _clock_ip_name clock_ip_name_t
Peripheral clock name difinition used for clock gate, clock source and clock divider setting....
uint32_t CLOCK_GetSysPllMultDiv(uint32_t refFreq, uint32_t desireFreq, uint8_t *mult, uint8_t *prediv)
Calculates the MULT and PREDIV for the PLL.
Definition fsl_clock.c:848
_scg_async_clk
SCG asynchronous clock type.
Definition fsl_clock.h:408
scg_async_clk_div_t div2
Definition fsl_clock.h:495
scg_spll_src_t src
Definition fsl_clock.h:623
_clock_ip_name
Peripheral clock name difinition used for clock gate, clock source and clock divider setting....
Definition fsl_clock.h:267
scg_async_clk_div
SCG asynchronous clock divider value.
Definition fsl_clock.h:417
enum _scg_sys_clk_div scg_sys_clk_div_t
SCG system clock divider value.
_scg_sirc_range
SCG slow IRC clock frequency range.
Definition fsl_clock.h:475
_clock_name
Clock name used to get clock frequency.
Definition fsl_clock.h:214
static void CLOCK_SetSysOscAsyncClkDiv(scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
Set the asynchronous clock divider.
Definition fsl_clock.h:887
static bool CLOCK_IsSysPllValid(void)
Checks whether the system PLL clock is valid.
Definition fsl_clock.h:1311
volatile uint32_t g_xtal32Freq
External XTAL32/EXTAL32 clock frequency.
Definition fsl_clock.c:77
uint8_t enableMode
Definition fsl_clock.h:617
scg_firc_trim_src_t trimSrc
Definition fsl_clock.h:543
static bool CLOCK_IsSysOscErr(void)
Checks whether the system OSC clock error occurs.
Definition fsl_clock.h:924
enum _scg_sys_clk_src scg_sys_clk_src_t
SCG system clock source.
uint32_t CLOCK_GetSysPllFreq(void)
Gets the SCG system PLL clock frequency.
Definition fsl_clock.c:1080
uint32_t CLOCK_GetIpFreq(clock_ip_name_t name)
Gets the clock frequency for a specific IP module.
Definition fsl_clock.c:250
_scg_spll_src
SCG system PLL clock source.
Definition fsl_clock.h:589
enum _clock_name clock_name_t
Clock name used to get clock frequency.
struct _scg_firc_trim_config scg_firc_trim_config_t
SCG fast IRC clock trim configuration.
uint8_t enableMode
Definition fsl_clock.h:463
static bool CLOCK_IsSircValid(void)
Checks whether the SIRC clock is valid.
Definition fsl_clock.h:1047
_scg_sirc_enable_mode
SIRC enable mode.
Definition fsl_clock.h:482
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
Definition fsl_clock.h:653
void OSC32_Deinit(OSC32_Type *base)
Deinitializes OSC32.
Definition fsl_clock.c:321
enum _scg_spll_src scg_spll_src_t
SCG system PLL clock source.
uint32_t CLOCK_GetCoreSysClkFreq(void)
Get the core clock or system clock frequency.
Definition fsl_clock.c:154
_scg_status
SCG status return codes.
Definition fsl_clock.h:328
static void CLOCK_SetRunModeSysClkConfig(const scg_sys_clk_config_t *config)
Sets the system clock configuration for RUN mode.
Definition fsl_clock.h:795
uint32_t CLOCK_GetSysPllAsyncFreq(scg_async_clk_t type)
Gets the SCG asynchronous clock frequency from the system PLL.
Definition fsl_clock.c:1102
enum _scg_firc_trim_div scg_firc_trim_div_t
SCG fast IRC trim predivided value for system OSC.
enum _scg_sys_clk scg_sys_clk_t
SCG system clock type.
scg_async_clk_div_t div1
Definition fsl_clock.h:620
enum _scg_sosc_monitor_mode scg_sosc_monitor_mode_t
SCG system OSC monitor mode.
scg_async_clk_div_t div1
Definition fsl_clock.h:465
scg_sirc_range_t range
Definition fsl_clock.h:497
status_t CLOCK_DeinitFirc(void)
De-initializes the SCG fast IRC.
Definition fsl_clock.c:755
scg_firc_trim_mode_t trimMode
Definition fsl_clock.h:542
static void CLOCK_SetXtal0Freq(uint32_t freq)
Sets the XTAL0 frequency based on board settings.
Definition fsl_clock.h:1347
enum scg_async_clk_div scg_async_clk_div_t
SCG asynchronous clock divider value.
uint32_t CLOCK_GetSircFreq(void)
Gets the SCG SIRC clock frequency.
Definition fsl_clock.c:627
enum _clock_clkout_src clock_clkout_src_t
SCG clock out configuration (CLKOUTSEL).
uint32_t CLOCK_GetFreq(clock_name_t clockName)
Gets the clock frequency for a specific clock name.
Definition fsl_clock.c:168
struct _scg_sys_clk_config scg_sys_clk_config_t
SCG system clock configuration.
enum _scg_firc_trim_mode scg_firc_trim_mode_t
SCG fast IRC trim mode.
uint32_t enableMode
Definition fsl_clock.h:575
uint32_t CLOCK_GetFircFreq(void)
Gets the SCG FIRC clock frequency.
Definition fsl_clock.c:781
_osc32_mode
OSC32 work mode.
Definition fsl_clock.h:317
static void CLOCK_SetVlprModeSysClkConfig(const scg_sys_clk_config_t *config)
Sets the system clock configuration for VLPR mode.
Definition fsl_clock.h:781
static void CLOCK_SetIpSrc(clock_ip_name_t name, clock_ip_src_t src)
Set the clock source for specific IP module.
Definition fsl_clock.h:684
static void CLOCK_ClearFircErr(void)
Clears the FIRC clock error.
Definition fsl_clock.h:1140
scg_sosc_mode_t workMode
Definition fsl_clock.h:468
_scg_firc_trim_mode
SCG fast IRC trim mode.
Definition fsl_clock.h:504
volatile uint32_t g_xtal0Freq
External XTAL0 (OSC0/SYSOSC) clock frequency.
Definition fsl_clock.c:75
_scg_firc_trim_div
SCG fast IRC trim predivided value for system OSC.
Definition fsl_clock.h:520
enum _scg_spll_monitor_mode scg_spll_monitor_mode_t
SCG system PLL monitor mode.
scg_async_clk_div_t div2
Definition fsl_clock.h:578
enum _scg_firc_range scg_firc_range_t
SCG fast IRC clock frequency range.
scg_async_clk_div_t div2
Definition fsl_clock.h:621
static void CLOCK_SetSysOscMonitorMode(scg_sosc_monitor_mode_t mode)
Sets the system OSC monitor mode.
Definition fsl_clock.h:945
static bool CLOCK_IsFircValid(void)
Checks whether the FIRC clock is valid.
Definition fsl_clock.h:1150
_scg_spll_enable_mode
SPLL enable mode.
Definition fsl_clock.h:607
_scg_sosc_enable_mode
OSC enable mode.
Definition fsl_clock.h:449
_scg_sosc_monitor_mode
SCG system OSC monitor mode.
Definition fsl_clock.h:432
enum _clock_ip_src clock_ip_src_t
Clock source for peripherals that support various clock selections.
enum _scg_async_clk scg_async_clk_t
SCG asynchronous clock type.
_scg_firc_enable_mode
FIRC enable mode.
Definition fsl_clock.h:563
uint32_t CLOCK_GetErClkFreq(void)
Get the external reference clock frequency (ERCLK).
Definition fsl_clock.c:104
_scg_sys_clk_div
SCG system clock divider value.
Definition fsl_clock.h:358
uint32_t CLOCK_GetSysClkFreq(scg_sys_clk_t type)
Gets the SCG system clock frequency.
Definition fsl_clock.c:339
status_t CLOCK_DeinitSysPll(void)
De-initializes the SCG system PLL.
Definition fsl_clock.c:1031
static bool CLOCK_IsEnabledByOtherCore(clock_ip_name_t name)
Check whether the clock is already enabled and configured by any other core.
Definition fsl_clock.h:667
static void CLOCK_SetClkOutSel(clock_clkout_src_t setting)
Sets the clock out selection.
Definition fsl_clock.h:838
static void CLOCK_GetCurSysClkConfig(scg_sys_clk_config_t *config)
Gets the system clock configuration in the current power mode.
Definition fsl_clock.h:823
uint32_t CLOCK_GetBusClkFreq(void)
Get the bus clock frequency.
Definition fsl_clock.c:144
_scg_spll_monitor_mode
SCG system PLL monitor mode.
Definition fsl_clock.h:598
uint32_t CLOCK_GetSircAsyncFreq(scg_async_clk_t type)
Gets the SCG asynchronous clock frequency from the SIRC.
Definition fsl_clock.c:647
_scg_sys_clk
SCG system clock type.
Definition fsl_clock.h:337
enum _scg_sirc_range scg_sirc_range_t
SCG slow IRC clock frequency range.
static void CLOCK_SetXtal32Freq(uint32_t freq)
Sets the XTAL32 frequency based on board settings.
Definition fsl_clock.h:1357
uint32_t CLOCK_GetFlashClkFreq(void)
Get the flash clock frequency.
Definition fsl_clock.c:134
void OSC32_Init(OSC32_Type *base, osc32_mode_t mode)
Initializes OSC32.
Definition fsl_clock.c:297
uint32_t CLOCK_GetSysOscFreq(void)
Gets the SCG system OSC clock frequency (SYSOSC).
Definition fsl_clock.c:494
scg_async_clk_div_t div1
Definition fsl_clock.h:577
_clock_ip_src
Clock source for peripherals that support various clock selections.
Definition fsl_clock.h:254
enum _scg_sosc_mode scg_sosc_mode_t
OSC work mode.
static void CLOCK_SetHsrunModeSysClkConfig(const scg_sys_clk_config_t *config)
Sets the system clock configuration for HSRUN mode.
Definition fsl_clock.h:809
static void CLOCK_ClearSysPllErr(void)
Clears the system PLL clock error.
Definition fsl_clock.h:1282
status_t CLOCK_DeinitSirc(void)
De-initializes the SCG slow IRC.
Definition fsl_clock.c:601
_scg_sosc_mode
OSC work mode.
Definition fsl_clock.h:441
scg_firc_trim_div_t trimDiv
Definition fsl_clock.h:544
struct _scg_spll_config scg_spll_config_t
SCG system PLL configuration.
struct _scg_sirc_config scg_sirc_config_t
SCG slow IRC clock configuration.
scg_firc_range_t range
Definition fsl_clock.h:580
uint32_t CLOCK_GetOsc32kClkFreq(void)
Get the OSC 32K clock frequency (OSC32KCLK).
Definition fsl_clock.c:123
const scg_firc_trim_config_t * trimConfig
Definition fsl_clock.h:582
static bool CLOCK_IsFircErr(void)
Checks whether the FIRC clock error occurs.
Definition fsl_clock.h:1132
_scg_sys_clk_src
SCG system clock source.
Definition fsl_clock.h:347
struct _scg_sosc_config scg_sosc_config_t
SCG system OSC configuration.
_scg_firc_trim_src
SCG fast IRC trim source.
Definition fsl_clock.h:533
enum _scg_firc_trim_src scg_firc_trim_src_t
SCG fast IRC trim source.
status_t CLOCK_InitSirc(const scg_sirc_config_t *config)
Initializes the SCG slow IRC clock.
Definition fsl_clock.c:558
status_t CLOCK_InitFirc(const scg_firc_config_t *config)
Initializes the SCG fast IRC clock.
Definition fsl_clock.c:690
static void CLOCK_SetFircAsyncClkDiv(scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
Set the asynchronous clock divider.
Definition fsl_clock.h:1095
scg_async_clk_div_t div1
Definition fsl_clock.h:494
static bool CLOCK_IsSysOscValid(void)
Checks whether the system OSC clock is valid.
Definition fsl_clock.h:961
_clock_clkout_src
SCG clock out configuration (CLKOUTSEL).
Definition fsl_clock.h:396
static void CLOCK_ClearSysOscErr(void)
Clears the system OSC clock error.
Definition fsl_clock.h:932
uint32_t enableMode
Definition fsl_clock.h:493
static void CLOCK_SetSysPllMonitorMode(scg_spll_monitor_mode_t mode)
Sets the system PLL monitor mode.
Definition fsl_clock.h:1295
status_t CLOCK_InitSysPll(const scg_spll_config_t *config)
Initializes the SCG system PLL.
Definition fsl_clock.c:984
uint32_t CLOCK_GetFircAsyncFreq(scg_async_clk_t type)
Gets the SCG asynchronous clock frequency from the FIRC.
Definition fsl_clock.c:803
status_t CLOCK_DeinitSysOsc(void)
De-initializes the SCG system OSC.
Definition fsl_clock.c:468
status_t CLOCK_InitSysOsc(const scg_sosc_config_t *config)
Initializes the SCG system OSC.
Definition fsl_clock.c:397
scg_async_clk_div_t div2
Definition fsl_clock.h:466
scg_spll_monitor_mode_t monitorMode
Definition fsl_clock.h:618
struct _scg_firc_config_t scg_firc_config_t
SCG fast IRC clock configuration.
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
Definition fsl_clock.h:641
uint32_t CLOCK_GetSysOscAsyncFreq(scg_async_clk_t type)
Gets the SCG asynchronous clock frequency from the system OSC.
Definition fsl_clock.c:514
static bool CLOCK_IsSysPllErr(void)
Checks whether the system PLL clock error occurs.
Definition fsl_clock.h:1274
static void CLOCK_SetSircAsyncClkDiv(scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
Set the asynchronous clock divider.
Definition fsl_clock.h:1010
static void CLOCK_SetSysPllAsyncClkDiv(scg_async_clk_t asyncClk, scg_async_clk_div_t divider)
Set the asynchronous clock divider.
Definition fsl_clock.h:1237
scg_sosc_monitor_mode_t monitorMode
Definition fsl_clock.h:462
enum _osc32_mode osc32_mode_t
OSC32 work mode.
@ kSCG_FircRange56M
Definition fsl_clock.h:557
@ kSCG_FircRange60M
Definition fsl_clock.h:558
@ kSCG_FircRange52M
Definition fsl_clock.h:556
@ kSCG_FircRange48M
Definition fsl_clock.h:555
@ kSCG_AsyncDiv1Clk
Definition fsl_clock.h:409
@ kSCG_AsyncDiv2Clk
Definition fsl_clock.h:410
@ kCLOCK_Cmp2
Definition fsl_clock.h:310
@ kCLOCK_Sysmpu0
Definition fsl_clock.h:272
@ kCLOCK_IpInvalid
Definition fsl_clock.h:268
@ kCLOCK_PortC
Definition fsl_clock.h:296
@ kCLOCK_Dma0
Definition fsl_clock.h:271
@ kCLOCK_PortE
Definition fsl_clock.h:298
@ kCLOCK_Lptmr0
Definition fsl_clock.h:293
@ kCLOCK_Pdb0
Definition fsl_clock.h:284
@ kCLOCK_Pdb1
Definition fsl_clock.h:281
@ kCLOCK_Lpi2c1
Definition fsl_clock.h:304
@ kCLOCK_Rtc0
Definition fsl_clock.h:291
@ kCLOCK_Ewm0
Definition fsl_clock.h:302
@ kCLOCK_Lpuart2
Definition fsl_clock.h:307
@ kCLOCK_Flexio0
Definition fsl_clock.h:300
@ kCLOCK_Flash0
Definition fsl_clock.h:273
@ kCLOCK_Pwt0
Definition fsl_clock.h:299
@ kCLOCK_Adc1
Definition fsl_clock.h:278
@ kCLOCK_Ftm3
Definition fsl_clock.h:277
@ kCLOCK_Cmp0
Definition fsl_clock.h:308
@ kCLOCK_Dmamux0
Definition fsl_clock.h:274
@ kCLOCK_Adc2
Definition fsl_clock.h:290
@ kCLOCK_PortA
Definition fsl_clock.h:294
@ kCLOCK_Pdb2
Definition fsl_clock.h:283
@ kCLOCK_PortB
Definition fsl_clock.h:295
@ kCLOCK_Lpuart1
Definition fsl_clock.h:306
@ kCLOCK_Lpi2c0
Definition fsl_clock.h:303
@ kCLOCK_Flexcan1
Definition fsl_clock.h:276
@ kCLOCK_Cmp1
Definition fsl_clock.h:309
@ kCLOCK_Crc0
Definition fsl_clock.h:282
@ kCLOCK_Adc0
Definition fsl_clock.h:289
@ kCLOCK_Flexcan0
Definition fsl_clock.h:275
@ kCLOCK_Lpspi1
Definition fsl_clock.h:280
@ kCLOCK_RtcOsc0
Definition fsl_clock.h:301
@ kCLOCK_Lpuart0
Definition fsl_clock.h:305
@ kCLOCK_Lpit0
Definition fsl_clock.h:285
@ kCLOCK_Ftm1
Definition fsl_clock.h:287
@ kCLOCK_Lpspi0
Definition fsl_clock.h:279
@ kCLOCK_PortD
Definition fsl_clock.h:297
@ kCLOCK_Ftm2
Definition fsl_clock.h:288
@ kCLOCK_Dac0
Definition fsl_clock.h:292
@ kCLOCK_Ftm0
Definition fsl_clock.h:286
@ kSCG_AsyncClkDivBy2
Definition fsl_clock.h:420
@ kSCG_AsyncClkDivBy8
Definition fsl_clock.h:422
@ kSCG_AsyncClkDivBy1
Definition fsl_clock.h:419
@ kSCG_AsyncClkDivBy64
Definition fsl_clock.h:425
@ kSCG_AsyncClkDisable
Definition fsl_clock.h:418
@ kSCG_AsyncClkDivBy16
Definition fsl_clock.h:423
@ kSCG_AsyncClkDivBy32
Definition fsl_clock.h:424
@ kSCG_AsyncClkDivBy4
Definition fsl_clock.h:421
@ kSCG_SircRangeLow
Definition fsl_clock.h:476
@ kSCG_SircRangeHigh
Definition fsl_clock.h:477
@ kCLOCK_ScgSysOscAsyncDiv1Clk
Definition fsl_clock.h:227
@ kCLOCK_CoreSysClk
Definition fsl_clock.h:216
@ kCLOCK_ScgSysOscClk
Definition fsl_clock.h:222
@ kCLOCK_ScgSysPllAsyncDiv2Clk
Definition fsl_clock.h:237
@ kCLOCK_BusClk
Definition fsl_clock.h:217
@ kCLOCK_ScgSysOscAsyncDiv2Clk
Definition fsl_clock.h:228
@ kCLOCK_ScgFircAsyncDiv2Clk
Definition fsl_clock.h:234
@ kCLOCK_LpoClk
Definition fsl_clock.h:240
@ kCLOCK_ErClk
Definition fsl_clock.h:242
@ kCLOCK_FlexBusClk
Definition fsl_clock.h:218
@ kCLOCK_ScgFircClk
Definition fsl_clock.h:224
@ kCLOCK_ScgSircAsyncDiv1Clk
Definition fsl_clock.h:230
@ kCLOCK_ScgSircClk
Definition fsl_clock.h:223
@ kCLOCK_Osc32kClk
Definition fsl_clock.h:241
@ kCLOCK_FlashClk
Definition fsl_clock.h:219
@ kCLOCK_ScgSircAsyncDiv2Clk
Definition fsl_clock.h:231
@ kCLOCK_ScgFircAsyncDiv1Clk
Definition fsl_clock.h:233
@ kCLOCK_ScgSysPllClk
Definition fsl_clock.h:225
@ kCLOCK_ScgSysPllAsyncDiv1Clk
Definition fsl_clock.h:236
@ kSCG_SysPllSrcSysOsc
Definition fsl_clock.h:590
@ kSCG_SysPllSrcFirc
Definition fsl_clock.h:591
@ kSCG_SircEnable
Definition fsl_clock.h:483
@ kSCG_SircEnableInStop
Definition fsl_clock.h:484
@ kSCG_SircEnableInLowPower
Definition fsl_clock.h:485
@ kStatus_SCG_InvalidSrc
Definition fsl_clock.h:330
@ kStatus_SCG_Busy
Definition fsl_clock.h:329
@ kOSC32_CrystalEnableInStop
Definition fsl_clock.h:320
@ kOSC32_Crystal
Definition fsl_clock.h:319
@ kOSC32_Bypass
Definition fsl_clock.h:318
@ kSCG_FircTrimNonUpdate
Definition fsl_clock.h:505
@ kSCG_FircTrimUpdate
Definition fsl_clock.h:510
@ kSCG_FircTrimDivBy512
Definition fsl_clock.h:524
@ kSCG_FircTrimDivBy1024
Definition fsl_clock.h:525
@ kSCG_FircTrimDivBy2048
Definition fsl_clock.h:526
@ kSCG_FircTrimDivBy1
Definition fsl_clock.h:521
@ kSCG_FircTrimDivBy128
Definition fsl_clock.h:522
@ kSCG_FircTrimDivBy256
Definition fsl_clock.h:523
@ kSCG_SysPllEnableInStop
Definition fsl_clock.h:609
@ kSCG_SysPllEnable
Definition fsl_clock.h:608
@ kSCG_SysOscEnableErClk
Definition fsl_clock.h:453
@ kSCG_SysOscEnable
Definition fsl_clock.h:450
@ kSCG_SysOscEnableInLowPower
Definition fsl_clock.h:452
@ kSCG_SysOscEnableInStop
Definition fsl_clock.h:451
@ kSCG_SysOscMonitorInt
Definition fsl_clock.h:434
@ kSCG_SysOscMonitorReset
Definition fsl_clock.h:435
@ kSCG_SysOscMonitorDisable
Definition fsl_clock.h:433
@ kSCG_FircEnable
Definition fsl_clock.h:564
@ kSCG_FircDisableRegulator
Definition fsl_clock.h:567
@ kSCG_FircEnableInLowPower
Definition fsl_clock.h:566
@ kSCG_FircEnableInStop
Definition fsl_clock.h:565
@ kSCG_SysClkDivBy16
Definition fsl_clock.h:374
@ kSCG_SysClkDivBy4
Definition fsl_clock.h:362
@ kSCG_SysClkDivBy13
Definition fsl_clock.h:371
@ kSCG_SysClkDivBy10
Definition fsl_clock.h:368
@ kSCG_SysClkDivBy3
Definition fsl_clock.h:361
@ kSCG_SysClkDivBy14
Definition fsl_clock.h:372
@ kSCG_SysClkDivBy11
Definition fsl_clock.h:369
@ kSCG_SysClkDivBy12
Definition fsl_clock.h:370
@ kSCG_SysClkDivBy9
Definition fsl_clock.h:367
@ kSCG_SysClkDivBy5
Definition fsl_clock.h:363
@ kSCG_SysClkDivBy15
Definition fsl_clock.h:373
@ kSCG_SysClkDivBy6
Definition fsl_clock.h:364
@ kSCG_SysClkDivBy1
Definition fsl_clock.h:359
@ kSCG_SysClkDivBy2
Definition fsl_clock.h:360
@ kSCG_SysClkDivBy8
Definition fsl_clock.h:366
@ kSCG_SysClkDivBy7
Definition fsl_clock.h:365
@ kSCG_SysPllMonitorDisable
Definition fsl_clock.h:599
@ kSCG_SysPllMonitorInt
Definition fsl_clock.h:600
@ kSCG_SysPllMonitorReset
Definition fsl_clock.h:601
@ kSCG_SysClkCore
Definition fsl_clock.h:340
@ kSCG_SysClkBus
Definition fsl_clock.h:339
@ kSCG_SysClkSlow
Definition fsl_clock.h:338
@ kCLOCK_IpSrcSysPllAsync
Definition fsl_clock.h:259
@ kCLOCK_IpSrcSysOscAsync
Definition fsl_clock.h:256
@ kCLOCK_IpSrcSircAsync
Definition fsl_clock.h:257
@ kCLOCK_IpSrcFircAsync
Definition fsl_clock.h:258
@ kCLOCK_IpSrcNoneOrExt
Definition fsl_clock.h:255
@ kSCG_SysOscModeOscHighGain
Definition fsl_clock.h:444
@ kSCG_SysOscModeOscLowPower
Definition fsl_clock.h:443
@ kSCG_SysOscModeExt
Definition fsl_clock.h:442
@ kSCG_SysClkSrcSysPll
Definition fsl_clock.h:351
@ kSCG_SysClkSrcSysOsc
Definition fsl_clock.h:348
@ kSCG_SysClkSrcFirc
Definition fsl_clock.h:350
@ kSCG_SysClkSrcSirc
Definition fsl_clock.h:349
@ kSCG_FircTrimSrcSysOsc
Definition fsl_clock.h:534
@ kClockClkoutSelScgSlow
Definition fsl_clock.h:397
@ kClockClkoutSelFirc
Definition fsl_clock.h:400
@ kClockClkoutSelSysOsc
Definition fsl_clock.h:398
@ kClockClkoutSelSirc
Definition fsl_clock.h:399
@ kClockClkoutSelSysPll
Definition fsl_clock.h:401
int32_t status_t
Type used for all status and error return values.
Definition fsl_common.h:169
@ kStatusGroup_SCG
Definition fsl_common.h:81
SCG fast IRC clock configuration.
Definition fsl_clock.h:574
SCG fast IRC clock trim configuration.
Definition fsl_clock.h:541
SCG slow IRC clock configuration.
Definition fsl_clock.h:492
SCG system OSC configuration.
Definition fsl_clock.h:460
SCG system PLL configuration.
Definition fsl_clock.h:616
SCG system clock configuration.
Definition fsl_clock.h:381