diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/LPC55S66/project_template/clock_config.c')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/devices/LPC55S66/project_template/clock_config.c | 376 |
1 files changed, 376 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC55S66/project_template/clock_config.c b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC55S66/project_template/clock_config.c new file mode 100644 index 000000000..18b6f9e91 --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC55S66/project_template/clock_config.c | |||
@@ -0,0 +1,376 @@ | |||
1 | /* | ||
2 | * Copyright 2017-2018 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | /*********************************************************************************************************************** | ||
9 | * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file | ||
10 | * will be overwritten if the respective MCUXpresso Config Tools is used to update this file. | ||
11 | **********************************************************************************************************************/ | ||
12 | /* | ||
13 | * How to set up clock using clock driver functions: | ||
14 | * | ||
15 | * 1. Setup clock sources. | ||
16 | * | ||
17 | * 2. Set up wait states of the flash. | ||
18 | * | ||
19 | * 3. Set up all dividers. | ||
20 | * | ||
21 | * 4. Set up all selectors to provide selected clocks. | ||
22 | */ | ||
23 | |||
24 | /* clang-format off */ | ||
25 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
26 | !!GlobalInfo | ||
27 | product: Clocks v6.0 | ||
28 | processor: LPC55S66 | ||
29 | package_id: LPC55S66JBD100 | ||
30 | mcu_data: ksdk2_0 | ||
31 | processor_version: 0.2.11 | ||
32 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
33 | /* clang-format on */ | ||
34 | |||
35 | #include "fsl_power.h" | ||
36 | #include "fsl_clock.h" | ||
37 | #include "clock_config.h" | ||
38 | |||
39 | /******************************************************************************* | ||
40 | * Definitions | ||
41 | ******************************************************************************/ | ||
42 | |||
43 | /******************************************************************************* | ||
44 | * Variables | ||
45 | ******************************************************************************/ | ||
46 | /* System clock frequency. */ | ||
47 | extern uint32_t SystemCoreClock; | ||
48 | |||
49 | /******************************************************************************* | ||
50 | ************************ BOARD_InitBootClocks function ************************ | ||
51 | ******************************************************************************/ | ||
52 | void BOARD_InitBootClocks(void) | ||
53 | { | ||
54 | BOARD_BootClockPLL150M(); | ||
55 | } | ||
56 | |||
57 | /******************************************************************************* | ||
58 | ******************** Configuration BOARD_BootClockFRO12M ********************** | ||
59 | ******************************************************************************/ | ||
60 | /* clang-format off */ | ||
61 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
62 | !!Configuration | ||
63 | name: BOARD_BootClockFRO12M | ||
64 | outputs: | ||
65 | - {id: System_clock.outFreq, value: 12 MHz} | ||
66 | settings: | ||
67 | - {id: ANALOG_CONTROL_FRO192M_CTRL_ENDI_FRO_96M_CFG, value: Enable} | ||
68 | sources: | ||
69 | - {id: ANACTRL.fro_hf.outFreq, value: 96 MHz} | ||
70 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
71 | /* clang-format on */ | ||
72 | |||
73 | /******************************************************************************* | ||
74 | * Variables for BOARD_BootClockFRO12M configuration | ||
75 | ******************************************************************************/ | ||
76 | /******************************************************************************* | ||
77 | * Code for BOARD_BootClockFRO12M configuration | ||
78 | ******************************************************************************/ | ||
79 | void BOARD_BootClockFRO12M(void) | ||
80 | { | ||
81 | #ifndef SDK_SECONDARY_CORE | ||
82 | /*!< Set up the clock sources */ | ||
83 | /*!< Configure FRO192M */ | ||
84 | POWER_DisablePD(kPDRUNCFG_PD_FRO192M); /*!< Ensure FRO is on */ | ||
85 | CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */ | ||
86 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change the clock setting */ | ||
87 | |||
88 | CLOCK_SetupFROClocking(96000000U); /* Enable FRO HF(96MHz) output */ | ||
89 | |||
90 | POWER_SetVoltageForFreq( | ||
91 | 12000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
92 | CLOCK_SetFLASHAccessCyclesForFreq(12000000U); /*!< Set FLASH wait states for core */ | ||
93 | |||
94 | /*!< Set up dividers */ | ||
95 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */ | ||
96 | |||
97 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
98 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch MAIN_CLK to FRO12M */ | ||
99 | |||
100 | /*< Set SystemCoreClock variable. */ | ||
101 | SystemCoreClock = BOARD_BOOTCLOCKFRO12M_CORE_CLOCK; | ||
102 | #endif | ||
103 | } | ||
104 | |||
105 | /******************************************************************************* | ||
106 | ******************* Configuration BOARD_BootClockFROHF96M ********************* | ||
107 | ******************************************************************************/ | ||
108 | /* clang-format off */ | ||
109 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
110 | !!Configuration | ||
111 | name: BOARD_BootClockFROHF96M | ||
112 | outputs: | ||
113 | - {id: System_clock.outFreq, value: 96 MHz} | ||
114 | settings: | ||
115 | - {id: ANALOG_CONTROL_FRO192M_CTRL_ENDI_FRO_96M_CFG, value: Enable} | ||
116 | - {id: SYSCON.MAINCLKSELA.sel, value: ANACTRL.fro_hf_clk} | ||
117 | sources: | ||
118 | - {id: ANACTRL.fro_hf.outFreq, value: 96 MHz} | ||
119 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
120 | /* clang-format on */ | ||
121 | |||
122 | /******************************************************************************* | ||
123 | * Variables for BOARD_BootClockFROHF96M configuration | ||
124 | ******************************************************************************/ | ||
125 | /******************************************************************************* | ||
126 | * Code for BOARD_BootClockFROHF96M configuration | ||
127 | ******************************************************************************/ | ||
128 | void BOARD_BootClockFROHF96M(void) | ||
129 | { | ||
130 | #ifndef SDK_SECONDARY_CORE | ||
131 | /*!< Set up the clock sources */ | ||
132 | /*!< Configure FRO192M */ | ||
133 | POWER_DisablePD(kPDRUNCFG_PD_FRO192M); /*!< Ensure FRO is on */ | ||
134 | CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */ | ||
135 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change the clock setting */ | ||
136 | |||
137 | CLOCK_SetupFROClocking(96000000U); /* Enable FRO HF(96MHz) output */ | ||
138 | |||
139 | POWER_SetVoltageForFreq( | ||
140 | 96000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
141 | CLOCK_SetFLASHAccessCyclesForFreq(96000000U); /*!< Set FLASH wait states for core */ | ||
142 | |||
143 | /*!< Set up dividers */ | ||
144 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */ | ||
145 | |||
146 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
147 | CLOCK_AttachClk(kFRO_HF_to_MAIN_CLK); /*!< Switch MAIN_CLK to FRO_HF */ | ||
148 | |||
149 | /*< Set SystemCoreClock variable. */ | ||
150 | SystemCoreClock = BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK; | ||
151 | #endif | ||
152 | } | ||
153 | |||
154 | /******************************************************************************* | ||
155 | ******************** Configuration BOARD_BootClockPLL100M ********************* | ||
156 | ******************************************************************************/ | ||
157 | /* clang-format off */ | ||
158 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
159 | !!Configuration | ||
160 | name: BOARD_BootClockPLL100M | ||
161 | outputs: | ||
162 | - {id: System_clock.outFreq, value: 100 MHz} | ||
163 | settings: | ||
164 | - {id: PLL0_Mode, value: Normal} | ||
165 | - {id: ANALOG_CONTROL_FRO192M_CTRL_ENDI_FRO_96M_CFG, value: Enable} | ||
166 | - {id: ENABLE_CLKIN_ENA, value: Enabled} | ||
167 | - {id: ENABLE_SYSTEM_CLK_OUT, value: Enabled} | ||
168 | - {id: SYSCON.MAINCLKSELB.sel, value: SYSCON.PLL0_BYPASS} | ||
169 | - {id: SYSCON.PLL0CLKSEL.sel, value: SYSCON.CLK_IN_EN} | ||
170 | - {id: SYSCON.PLL0M_MULT.scale, value: '100', locked: true} | ||
171 | - {id: SYSCON.PLL0N_DIV.scale, value: '4', locked: true} | ||
172 | - {id: SYSCON.PLL0_PDEC.scale, value: '4', locked: true} | ||
173 | sources: | ||
174 | - {id: ANACTRL.fro_hf.outFreq, value: 96 MHz} | ||
175 | - {id: SYSCON.XTAL32M.outFreq, value: 16 MHz, enabled: true} | ||
176 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
177 | /* clang-format on */ | ||
178 | |||
179 | /******************************************************************************* | ||
180 | * Variables for BOARD_BootClockPLL100M configuration | ||
181 | ******************************************************************************/ | ||
182 | /******************************************************************************* | ||
183 | * Code for BOARD_BootClockPLL100M configuration | ||
184 | ******************************************************************************/ | ||
185 | void BOARD_BootClockPLL100M(void) | ||
186 | { | ||
187 | #ifndef SDK_SECONDARY_CORE | ||
188 | /*!< Set up the clock sources */ | ||
189 | /*!< Configure FRO192M */ | ||
190 | POWER_DisablePD(kPDRUNCFG_PD_FRO192M); /*!< Ensure FRO is on */ | ||
191 | CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */ | ||
192 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change the clock setting */ | ||
193 | |||
194 | CLOCK_SetupFROClocking(96000000U); /* Enable FRO HF(96MHz) output */ | ||
195 | |||
196 | /*!< Configure XTAL32M */ | ||
197 | POWER_DisablePD(kPDRUNCFG_PD_XTAL32M); /* Ensure XTAL32M is powered */ | ||
198 | POWER_DisablePD(kPDRUNCFG_PD_LDOXO32M); /* Ensure XTAL32M is powered */ | ||
199 | CLOCK_SetupExtClocking(16000000U); /* Enable clk_in clock */ | ||
200 | SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK; /* Enable clk_in from XTAL32M clock */ | ||
201 | ANACTRL->XO32M_CTRL |= ANACTRL_XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_MASK; /* Enable clk_in to system */ | ||
202 | |||
203 | POWER_SetVoltageForFreq( | ||
204 | 100000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
205 | CLOCK_SetFLASHAccessCyclesForFreq(100000000U); /*!< Set FLASH wait states for core */ | ||
206 | |||
207 | /*!< Set up PLL */ | ||
208 | CLOCK_AttachClk(kEXT_CLK_to_PLL0); /*!< Switch PLL0CLKSEL to EXT_CLK */ | ||
209 | POWER_DisablePD(kPDRUNCFG_PD_PLL0); /* Ensure PLL is on */ | ||
210 | POWER_DisablePD(kPDRUNCFG_PD_PLL0_SSCG); | ||
211 | const pll_setup_t pll0Setup = { | ||
212 | .pllctrl = SYSCON_PLL0CTRL_CLKEN_MASK | SYSCON_PLL0CTRL_SELI(53U) | SYSCON_PLL0CTRL_SELP(26U), | ||
213 | .pllndec = SYSCON_PLL0NDEC_NDIV(4U), | ||
214 | .pllpdec = SYSCON_PLL0PDEC_PDIV(2U), | ||
215 | .pllsscg = {0x0U, (SYSCON_PLL0SSCG1_MDIV_EXT(100U) | SYSCON_PLL0SSCG1_SEL_EXT_MASK)}, | ||
216 | .pllRate = 100000000U, | ||
217 | .flags = PLL_SETUPFLAG_WAITLOCK}; | ||
218 | CLOCK_SetPLL0Freq(&pll0Setup); /*!< Configure PLL0 to the desired values */ | ||
219 | |||
220 | /*!< Set up dividers */ | ||
221 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */ | ||
222 | |||
223 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
224 | CLOCK_AttachClk(kPLL0_to_MAIN_CLK); /*!< Switch MAIN_CLK to PLL0 */ | ||
225 | |||
226 | /*< Set SystemCoreClock variable. */ | ||
227 | SystemCoreClock = BOARD_BOOTCLOCKPLL100M_CORE_CLOCK; | ||
228 | #endif | ||
229 | } | ||
230 | |||
231 | /******************************************************************************* | ||
232 | ******************** Configuration BOARD_BootClockPLL150M ********************* | ||
233 | ******************************************************************************/ | ||
234 | /* clang-format off */ | ||
235 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
236 | !!Configuration | ||
237 | name: BOARD_BootClockPLL150M | ||
238 | called_from_default_init: true | ||
239 | outputs: | ||
240 | - {id: System_clock.outFreq, value: 150 MHz} | ||
241 | settings: | ||
242 | - {id: PLL0_Mode, value: Normal} | ||
243 | - {id: ENABLE_CLKIN_ENA, value: Enabled} | ||
244 | - {id: ENABLE_SYSTEM_CLK_OUT, value: Enabled} | ||
245 | - {id: SYSCON.MAINCLKSELB.sel, value: SYSCON.PLL0_BYPASS} | ||
246 | - {id: SYSCON.PLL0CLKSEL.sel, value: SYSCON.CLK_IN_EN} | ||
247 | - {id: SYSCON.PLL0M_MULT.scale, value: '150', locked: true} | ||
248 | - {id: SYSCON.PLL0N_DIV.scale, value: '8', locked: true} | ||
249 | - {id: SYSCON.PLL0_PDEC.scale, value: '2', locked: true} | ||
250 | sources: | ||
251 | - {id: SYSCON.XTAL32M.outFreq, value: 16 MHz, enabled: true} | ||
252 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
253 | /* clang-format on */ | ||
254 | |||
255 | /******************************************************************************* | ||
256 | * Variables for BOARD_BootClockPLL150M configuration | ||
257 | ******************************************************************************/ | ||
258 | /******************************************************************************* | ||
259 | * Code for BOARD_BootClockPLL150M configuration | ||
260 | ******************************************************************************/ | ||
261 | void BOARD_BootClockPLL150M(void) | ||
262 | { | ||
263 | #ifndef SDK_SECONDARY_CORE | ||
264 | /*!< Set up the clock sources */ | ||
265 | /*!< Configure FRO192M */ | ||
266 | POWER_DisablePD(kPDRUNCFG_PD_FRO192M); /*!< Ensure FRO is on */ | ||
267 | CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */ | ||
268 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change the clock setting */ | ||
269 | |||
270 | /*!< Configure XTAL32M */ | ||
271 | POWER_DisablePD(kPDRUNCFG_PD_XTAL32M); /* Ensure XTAL32M is powered */ | ||
272 | POWER_DisablePD(kPDRUNCFG_PD_LDOXO32M); /* Ensure XTAL32M is powered */ | ||
273 | CLOCK_SetupExtClocking(16000000U); /* Enable clk_in clock */ | ||
274 | SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK; /* Enable clk_in from XTAL32M clock */ | ||
275 | ANACTRL->XO32M_CTRL |= ANACTRL_XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_MASK; /* Enable clk_in to system */ | ||
276 | |||
277 | POWER_SetVoltageForFreq( | ||
278 | 150000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
279 | CLOCK_SetFLASHAccessCyclesForFreq(150000000U); /*!< Set FLASH wait states for core */ | ||
280 | |||
281 | /*!< Set up PLL */ | ||
282 | CLOCK_AttachClk(kEXT_CLK_to_PLL0); /*!< Switch PLL0CLKSEL to EXT_CLK */ | ||
283 | POWER_DisablePD(kPDRUNCFG_PD_PLL0); /* Ensure PLL is on */ | ||
284 | POWER_DisablePD(kPDRUNCFG_PD_PLL0_SSCG); | ||
285 | const pll_setup_t pll0Setup = { | ||
286 | .pllctrl = SYSCON_PLL0CTRL_CLKEN_MASK | SYSCON_PLL0CTRL_SELI(53U) | SYSCON_PLL0CTRL_SELP(31U), | ||
287 | .pllndec = SYSCON_PLL0NDEC_NDIV(8U), | ||
288 | .pllpdec = SYSCON_PLL0PDEC_PDIV(1U), | ||
289 | .pllsscg = {0x0U, (SYSCON_PLL0SSCG1_MDIV_EXT(150U) | SYSCON_PLL0SSCG1_SEL_EXT_MASK)}, | ||
290 | .pllRate = 150000000U, | ||
291 | .flags = PLL_SETUPFLAG_WAITLOCK}; | ||
292 | CLOCK_SetPLL0Freq(&pll0Setup); /*!< Configure PLL0 to the desired values */ | ||
293 | |||
294 | /*!< Set up dividers */ | ||
295 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */ | ||
296 | |||
297 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
298 | CLOCK_AttachClk(kPLL0_to_MAIN_CLK); /*!< Switch MAIN_CLK to PLL0 */ | ||
299 | |||
300 | /*< Set SystemCoreClock variable. */ | ||
301 | SystemCoreClock = BOARD_BOOTCLOCKPLL150M_CORE_CLOCK; | ||
302 | #endif | ||
303 | } | ||
304 | |||
305 | /******************************************************************************* | ||
306 | ******************* Configuration BOARD_BootClockPLL1_150M ******************** | ||
307 | ******************************************************************************/ | ||
308 | /* clang-format off */ | ||
309 | /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* | ||
310 | !!Configuration | ||
311 | name: BOARD_BootClockPLL1_150M | ||
312 | outputs: | ||
313 | - {id: System_clock.outFreq, value: 150 MHz} | ||
314 | settings: | ||
315 | - {id: PLL1_Mode, value: Normal} | ||
316 | - {id: ENABLE_CLKIN_ENA, value: Enabled} | ||
317 | - {id: ENABLE_SYSTEM_CLK_OUT, value: Enabled} | ||
318 | - {id: SYSCON.MAINCLKSELB.sel, value: SYSCON.PLL1_BYPASS} | ||
319 | - {id: SYSCON.PLL1CLKSEL.sel, value: SYSCON.CLK_IN_EN} | ||
320 | - {id: SYSCON.PLL1M_MULT.scale, value: '150', locked: true} | ||
321 | - {id: SYSCON.PLL1N_DIV.scale, value: '8', locked: true} | ||
322 | - {id: SYSCON.PLL1_PDEC.scale, value: '2', locked: true} | ||
323 | sources: | ||
324 | - {id: SYSCON.XTAL32M.outFreq, value: 16 MHz, enabled: true} | ||
325 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ | ||
326 | /* clang-format on */ | ||
327 | |||
328 | /******************************************************************************* | ||
329 | * Variables for BOARD_BootClockPLL1_150M configuration | ||
330 | ******************************************************************************/ | ||
331 | /******************************************************************************* | ||
332 | * Code for BOARD_BootClockPLL1_150M configuration | ||
333 | ******************************************************************************/ | ||
334 | void BOARD_BootClockPLL1_150M(void) | ||
335 | { | ||
336 | #ifndef SDK_SECONDARY_CORE | ||
337 | /*!< Set up the clock sources */ | ||
338 | /*!< Configure FRO192M */ | ||
339 | POWER_DisablePD(kPDRUNCFG_PD_FRO192M); /*!< Ensure FRO is on */ | ||
340 | CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */ | ||
341 | CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change the clock setting */ | ||
342 | |||
343 | /*!< Configure XTAL32M */ | ||
344 | POWER_DisablePD(kPDRUNCFG_PD_XTAL32M); /* Ensure XTAL32M is powered */ | ||
345 | POWER_DisablePD(kPDRUNCFG_PD_LDOXO32M); /* Ensure XTAL32M is powered */ | ||
346 | CLOCK_SetupExtClocking(16000000U); /* Enable clk_in clock */ | ||
347 | SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_CLKIN_ENA_MASK; /* Enable clk_in from XTAL32M clock */ | ||
348 | ANACTRL->XO32M_CTRL |= ANACTRL_XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_MASK; /* Enable clk_in to system */ | ||
349 | |||
350 | POWER_SetVoltageForFreq(150000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ | ||
351 | CLOCK_SetFLASHAccessCyclesForFreq(150000000U); /*!< Set FLASH wait states for core */ | ||
352 | |||
353 | /*!< Set up PLL1 */ | ||
354 | CLOCK_AttachClk(kEXT_CLK_to_PLL1); /*!< Switch PLL1CLKSEL to EXT_CLK */ | ||
355 | POWER_DisablePD(kPDRUNCFG_PD_PLL1); /* Ensure PLL is on */ | ||
356 | const pll_setup_t pll1Setup = { | ||
357 | .pllctrl = SYSCON_PLL1CTRL_CLKEN_MASK | SYSCON_PLL1CTRL_SELI(53U) | SYSCON_PLL1CTRL_SELP(31U), | ||
358 | .pllndec = SYSCON_PLL1NDEC_NDIV(8U), | ||
359 | .pllpdec = SYSCON_PLL1PDEC_PDIV(1U), | ||
360 | .pllmdec = SYSCON_PLL1MDEC_MDIV(150U), | ||
361 | .pllRate = 150000000U, | ||
362 | .flags = PLL_SETUPFLAG_WAITLOCK | ||
363 | }; | ||
364 | CLOCK_SetPLL1Freq(&pll1Setup); /*!< Configure PLL1 to the desired values */ | ||
365 | |||
366 | /*!< Set up dividers */ | ||
367 | CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */ | ||
368 | |||
369 | /*!< Set up clock selectors - Attach clocks to the peripheries */ | ||
370 | CLOCK_AttachClk(kPLL1_to_MAIN_CLK); /*!< Switch MAIN_CLK to PLL1 */ | ||
371 | |||
372 | /*< Set SystemCoreClock variable. */ | ||
373 | SystemCoreClock = BOARD_BOOTCLOCKPLL1_150M_CORE_CLOCK; | ||
374 | #endif | ||
375 | } | ||
376 | |||