1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6<meta name="generator" content="Doxygen 1.8.13"/>
7<meta name="viewport" content="width=device-width, initial-scale=1"/>
8<title>ISSDK: boardkit/frdm-kl27z/clock_config.c Source File</title>
9<link href="tabs.css" rel="stylesheet" type="text/css"/>
10<script type="text/javascript" src="jquery.js"></script>
11<script type="text/javascript" src="dynsections.js"></script>
12<link href="issdk_stylesheet.css" rel="stylesheet" type="text/css" />
13</head>
14<body>
15<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
16<div id="titlearea">
17<table cellspacing="0" cellpadding="0">
18 <tbody>
19 <tr style="height: 56px;">
20  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
21  <td id="projectalign" style="padding-left: 0.5em;">
22   <div id="projectname">ISSDK
23   &#160;<span id="projectnumber">1.8</span>
24   </div>
25   <div id="projectbrief">IoT Sensing Software Development Kit</div>
26  </td>
27 </tr>
28 </tbody>
29</table>
30</div>
31<!-- end header part -->
32<!-- Generated by Doxygen 1.8.13 -->
33<script type="text/javascript" src="menudata.js"></script>
34<script type="text/javascript" src="menu.js"></script>
35<script type="text/javascript">
36$(function() {
37  initMenu('',false,false,'search.php','Search');
38});
39</script>
40<div id="main-nav"></div>
41<div id="nav-path" class="navpath">
42  <ul>
43<li class="navelem"><a class="el" href="dir_6994211064bad48d3d63a6227f5100d6.html">boardkit</a></li><li class="navelem"><a class="el" href="dir_abd342d108ad7d5a8a03af53b5f77dfc.html">frdm-kl27z</a></li>  </ul>
44</div>
45</div><!-- top -->
46<div class="header">
47  <div class="headertitle">
48<div class="title">clock_config.c</div>  </div>
49</div><!--header-->
50<div class="contents">
51<a href="a04232.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2015, Freescale Semiconductor, Inc.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Copyright 2016-2017 NXP</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * All rights reserved.</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * SPDX-License-Identifier: BSD-3-Clause</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * How to setup clock using clock driver functions:</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *    and flash clock are in allowed range during clock mode switch.</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode.</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * 3. Call CLOCK_SetMcgliteConfig to set MCG_Lite configuration.</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM.</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">/* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">!!ClocksProfile</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">product: Clocks v1.0</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">processor: MKL27Z64xxx4</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">package_id: MKL27Z64VLH4</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">mcu_data: ksdk2_0</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">processor_version: 1.0.1</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">board: FRDM-KL27Z</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment"> * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &quot;fsl_smc.h&quot;</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="a04289.html">clock_config.h</a>&quot;</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment"> * Definitions</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="a04232.html#add5e76ff128f2a9e4c3803c2b0161f92">   38</a></span>&#160;<span class="preprocessor">#define SIM_OSC32KSEL_OSC32KCLK_CLK                       0U  </span><span class="comment">/*!&lt; OSC32KSEL select: OSC32KCLK clock */</span><span class="preprocessor"></span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment"> * Variables</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">/* System clock frequency. */</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="keyword">extern</span> uint32_t <a class="code" href="a04223.html#aa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment"> ********************** Configuration BOARD_BootClockRUN ***********************</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment">/* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment">!!Configuration</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">name: BOARD_BootClockRUN</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">outputs:</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment">- {id: Bus_clock.outFreq, value: 24 MHz}</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">- {id: Core_clock.outFreq, value: 48 MHz}</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment">- {id: Flash_clock.outFreq, value: 24 MHz}</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="comment">- {id: LPO_clock.outFreq, value: 1 kHz}</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment">- {id: MCGIRCLK.outFreq, value: 8 MHz}</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">- {id: MCGPCLK.outFreq, value: 48 MHz}</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment">- {id: System_clock.outFreq, value: 48 MHz}</span></div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment">settings:</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="comment">- {id: MCGMode, value: HIRC}</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="comment">- {id: MCG.CLKS.sel, value: MCG.HIRC}</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="comment">- {id: MCG_C2_OSC_MODE_CFG, value: ModeOscLowPower}</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="comment">- {id: MCG_MC_HIRCEN_CFG, value: Enabled}</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="comment">- {id: OSC0_CR_ERCLKEN_CFG, value: Enabled}</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="comment">- {id: OSC_CR_ERCLKEN_CFG, value: Enabled}</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment">- {id: OSC_CR_SYS_OSC_CAP_LOAD_CFG, value: SC12PF}</span></div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="comment">- {id: SIM.CLKOUTSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment">- {id: SIM.COPCLKSEL.sel, value: OSC.OSCERCLK}</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">- {id: SIM.FLEXIOSRCSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="comment">- {id: SIM.LPUART0SRCSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="comment">- {id: SIM.LPUART1SRCSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="comment">- {id: SIM.RTCCLKOUTSEL.sel, value: OSC.OSCERCLK}</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="comment">- {id: SIM.TPMSRCSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="comment">- {id: SIM.USBSRCSEL.sel, value: MCG.MCGPCLK}</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="comment">sources:</span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment">- {id: MCG.HIRC.outFreq, value: 48 MHz}</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment">- {id: OSC.OSC.outFreq, value: 32.768 kHz}</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="comment"> * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="comment"> * Variables for BOARD_BootClockRUN configuration</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="a04289.html#a5798795d229f04f06b6d48f215ada1c2">   84</a></span>&#160;<span class="keyword">const</span> mcglite_config_t <a class="code" href="a04232.html#a5798795d229f04f06b6d48f215ada1c2">mcgliteConfig_BOARD_BootClockRUN</a> =</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    {</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        .outSrc = kMCGLITE_ClkSrcHirc,            <span class="comment">/* MCGOUTCLK source is HIRC */</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        .irclkEnableMode = kMCGLITE_IrclkEnable,  <span class="comment">/* MCGIRCLK enabled, MCGIRCLK disabled in STOP mode */</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        .ircs = kMCGLITE_Lirc8M,                  <span class="comment">/* Slow internal reference (LIRC) 8 MHz clock selected */</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        .fcrdiv = kMCGLITE_LircDivBy1,            <span class="comment">/* Low-frequency Internal Reference Clock Divider: divided by 1 */</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        .lircDiv2 = kMCGLITE_LircDivBy1,          <span class="comment">/* Second Low-frequency Internal Reference Clock Divider: divided by 1 */</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        .hircEnableInNotHircMode = <span class="keyword">true</span>,          <span class="comment">/* HIRC source is enabled */</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    };</div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="a04232.html#a0ce73e827dc487aaac07190a651d9dff">   93</a></span>&#160;<span class="keyword">const</span> sim_clock_config_t <a class="code" href="a04223.html#a0ce73e827dc487aaac07190a651d9dff">simConfig_BOARD_BootClockRUN</a> =</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    {</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        .er32kSrc = <a class="code" href="a04232.html#add5e76ff128f2a9e4c3803c2b0161f92">SIM_OSC32KSEL_OSC32KCLK_CLK</a>,  <span class="comment">/* OSC32KSEL select: OSC32KCLK clock */</span></div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        .clkdiv1 = 0x10000U,                      <span class="comment">/* SIM_CLKDIV1 - OUTDIV1: /1, OUTDIV4: /2 */</span></div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    };</div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="a04232.html#a8a30f1ebc78e392bb8b05a8fdd7cca15">   98</a></span>&#160;<span class="keyword">const</span> osc_config_t <a class="code" href="a04223.html#a8a30f1ebc78e392bb8b05a8fdd7cca15">oscConfig_BOARD_BootClockRUN</a> =</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    {</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        .freq = 0U,                               <span class="comment">/* Oscillator frequency: 0Hz */</span></div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        .capLoad = (kOSC_Cap4P | kOSC_Cap8P),     <span class="comment">/* Oscillator capacity load: 12pF */</span></div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        .workMode = kOSC_ModeOscLowPower,         <span class="comment">/* Oscillator low power */</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        .oscerConfig =</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            {</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                .enableMode = kOSC_ErClkEnable,   <span class="comment">/* Enable external reference clock, disable external reference clock in STOP mode */</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            }</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    };</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment"> * Code for BOARD_BootClockRUN configuration</span></div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="a04232.html#a5e69c4eff0fd5236bbb0ff4e1d5a7a7e">  112</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="a04223.html#a5e69c4eff0fd5236bbb0ff4e1d5a7a7e">BOARD_BootClockRUN</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;{</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="comment">/* Set the system clock dividers in SIM to safe value. */</span></div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    CLOCK_SetSimSafeDivs();</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="comment">/* Set MCG to HIRC mode. */</span></div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    CLOCK_SetMcgliteConfig(&amp;<a class="code" href="a04232.html#a5798795d229f04f06b6d48f215ada1c2">mcgliteConfig_BOARD_BootClockRUN</a>);</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    <span class="comment">/* Set the clock configuration in SIM module. */</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    CLOCK_SetSimConfig(&amp;<a class="code" href="a04223.html#a0ce73e827dc487aaac07190a651d9dff">simConfig_BOARD_BootClockRUN</a>);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="comment">/* Set SystemCoreClock variable. */</span></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <a class="code" href="a04223.html#aa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a> = <a class="code" href="a04280.html#a6ae55dea13be64e40de107ee288779f3">BOARD_BOOTCLOCKRUN_CORE_CLOCK</a>;</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;}</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="comment"> ********************* Configuration BOARD_BootClockVLPR ***********************</span></div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="comment">/* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="comment">!!Configuration</span></div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="comment">name: BOARD_BootClockVLPR</span></div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="comment">outputs:</span></div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;<span class="comment">- {id: Bus_clock.outFreq, value: 1 MHz}</span></div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="comment">- {id: Core_clock.outFreq, value: 2 MHz}</span></div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="comment">- {id: Flash_clock.outFreq, value: 1 MHz}</span></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="comment">- {id: LPO_clock.outFreq, value: 1 kHz}</span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="comment">- {id: MCGIRCLK.outFreq, value: 2 MHz}</span></div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="comment">- {id: System_clock.outFreq, value: 2 MHz}</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="comment">settings:</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="comment">- {id: MCGMode, value: LIRC2M}</span></div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;<span class="comment">- {id: powerMode, value: VLPR}</span></div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="comment">- {id: MCG.LIRCDIV1.scale, value: &#39;1&#39;, locked: true}</span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="comment">- {id: OSC0_CR_ERCLKEN_CFG, value: Enabled}</span></div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="comment">- {id: OSC_CR_ERCLKEN_CFG, value: Enabled}</span></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="comment">- {id: OSC_CR_SYS_OSC_CAP_LOAD_CFG, value: SC12PF}</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="comment">- {id: RTCCLKOUTConfig, value: &#39;yes&#39;}</span></div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="comment">- {id: SIM.OUTDIV1.scale, value: &#39;1&#39;, locked: true}</span></div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="comment">- {id: SIM.OUTDIV4.scale, value: &#39;2&#39;, locked: true}</span></div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="comment">- {id: SIM.RTCCLKOUTSEL.sel, value: OSC.OSCERCLK}</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;<span class="comment">sources:</span></div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="comment">- {id: MCG.LIRC.outFreq, value: 2 MHz}</span></div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;<span class="comment">- {id: OSC.OSC.outFreq, value: 32.768 kHz}</span></div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;<span class="comment"> * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/</span></div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="comment"> * Variables for BOARD_BootClockVLPR configuration</span></div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="a04289.html#af74b49a15230f47e1b4dac6c4b3475ec">  156</a></span>&#160;<span class="keyword">const</span> mcglite_config_t <a class="code" href="a04232.html#af74b49a15230f47e1b4dac6c4b3475ec">mcgliteConfig_BOARD_BootClockVLPR</a> =</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    {</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        .outSrc = kMCGLITE_ClkSrcLirc,            <span class="comment">/* MCGOUTCLK source is LIRC */</span></div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;        .irclkEnableMode = kMCGLITE_IrclkEnable,  <span class="comment">/* MCGIRCLK enabled, MCGIRCLK disabled in STOP mode */</span></div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        .ircs = kMCGLITE_Lirc2M,                  <span class="comment">/* Slow internal reference (LIRC) 2 MHz clock selected */</span></div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        .fcrdiv = kMCGLITE_LircDivBy1,            <span class="comment">/* Low-frequency Internal Reference Clock Divider: divided by 1 */</span></div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        .lircDiv2 = kMCGLITE_LircDivBy1,          <span class="comment">/* Second Low-frequency Internal Reference Clock Divider: divided by 1 */</span></div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        .hircEnableInNotHircMode = <span class="keyword">false</span>,         <span class="comment">/* HIRC source is not enabled */</span></div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    };</div><div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="a04232.html#af1ec80b657d4d5d4e60ab69d71808807">  165</a></span>&#160;<span class="keyword">const</span> sim_clock_config_t <a class="code" href="a04223.html#af1ec80b657d4d5d4e60ab69d71808807">simConfig_BOARD_BootClockVLPR</a> =</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    {</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;        .er32kSrc = <a class="code" href="a04232.html#add5e76ff128f2a9e4c3803c2b0161f92">SIM_OSC32KSEL_OSC32KCLK_CLK</a>,  <span class="comment">/* OSC32KSEL select: OSC32KCLK clock */</span></div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        .clkdiv1 = 0x10000U,                      <span class="comment">/* SIM_CLKDIV1 - OUTDIV1: /1, OUTDIV4: /2 */</span></div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;    };</div><div class="line"><a name="l00170"></a><span class="lineno"><a class="line" href="a04232.html#a725699f951cc1d3f2007cc96cab2d142">  170</a></span>&#160;<span class="keyword">const</span> osc_config_t <a class="code" href="a04223.html#a725699f951cc1d3f2007cc96cab2d142">oscConfig_BOARD_BootClockVLPR</a> =</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    {</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;        .freq = 0U,                               <span class="comment">/* Oscillator frequency: 0Hz */</span></div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        .capLoad = (kOSC_Cap4P | kOSC_Cap8P),     <span class="comment">/* Oscillator capacity load: 12pF */</span></div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        .workMode = kOSC_ModeExt,                 <span class="comment">/* Use external clock */</span></div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;        .oscerConfig =</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            {</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                .enableMode = kOSC_ErClkEnable,   <span class="comment">/* Enable external reference clock, disable external reference clock in STOP mode */</span></div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;            }</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    };</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;<span class="comment">/*******************************************************************************</span></div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="comment"> * Code for BOARD_BootClockVLPR configuration</span></div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="comment"> ******************************************************************************/</span></div><div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="a04232.html#aeda06d8bee4b00642713d50a62d8edc9">  184</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="a04223.html#aeda06d8bee4b00642713d50a62d8edc9">BOARD_BootClockVLPR</a>(<span class="keywordtype">void</span>)</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;{</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="comment">/* Set the system clock dividers in SIM to safe value. */</span></div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    CLOCK_SetSimSafeDivs();</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <span class="comment">/* Set MCG to LIRC2M mode. */</span></div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    CLOCK_SetMcgliteConfig(&amp;<a class="code" href="a04232.html#af74b49a15230f47e1b4dac6c4b3475ec">mcgliteConfig_BOARD_BootClockVLPR</a>);</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    <span class="comment">/* Set the clock configuration in SIM module. */</span></div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    CLOCK_SetSimConfig(&amp;<a class="code" href="a04223.html#af1ec80b657d4d5d4e60ab69d71808807">simConfig_BOARD_BootClockVLPR</a>);</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="comment">/* Set VLPR power mode. */</span></div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    SMC_SetPowerModeProtection(<a class="code" href="a00641.html#a6667e81e5b32250febd3d46511d9309d">SMC</a>, kSMC_AllowPowerModeAll);</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;<span class="preprocessor">#if (defined(FSL_FEATURE_SMC_HAS_LPWUI) &amp;&amp; FSL_FEATURE_SMC_HAS_LPWUI)</span></div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <a class="code" href="a00638.html#a82cb114bb9a5ea2f235a0216709d70f8">SMC_SetPowerModeVlpr</a>(<a class="code" href="a00641.html#a6667e81e5b32250febd3d46511d9309d">SMC</a>, <span class="keyword">false</span>);</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <a class="code" href="a00638.html#a82cb114bb9a5ea2f235a0216709d70f8">SMC_SetPowerModeVlpr</a>(<a class="code" href="a00641.html#a6667e81e5b32250febd3d46511d9309d">SMC</a>);</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">while</span> (SMC_GetPowerModeState(<a class="code" href="a00641.html#a6667e81e5b32250febd3d46511d9309d">SMC</a>) != kSMC_PowerStateVlpr)</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    {</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;    }</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="comment">/* Set SystemCoreClock variable. */</span></div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <a class="code" href="a04223.html#aa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a> = <a class="code" href="a04280.html#a210b0086dcdb8229f4941c823588f142">BOARD_BOOTCLOCKVLPR_CORE_CLOCK</a>;</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;}</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160; </div><div class="ttc" id="a04232_html_af74b49a15230f47e1b4dac6c4b3475ec"><div class="ttname"><a href="a04232.html#af74b49a15230f47e1b4dac6c4b3475ec">mcgliteConfig_BOARD_BootClockVLPR</a></div><div class="ttdeci">const mcglite_config_t mcgliteConfig_BOARD_BootClockVLPR</div><div class="ttdoc">MCG lite set for BOARD_BootClockVLPR configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04232_source.html#l00156">clock_config.c:156</a></div></div>
52<div class="ttc" id="a04232_html_add5e76ff128f2a9e4c3803c2b0161f92"><div class="ttname"><a href="a04232.html#add5e76ff128f2a9e4c3803c2b0161f92">SIM_OSC32KSEL_OSC32KCLK_CLK</a></div><div class="ttdeci">#define SIM_OSC32KSEL_OSC32KCLK_CLK</div><div class="ttdef"><b>Definition:</b> <a href="a04232_source.html#l00038">clock_config.c:38</a></div></div>
53<div class="ttc" id="a00638_html_a82cb114bb9a5ea2f235a0216709d70f8"><div class="ttname"><a href="a00638.html#a82cb114bb9a5ea2f235a0216709d70f8">SMC_SetPowerModeVlpr</a></div><div class="ttdeci">status_t SMC_SetPowerModeVlpr(void *arg)</div><div class="ttdoc">Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...</div><div class="ttdef"><b>Definition:</b> <a href="a00638_source.html#l00169">lpc54114.c:169</a></div></div>
54<div class="ttc" id="a04232_html_a5798795d229f04f06b6d48f215ada1c2"><div class="ttname"><a href="a04232.html#a5798795d229f04f06b6d48f215ada1c2">mcgliteConfig_BOARD_BootClockRUN</a></div><div class="ttdeci">const mcglite_config_t mcgliteConfig_BOARD_BootClockRUN</div><div class="ttdoc">MCG lite set for BOARD_BootClockRUN configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04232_source.html#l00084">clock_config.c:84</a></div></div>
55<div class="ttc" id="a00641_html_a6667e81e5b32250febd3d46511d9309d"><div class="ttname"><a href="a00641.html#a6667e81e5b32250febd3d46511d9309d">SMC</a></div><div class="ttdeci">#define SMC</div><div class="ttdef"><b>Definition:</b> <a href="a00641_source.html#l00118">lpc54114.h:118</a></div></div>
56<div class="ttc" id="a04223_html_a725699f951cc1d3f2007cc96cab2d142"><div class="ttname"><a href="a04223.html#a725699f951cc1d3f2007cc96cab2d142">oscConfig_BOARD_BootClockVLPR</a></div><div class="ttdeci">const osc_config_t oscConfig_BOARD_BootClockVLPR</div><div class="ttdoc">OSC set for BOARD_BootClockVLPR configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00252">clock_config.c:252</a></div></div>
57<div class="ttc" id="a04223_html_aeda06d8bee4b00642713d50a62d8edc9"><div class="ttname"><a href="a04223.html#aeda06d8bee4b00642713d50a62d8edc9">BOARD_BootClockVLPR</a></div><div class="ttdeci">void BOARD_BootClockVLPR(void)</div><div class="ttdoc">This function executes configuration of clocks. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00266">clock_config.c:266</a></div></div>
58<div class="ttc" id="a04223_html_a0ce73e827dc487aaac07190a651d9dff"><div class="ttname"><a href="a04223.html#a0ce73e827dc487aaac07190a651d9dff">simConfig_BOARD_BootClockRUN</a></div><div class="ttdeci">const sim_clock_config_t simConfig_BOARD_BootClockRUN</div><div class="ttdoc">SIM module set for BOARD_BootClockRUN configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00148">clock_config.c:148</a></div></div>
59<div class="ttc" id="a04280_html_a210b0086dcdb8229f4941c823588f142"><div class="ttname"><a href="a04280.html#a210b0086dcdb8229f4941c823588f142">BOARD_BOOTCLOCKVLPR_CORE_CLOCK</a></div><div class="ttdeci">#define BOARD_BOOTCLOCKVLPR_CORE_CLOCK</div><div class="ttdef"><b>Definition:</b> <a href="a04280_source.html#l00060">clock_config.h:60</a></div></div>
60<div class="ttc" id="a04223_html_a8a30f1ebc78e392bb8b05a8fdd7cca15"><div class="ttname"><a href="a04223.html#a8a30f1ebc78e392bb8b05a8fdd7cca15">oscConfig_BOARD_BootClockRUN</a></div><div class="ttdeci">const osc_config_t oscConfig_BOARD_BootClockRUN</div><div class="ttdoc">OSC set for BOARD_BootClockRUN configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00154">clock_config.c:154</a></div></div>
61<div class="ttc" id="a04223_html_aa3cd3e43291e81e795d642b79b6088e6"><div class="ttname"><a href="a04223.html#aa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a></div><div class="ttdeci">uint32_t SystemCoreClock</div></div>
62<div class="ttc" id="a04223_html_af1ec80b657d4d5d4e60ab69d71808807"><div class="ttname"><a href="a04223.html#af1ec80b657d4d5d4e60ab69d71808807">simConfig_BOARD_BootClockVLPR</a></div><div class="ttdeci">const sim_clock_config_t simConfig_BOARD_BootClockVLPR</div><div class="ttdoc">SIM module set for BOARD_BootClockVLPR configuration. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00246">clock_config.c:246</a></div></div>
63<div class="ttc" id="a04280_html_a6ae55dea13be64e40de107ee288779f3"><div class="ttname"><a href="a04280.html#a6ae55dea13be64e40de107ee288779f3">BOARD_BOOTCLOCKRUN_CORE_CLOCK</a></div><div class="ttdeci">#define BOARD_BOOTCLOCKRUN_CORE_CLOCK</div><div class="ttdef"><b>Definition:</b> <a href="a04280_source.html#l00025">clock_config.h:25</a></div></div>
64<div class="ttc" id="a04289_html"><div class="ttname"><a href="a04289.html">clock_config.h</a></div></div>
65<div class="ttc" id="a04223_html_a5e69c4eff0fd5236bbb0ff4e1d5a7a7e"><div class="ttname"><a href="a04223.html#a5e69c4eff0fd5236bbb0ff4e1d5a7a7e">BOARD_BootClockRUN</a></div><div class="ttdeci">void BOARD_BootClockRUN(void)</div><div class="ttdoc">This function executes configuration of clocks. </div><div class="ttdef"><b>Definition:</b> <a href="a04223_source.html#l00168">clock_config.c:168</a></div></div>
66</div><!-- fragment --></div><!-- contents -->
67
68<hr class="footer"/><address class="footer"><small>
69&copy; Copyright 2016-2022 NXP. All Rights Reserved. SPDX-License-Identifier: BSD-3-Clause
70</small></address>
71</body>
72</html>
73