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