libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
hg/cmu.h
Go to the documentation of this file.
1/** @defgroup cmu_defines CMU Defines
2 *
3 * @brief <b>Defined Constants and Types for the EFM32HG Clock Management Unit</b>
4 *
5 * @ingroup EFM32HG_defines
6 *
7 * LGPL License Terms @ref lgpl_license
8 */
9/*
10 * This file is part of the libopencm3 project.
11 *
12 * Copyright (C) 2015 Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
13 * Copyright (C) 2018 Seb Holzapfel <schnommus@gmail.com>
14 *
15 * This library is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public License
26 * along with this library. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29/**@{*/
30
31#pragma once
32
35
36#define CMU_CTRL MMIO32(CMU_BASE + 0x000)
37#define CMU_HFCORECLKDIV MMIO32(CMU_BASE + 0x004)
38#define CMU_HFPERCLKDIV MMIO32(CMU_BASE + 0x008)
39#define CMU_HFRCOCTRL MMIO32(CMU_BASE + 0x00C)
40#define CMU_LFRCOCTRL MMIO32(CMU_BASE + 0x010)
41#define CMU_AUXHFRCOCTR MMIO32(CMU_BASE + 0x014)
42#define CMU_CALCTRL MMIO32(CMU_BASE + 0x018)
43#define CMU_CALCNT MMIO32(CMU_BASE + 0x01C)
44#define CMU_OSCENCMD MMIO32(CMU_BASE + 0x020)
45#define CMU_CMD MMIO32(CMU_BASE + 0x024)
46#define CMU_LFCLKSEL MMIO32(CMU_BASE + 0x028)
47#define CMU_STATUS MMIO32(CMU_BASE + 0x02C)
48#define CMU_IF MMIO32(CMU_BASE + 0x030)
49#define CMU_IFS MMIO32(CMU_BASE + 0x034)
50#define CMU_IFC MMIO32(CMU_BASE + 0x038)
51#define CMU_IEN MMIO32(CMU_BASE + 0x03C)
52#define CMU_HFCORECLKEN0 MMIO32(CMU_BASE + 0x040)
53#define CMU_HFPERCLKEN0 MMIO32(CMU_BASE + 0x044)
54#define CMU_SYNCBUSY MMIO32(CMU_BASE + 0x050)
55#define CMU_FREEZE MMIO32(CMU_BASE + 0x054)
56#define CMU_LFACLKEN0 MMIO32(CMU_BASE + 0x058)
57#define CMU_LFBCLKEN0 MMIO32(CMU_BASE + 0x060)
58#define CMU_LFCCLKEN0 MMIO32(CMU_BASE + 0x064)
59#define CMU_LFAPRESC0 MMIO32(CMU_BASE + 0x068)
60#define CMU_LFBPRESC0 MMIO32(CMU_BASE + 0x070)
61#define CMU_PCNTCTRL MMIO32(CMU_BASE + 0x078)
62#define CMU_ROUTE MMIO32(CMU_BASE + 0x080)
63#define CMU_LOCK MMIO32(CMU_BASE + 0x084)
64#define CMU_USBCRCTRL MMIO32(CMU_BASE + 0x0D0)
65#define CMU_USHFRCOCTRL MMIO32(CMU_BASE + 0x0D4)
66#define CMU_USHFRCOTUNE MMIO32(CMU_BASE + 0x0D8)
67#define CMU_USHFRCOCONF MMIO32(CMU_BASE + 0x0DC)
68
69/* CMU_CTRL */
70#define CMU_CTRL_CLKOUTSEL1_SHIFT (23)
71#define CMU_CTRL_CLKOUTSEL1_MASK (0x7 << CMU_CTRL_CLKOUTSEL1_SHIFT)
72#define CMU_CTRL_CLKOUTSEL1(v) \
73 (((v) << CMU_CTRL_CLKOUTSEL1_SHIFT) & CMU_CTRL_CLKOUTSEL1_MASK)
74#define CMU_CTRL_CLKOUTSEL1_LFRCO CMU_CTRL_CLKOUTSEL1(0)
75#define CMU_CTRL_CLKOUTSEL1_LFXO CMU_CTRL_CLKOUTSEL1(1)
76#define CMU_CTRL_CLKOUTSEL1_HFCLK CMU_CTRL_CLKOUTSEL1(2)
77#define CMU_CTRL_CLKOUTSEL1_LFXOQ CMU_CTRL_CLKOUTSEL1(3)
78#define CMU_CTRL_CLKOUTSEL1_HFXOQ CMU_CTRL_CLKOUTSEL1(4)
79#define CMU_CTRL_CLKOUTSEL1_LFRCOQ CMU_CTRL_CLKOUTSEL1(5)
80#define CMU_CTRL_CLKOUTSEL1_HFRCOQ CMU_CTRL_CLKOUTSEL1(6)
81#define CMU_CTRL_CLKOUTSEL1_AUXHFRCOQ CMU_CTRL_CLKOUTSEL1(7)
82#define CMU_CTRL_CLKOUTSEL1_USHFRCO CMU_CTRL_CLKOUTSEL1(8)
83
84#define CMU_CTRL_CLKOUTSEL0_SHIFT (20)
85#define CMU_CTRL_CLKOUTSEL0_MASK (0x7 << CMU_CTRL_CLKOUTSEL0_SHIFT)
86#define CMU_CTRL_CLKOUTSEL0(v) \
87 (((v) << CMU_CTRL_CLKOUTSEL0_SHIFT) & CMU_CTRL_CLKOUTSEL0_MASK)
88#define CMU_CTRL_CLKOUTSEL0_HFRCO CMU_CTRL_CLKOUTSEL0(0)
89#define CMU_CTRL_CLKOUTSEL0_HFXO CMU_CTRL_CLKOUTSEL0(1)
90#define CMU_CTRL_CLKOUTSEL0_HFCLK2 CMU_CTRL_CLKOUTSEL0(2)
91#define CMU_CTRL_CLKOUTSEL0_HFCLK4 CMU_CTRL_CLKOUTSEL0(3)
92#define CMU_CTRL_CLKOUTSEL0_HFCLK8 CMU_CTRL_CLKOUTSEL0(4)
93#define CMU_CTRL_CLKOUTSEL0_HFCLK16 CMU_CTRL_CLKOUTSEL0(5)
94#define CMU_CTRL_CLKOUTSEL0_ULFRCO CMU_CTRL_CLKOUTSEL0(6)
95#define CMU_CTRL_CLKOUTSEL0_AUXHFRCO CMU_CTRL_CLKOUTSEL0(7)
96
97#define CMU_CTRL_LFXOTIMEOUT_SHIFT (18)
98#define CMU_CTRL_LFXOTIMEOUT_MASK (0x3 << CMU_CTRL_LFXOTIMEOUT_SHIFT)
99#define CMU_CTRL_LFXOTIMEOUT(v) \
100 (((v) << CMU_CTRL_LFXOTIMEOUT_SHIFT) & CMU_CTRL_LFXOTIMEOUT_MASK)
101#define CMU_CTRL_LFXOTIMEOUT_8CYCLES CMU_CTRL_LFXOTIMEOUT(0)
102#define CMU_CTRL_LFXOTIMEOUT_1KCYCLES CMU_CTRL_LFXOTIMEOUT(1)
103#define CMU_CTRL_LFXOTIMEOUT_16KCYCLES CMU_CTRL_LFXOTIMEOUT(2)
104#define CMU_CTRL_LFXOTIMEOUT_32KCYCLES CMU_CTRL_LFXOTIMEOUT(3)
105
106#define CMU_CTRL_LFXOBUFCUR (1 << 17)
107
108#define CMU_CTRL_HFCLKDIV_SHIFT (14)
109#define CMU_CTRL_HFCLKDIV_MASK (0x7 << CMU_CTRL_HFCLKDIV_SHIFT)
110#define CMU_CTRL_HFCLKDIV(v) \
111 (((v) << CMU_CTRL_HFCLKDIV_SHIFT) & CMU_CTRL_HFCLKDIV_MASK)
112#define CMU_CTRL_HFCLKDIV_NODIV CMU_CTRL_HFCLKDIV(0)
113#define CMU_CTRL_HFCLKDIV_DIV2 CMU_CTRL_HFCLKDIV(1)
114#define CMU_CTRL_HFCLKDIV_DIV3 CMU_CTRL_HFCLKDIV(2)
115#define CMU_CTRL_HFCLKDIV_DIV4 CMU_CTRL_HFCLKDIV(3)
116#define CMU_CTRL_HFCLKDIV_DIV5 CMU_CTRL_HFCLKDIV(4)
117#define CMU_CTRL_HFCLKDIV_DIV6 CMU_CTRL_HFCLKDIV(5)
118#define CMU_CTRL_HFCLKDIV_DIV7 CMU_CTRL_HFCLKDIV(6)
119#define CMU_CTRL_HFCLKDIV_DIV8 CMU_CTRL_HFCLKDIV(7)
120
121#define CMU_CTRL_LFXOBOOST (1 << 13)
122
123#define CMU_CTRL_LFXOMODE_SHIFT (11)
124#define CMU_CTRL_LFXOMODE_MASK (0x3 << CMU_CTRL_LFXOMODE_SHIFT)
125#define CMU_CTRL_LFXOMODE(v) \
126 (((v) << CMU_CTRL_LFXOMODE_SHIFT) & CMU_CTRL_LFXOMODE_MASK)
127#define CMU_CTRL_LFXOMODE_XTAL CMU_CTRL_LFXOMODE(0)
128#define CMU_CTRL_LFXOMODE_BUFEXTCLK CMU_CTRL_LFXOMODE(1)
129#define CMU_CTRL_LFXOMODE_DIGEXTCLK CMU_CTRL_LFXOMODE(2)
130
131#define CMU_CTRL_HFXOTIMEOUT_SHIFT (9)
132#define CMU_CTRL_HFXOTIMEOUT_MASK (0x3 << CMU_CTRL_HFXOTIMEOUT_SHIFT)
133#define CMU_CTRL_HFXOTIMEOUT(v) \
134 (((v) << CMU_CTRL_HFXOTIMEOUT_SHIFT) & CMU_CTRL_HFXOTIMEOUT_MASK)
135#define CMU_CTRL_HFXOTIMEOUT_8CYCLES CMU_CTRL_HFXOTIMEOUT(0)
136#define CMU_CTRL_HFXOTIMEOUT_256CYCLES CMU_CTRL_HFXOTIMEOUT(1)
137#define CMU_CTRL_HFXOTIMEOUT_1KCYCLES CMU_CTRL_HFXOTIMEOUT(2)
138#define CMU_CTRL_HFXOTIMEOUT_16KCYCLES CMU_CTRL_HFXOTIMEOUT(3)
139
140#define CMU_CTRL_HFXOGLITCHDETEN (1 << 7)
141#define CMU_CTRL_HFXOBUFCUR_MASK (0x3 << 5)
142
143#define CMU_CTRL_HFXOBOOST_SHIFT (2)
144#define CMU_CTRL_HFXOBOOST_MASK (0x3 << CMU_CTRL_HFXOBOOST_SHIFT)
145#define CMU_CTRL_HFXOBOOST(v) \
146 (((v) << CMU_CTRL_HFXOBOOST_SHIFT) & CMU_CTRL_HFXOBOOST_MASK)
147#define CMU_CTRL_HFXOBOOST_50PCENT CMU_CTRL_HFXOBOOST(0)
148#define CMU_CTRL_HFXOBOOST_70PCENT CMU_CTRL_HFXOBOOST(1)
149#define CMU_CTRL_HFXOBOOST_80PCENT CMU_CTRL_HFXOBOOST(2)
150#define CMU_CTRL_HFXOBOOST_100PCENT CMU_CTRL_HFXOBOOST(3)
151
152#define CMU_CTRL_HFXOMODE_SHIFT (0)
153#define CMU_CTRL_HFXOMODE_MASK (0x3 << CMU_CTRL_HFXOMODE_SHIFT)
154#define CMU_CTRL_HFXOMODE(v) \
155 (((v) << CMU_CTRL_HFXOMODE_SHIFT) & CMU_CTRL_HFXOMODE_MASK)
156#define CMU_CTRL_HFXOMODE_XTAL CMU_CTRL_HFXOMODE(0)
157#define CMU_CTRL_HFXOMODE_BUFEXTCLK CMU_CTRL_HFXOMODE(1)
158#define CMU_CTRL_HFXOMODE_DIGEXTCLK CMU_CTRL_HFXOMODE(2)
159
160/* CMU_HFCORECLKDIV */
161#define CMU_HFCORECLKDIV_HFCORECLKLEDIV (1 << 8)
162
163#define CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT (0)
164#define CMU_HFCORECLKDIV_HFCORECLKDIV_MASK \
165 (0xF << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT)
166#define CMU_HFCORECLKDIV_HFCORECLKDIV(v) \
167 (((v) << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT) & \
168 CMU_HFCORECLKDIV_HFCORECLKDIV_MASK)
169#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK \
170 CMU_HFCORECLKDIV_HFCORECLKDIV(0)
171#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2 \
172 CMU_HFCORECLKDIV_HFCORECLKDIV(1)
173#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4 \
174 CMU_HFCORECLKDIV_HFCORECLKDIV(2)
175#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8 \
176 CMU_HFCORECLKDIV_HFCORECLKDIV(3)
177#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16 \
178 CMU_HFCORECLKDIV_HFCORECLKDIV(4)
179#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32 \
180 CMU_HFCORECLKDIV_HFCORECLKDIV(5)
181#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64 \
182 CMU_HFCORECLKDIV_HFCORECLKDIV(6)
183#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128 \
184 CMU_HFCORECLKDIV_HFCORECLKDIV(7)
185#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256 \
186 CMU_HFCORECLKDIV_HFCORECLKDIV(8)
187#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512 \
188 CMU_HFCORECLKDIV_HFCORECLKDIV(9)
189
190#define CMU_HFCORECLKDIV_HFCORECLKDIV_NODIV \
191 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK
192#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV2 \
193 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2
194#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV4 \
195 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4
196#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV8 \
197 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8
198#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV16 \
199 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16
200#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV32 \
201 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32
202#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV64 \
203 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64
204#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV128 \
205 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128
206#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV256 \
207 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256
208#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV512 \
209 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512
210
211/* CMU_HFPERCLKDIV */
212#define CMU_HFPERCLKDIV_HFPERCLKEN (1 << 8)
213
214#define CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT (0)
215#define CMU_HFPERCLKDIV_HFPERCLKDIV_MASK \
216 (0xF << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT)
217#define CMU_HFPERCLKDIV_HFPERCLKDIV(v) \
218 (((v) << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT) & \
219 CMU_HFPERCLKDIV_HFPERCLKDIV_MASK)
220#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK CMU_HFPERCLKDIV_HFPERCLKDIV(0)
221#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK2 CMU_HFPERCLKDIV_HFPERCLKDIV(1)
222#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK4 CMU_HFPERCLKDIV_HFPERCLKDIV(2)
223#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK8 CMU_HFPERCLKDIV_HFPERCLKDIV(3)
224#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK16 CMU_HFPERCLKDIV_HFPERCLKDIV(4)
225#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK32 CMU_HFPERCLKDIV_HFPERCLKDIV(5)
226#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK64 CMU_HFPERCLKDIV_HFPERCLKDIV(6)
227#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK128 CMU_HFPERCLKDIV_HFPERCLKDIV(7)
228#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK256 CMU_HFPERCLKDIV_HFPERCLKDIV(8)
229#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK512 CMU_HFPERCLKDIV_HFPERCLKDIV(9)
230
231/* CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK* to CMU_HFPERCLKDIV_HFPERCLKHFCLK_DIV* */
232#define CMU_HFPERCLKDIV_HFPERCLKDIV_NODIV \
233 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK
234#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV2 \
235 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK2
236#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV4 \
237 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK4
238#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV8 \
239 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK8
240#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV16 \
241 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK16
242#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV32 \
243 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK32
244#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV64 \
245 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK64
246#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV128 \
247 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK128
248#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV256 \
249 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK256
250#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV512 \
251 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK512
252
253/* CMU_HFRCOCTRL */
254#define CMU_HFRCOCTRL_SUDELAY_SHIFT (12)
255#define CMU_HFRCOCTRL_SUDELAY_MASK (0x1F << CMU_HFRCOCTRL_SUDELAY_SHIFT)
256#define CMU_HFRCOCTRL_SUDELAY(v) \
257 ((((v) << CMU_HFRCOCTRL_SUDELAY_SHIFT) & CMU_HFRCOCTRL_SUDELAY_MASK))
258
259#define CMU_HFRCOCTRL_BAND_SHIFT (8)
260#define CMU_HFRCOCTRL_BAND_MASK (0x7 << CMU_HFRCOCTRL_BAND_SHIFT)
261#define CMU_HFRCOCTRL_BAND(v) \
262 (((v) << CMU_HFRCOCTRL_BAND_SHIFT) & CMU_HFRCOCTRL_BAND_MASK)
263#define CMU_HFRCOCTRL_BAND_1MHZ CMU_HFRCOCTRL_BAND(0)
264#define CMU_HFRCOCTRL_BAND_7MHZ CMU_HFRCOCTRL_BAND(1)
265#define CMU_HFRCOCTRL_BAND_11MHZ CMU_HFRCOCTRL_BAND(2)
266#define CMU_HFRCOCTRL_BAND_14MHZ CMU_HFRCOCTRL_BAND(3)
267#define CMU_HFRCOCTRL_BAND_21MHZ CMU_HFRCOCTRL_BAND(4)
268
269#define CMU_HFRCOCTRL_TUNING_SHIFT (0)
270#define CMU_HFRCOCTRL_TUNING_MASK (0xFF << CMU_HFRCOCTRL_TUNING_SHIFT)
271#define CMU_HFRCOCTRL_TUNING(v) \
272 (((v) << CMU_HFRCOCTRL_TUNING_SHIFT) & CMU_HFRCOCTRL_TUNING_MASK)
273
274/* CMU_LFRCOCTRL */
275#define CMU_LFRCOCTRL_TUNING_SHIFT (0)
276#define CMU_LFRCOCTRL_TUNING_MASK (0xFF << CMU_LFRCOCTRL_TUNING_SHIFT)
277#define CMU_LFRCOCTRL_TUNING(v) \
278 (((v) << CMU_LFRCOCTRL_TUNING_SHIFT) & CMU_LFRCOCTRL_TUNING_MASK)
279
280/* CMU_AUXHFRCOCTRL */
281#define CMU_AUXHFRCOCTRL_BAND_SHIFT (8)
282#define CMU_AUXHFRCOCTRL_BAND_MASK (0x7 << CMU_AUXHFRCOCTRL_BAND_SHIFT)
283#define CMU_AUXHFRCOCTRL_BAND(v) \
284 (((v) << CMU_AUXHFRCOCTRL_BAND_SHIFT) & CMU_AUXHFRCOCTRL_BAND_MASK)
285#define CMU_AUXHFRCOCTRL_BAND_14MHZ CMU_AUXHFRCOCTRL_BAND(0)
286#define CMU_AUXHFRCOCTRL_BAND_11MHZ CMU_AUXHFRCOCTRL_BAND(1)
287#define CMU_AUXHFRCOCTRL_BAND_7MHZ CMU_AUXHFRCOCTRL_BAND(2)
288#define CMU_AUXHFRCOCTRL_BAND_1MHZ CMU_AUXHFRCOCTRL_BAND(3)
289#define CMU_AUXHFRCOCTRL_BAND_28MHZ CMU_AUXHFRCOCTRL_BAND(6)
290#define CMU_AUXHFRCOCTRL_BAND_21MHZ CMU_AUXHFRCOCTRL_BAND(7)
291
292#define CMU_AUXHFRCOCTRL_TUNING_SHIFT (0)
293#define CMU_AUXHFRCOCTRL_TUNING_MASK (0xFF << CMU_AUXHFRCOCTRL_TUNING_SHIFT)
294#define CMU_AUXHFRCOCTRL_TUNING(v) \
295 (((v) << CMU_AUXHFRCOCTRL_TUNING_SHIFT) & CMU_AUXHFRCOCTRL_TUNING_MASK)
296
297/* CMU_CALCTRL */
298#define CMU_CALCTRL_CONT (1 << 6)
299
300#define CMU_CALCTRL_DOWNSEL_SHIFT (3)
301#define CMU_CALCTRL_DOWNSEL_MASK (0x7 << CMU_CALCTRL_DOWNSEL_SHIFT)
302#define CMU_CALCTRL_DOWNSEL(v) \
303 (((v) << CMU_CALCTRL_DOWNSEL_SHIFT) & CMU_CALCTRL_DOWNSEL_MASK)
304#define CMU_CALCTRL_DOWNSEL_HFCLK CMU_CALCTRL_DOWNSEL(0)
305#define CMU_CALCTRL_DOWNSEL_HFXO CMU_CALCTRL_DOWNSEL(1)
306#define CMU_CALCTRL_DOWNSEL_LFXO CMU_CALCTRL_DOWNSEL(2)
307#define CMU_CALCTRL_DOWNSEL_HFRCO CMU_CALCTRL_DOWNSEL(3)
308#define CMU_CALCTRL_DOWNSEL_LFRCO CMU_CALCTRL_DOWNSEL(4)
309#define CMU_CALCTRL_DOWNSEL_AUXHFRCO CMU_CALCTRL_DOWNSEL(5)
310#define CMU_CALCTRL_DOWNSEL_USHFRCO CMU_CALCTRL_DOWNSEL(6)
311
312#define CMU_CALCTRL_UPSEL_SHIFT (3)
313#define CMU_CALCTRL_UPSEL_MASK (0x7 << CMU_CALCTRL_UPSEL_SHIFT)
314#define CMU_CALCTRL_UPSEL(v) \
315 (((v) << CMU_CALCTRL_UPSEL_SHIFT) & CMU_CALCTRL_UPSEL_MASK)
316#define CMU_CALCTRL_UPSEL_HFXO CMU_CALCTRL_UPSEL(0)
317#define CMU_CALCTRL_UPSEL_LFXO CMU_CALCTRL_UPSEL(1)
318#define CMU_CALCTRL_UPSEL_HFRCO CMU_CALCTRL_UPSEL(2)
319#define CMU_CALCTRL_UPSEL_LFRCO CMU_CALCTRL_UPSEL(3)
320#define CMU_CALCTRL_UPSEL_AUXHFRCO CMU_CALCTRL_UPSEL(4)
321#define CMU_CALCTRL_UPSEL_USHFRCO CMU_CALCTRL_UPSEL(5)
322
323/* CMU_CALCNT */
324#define CMU_CALCNT_CALCNT_SHIFT (0)
325#define CMU_CALCNT_CALCNT_MASK (0xFFFFF << CMU_CALCNT_CALCNT_SHIFT)
326#define CMU_CALCNT_CALCNT(v) \
327 (((v) << CMU_CALCNT_CALCNT_SHIFT) & CMU_CALCNT_CALCNT_MASK)
328
329/* CMU_OSCENCMD */
330/* Bits 31:12 - Reserved */
331#define CMU_OSCENCMD_USHFRCODIS (1 << 11)
332#define CMU_OSCENCMD_USHFRCOEN (1 << 10)
333#define CMU_OSCENCMD_LFXODIS (1 << 9)
334#define CMU_OSCENCMD_LFXOEN (1 << 8)
335#define CMU_OSCENCMD_LFRCODIS (1 << 7)
336#define CMU_OSCENCMD_LFRCOEN (1 << 6)
337#define CMU_OSCENCMD_AUXHFRCODIS (1 << 5)
338#define CMU_OSCENCMD_AUXHFRCOEN (1 << 4)
339#define CMU_OSCENCMD_HFXODIS (1 << 3)
340#define CMU_OSCENCMD_HFXOEN (1 << 2)
341#define CMU_OSCENCMD_HFRCODIS (1 << 1)
342#define CMU_OSCENCMD_HFRCOEN (1 << 0)
343
344/* CMU_CMD */
345#define CMU_CMD_USBCCLKSEL_SHIFT (5)
346#define CMU_CMD_USBCCLKSEL_MASK (0x5 << CMU_CMD_USBCCLKSEL_SHIFT)
347#define CMU_CMD_USBCCLKSEL(v) \
348 (((v) << CMU_CMD_USBCCLKSEL_SHIFT) & CMU_CMD_USBCCLKSEL_MASK)
349#define CMU_CMD_USBCCLKSEL_LFXO CMU_CMD_USBCCLKSEL(2)
350#define CMU_CMD_USBCCLKSEL_LFRCO CMU_CMD_USBCCLKSEL(3)
351#define CMU_CMD_USBCCLKSEL_USHFRCO CMU_CMD_USBCCLKSEL(4)
352
353#define CMU_CMD_CALSTOP (1 << 4)
354#define CMU_CMD_CALSTART (1 << 3)
355
356#define CMU_CMD_HFCLKSEL_SHIFT (0)
357#define CMU_CMD_HFCLKSEL_MASK (0x7 << CMU_CMD_HFCLKSEL_SHIFT)
358#define CMU_CMD_HFCLKSEL(v) \
359 (((v) << CMU_CMD_HFCLKSEL_SHIFT) & CMU_CMD_HFCLKSEL_MASK)
360#define CMU_CMD_HFCLKSEL_HFRCO CMU_CMD_HFCLKSEL(1)
361#define CMU_CMD_HFCLKSEL_HFXO CMU_CMD_HFCLKSEL(2)
362#define CMU_CMD_HFCLKSEL_LFRCO CMU_CMD_HFCLKSEL(3)
363#define CMU_CMD_HFCLKSEL_LFXO CMU_CMD_HFCLKSEL(4)
364#define CMU_CMD_HFCLKSEL_USHFRCODIV2 CMU_CMD_HFCLKSEL(5)
365
366/* CMU_LFCLKSEL */
367/* Bits 31:21 - Reserved */
368#define CMU_LFCLKSEL_LFBE (1 << 20)
369/* Bits 19:17 - Reserved */
370#define CMU_LFCLKSEL_LFAE (1 << 16)
371/* Bits 15:6 - Reserved */
372
373#define CMU_LFCLKSEL_LFC_SHIFT (4)
374#define CMU_LFCLKSEL_LFC_MASK (0x3 << CMU_LFCLKSEL_LFC_SHIFT)
375#define CMU_LFCLKSEL_LFC(v) \
376 (((v) << CMU_LFCLKSEL_LFC_SHIFT) & CMU_LFCLKSEL_LFC_MASK)
377#define CMU_LFCLKSEL_LFC_DISABLED CMU_LFCLKSEL_LFC(0)
378#define CMU_LFCLKSEL_LFC_LFRCO CMU_LFCLKSEL_LFC(1)
379#define CMU_LFCLKSEL_LFC_LFXO CMU_LFCLKSEL_LFC(2)
380
381#define CMU_LFCLKSEL_LFB_SHIFT (2)
382#define CMU_LFCLKSEL_LFB_MASK (0x3 << CMU_LFCLKSEL_LFB_SHIFT)
383#define CMU_LFCLKSEL_LFB(v) \
384 (((v) << CMU_LFCLKSEL_LFB_SHIFT) & CMU_LFCLKSEL_LFB_MASK)
385
386#define CMU_LFCLKSEL_LFA_SHIFT (0)
387#define CMU_LFCLKSEL_LFA_MASK (0x3 << CMU_LFCLKSEL_LFA_SHIFT)
388#define CMU_LFCLKSEL_LFA(v) \
389 (((v) << CMU_LFCLKSEL_LFA_SHIFT) & CMU_LFCLKSEL_LFA_MASK)
390
391/* CMU_STATUS */
392/* Bits 31:27 - Reserved */
393#define CMU_STATUS_USHFRCODIV2SEL (1 << 26)
394/* Bits 25:24 - Reserved */
395#define CMU_STATUS_USHFRCOSUSPEND (1 << 23)
396#define CMU_STATUS_USHFRCORDY (1 << 22)
397#define CMU_STATUS_USHFRCOENS (1 << 21)
398#define CMU_STATUS_USBCHFCLKSYNC (1 << 20)
399/* Bit 19 - Reserved */
400#define CMU_STATUS_USBCUSHFRCOSEL (1 << 18)
401#define CMU_STATUS_USBCLFRCOSEL (1 << 17)
402#define CMU_STATUS_USBCLFXOSEL (1 << 16)
403/* Bit 15 - Reserved */
404#define CMU_STATUS_CALBSY (1 << 14)
405#define CMU_STATUS_LFXOSEL (1 << 13)
406#define CMU_STATUS_LFRCOSEL (1 << 12)
407#define CMU_STATUS_HFXOSEL (1 << 11)
408#define CMU_STATUS_HFRCOSEL (1 << 10)
409#define CMU_STATUS_LFXORDY (1 << 9)
410#define CMU_STATUS_LFXOENS (1 << 8)
411#define CMU_STATUS_LFRCORDY (1 << 7)
412#define CMU_STATUS_LFRCOENS (1 << 6)
413#define CMU_STATUS_AUXHFRCORDY (1 << 5)
414#define CMU_STATUS_AUXHFRCOENS (1 << 4)
415#define CMU_STATUS_HFXORDY (1 << 3)
416#define CMU_STATUS_HFXOENS (1 << 2)
417#define CMU_STATUS_HFRCORDY (1 << 1)
418#define CMU_STATUS_HFRCOENS (1 << 0)
419
420/* CMU_IF */
421/* Bits 31:10 - Reserved */
422#define CMU_IF_USBCHFOSCSEL (1 << 9)
423#define CMU_IF_USHFRCORDY (1 << 8)
424/* Bit 7 - Reserved */
425#define CMU_IF_CALOF (1 << 6)
426#define CMU_IF_CALRDY (1 << 5)
427#define CMU_IF_AUXHFRCORDY (1 << 4)
428#define CMU_IF_LFXORDY (1 << 3)
429#define CMU_IF_LFRCORDY (1 << 2)
430#define CMU_IF_HFXORDY (1 << 1)
431#define CMU_IF_HFRCORDY (1 << 0)
432
433/* CMU_IFS */
434/* Bits 31:10 - Reserved */
435#define CMU_IFS_USBCHFOSCSEL (1 << 9)
436#define CMU_IFS_USHFRCORDY (1 << 8)
437/* Bit 7 - Reserved */
438#define CMU_IFS_CALOF (1 << 6)
439#define CMU_IFS_CALRDY (1 << 5)
440#define CMU_IFS_AUXHFRCORDY (1 << 4)
441#define CMU_IFS_LFXORDY (1 << 3)
442#define CMU_IFS_LFRCORDY (1 << 2)
443#define CMU_IFS_HFXORDY (1 << 1)
444#define CMU_IFS_HFRCORDY (1 << 0)
445
446/* CMU_IFC */
447/* Bits 31:10 - Reserved */
448#define CMU_IFC_USBCHFOSCSEL (1 << 9)
449#define CMU_IFC_USHFRCORDY (1 << 8)
450/* Bit 7 - Reserved */
451#define CMU_IFC_CALOF (1 << 6)
452#define CMU_IFC_CALRDY (1 << 5)
453#define CMU_IFC_AUXHFRCORDY (1 << 4)
454#define CMU_IFC_LFXORDY (1 << 3)
455#define CMU_IFC_LFRCORDY (1 << 2)
456#define CMU_IFC_HFXORDY (1 << 1)
457#define CMU_IFC_HFRCORDY (1 << 0)
458
459/* CMU_IEN */
460/* Bits 31:10 - Reserved */
461#define CMU_IEN_USBCHFOSCSEL (1 << 9)
462#define CMU_IEN_USHFRCORDY (1 << 8)
463/* Bit 7 - Reserved */
464#define CMU_IEN_CALOF (1 << 6)
465#define CMU_IEN_CALRDY (1 << 5)
466#define CMU_IEN_AUXHFRCORDY (1 << 4)
467#define CMU_IEN_LFXORDY (1 << 3)
468#define CMU_IEN_LFRCORDY (1 << 2)
469#define CMU_IEN_HFXORDY (1 << 1)
470#define CMU_IEN_HFRCORDY (1 << 0)
471
472/* CMU_HFCORECLKEN0 */
473/* Bits 31:5 - Reserved */
474#define CMU_HFCORECLKEN0_USB (1 << 4)
475#define CMU_HFCORECLKEN0_USBC (1 << 3)
476#define CMU_HFCORECLKEN0_LE (1 << 2)
477#define CMU_HFCORECLKEN0_DMA (1 << 1)
478#define CMU_HFCORECLKEN0_AES (1 << 0)
479
480/* CMU_HFPERCLKEN0 */
481/* Bits 31:12 - Reserved */
482#define CMU_HFPERCLKEN0_I2C0 (1 << 11)
483#define CMU_HFPERCLKEN0_ADC0 (1 << 10)
484#define CMU_HFPERCLKEN0_VCMP (1 << 9)
485#define CMU_HFPERCLKEN0_GPIO (1 << 8)
486#define CMU_HFPERCLKEN0_IDAC0 (1 << 7)
487#define CMU_HFPERCLKEN0_PRS (1 << 6)
488#define CMU_HFPERCLKEN0_ACMP0 (1 << 5)
489#define CMU_HFPERCLKEN0_USART1 (1 << 4)
490#define CMU_HFPERCLKEN0_USART0 (1 << 3)
491#define CMU_HFPERCLKEN0_TIMER2 (1 << 2)
492#define CMU_HFPERCLKEN0_TIMER1 (1 << 1)
493#define CMU_HFPERCLKEN0_TIMER0 (1 << 0)
494
495/* CMU_SYNCBUSY */
496/* Bits 31:9 - Reserved */
497#define CMU_SYNCBUSY_LFCCLKEN0 (1 << 8)
498/* Bit 7 - Reserved */
499#define CMU_SYNCBUSY_LFBPRESC0 (1 << 6)
500/* Bit 5 - Reserved */
501#define CMU_SYNCBUSY_LFBCLKEN0 (1 << 4)
502/* Bit 3 - Reserved */
503#define CMU_SYNCBUSY_LFAPRESC0 (1 << 2)
504/* Bit 1 - Reserved */
505#define CMU_SYNCBUSY_LFACLKEN0 (1 << 0)
506
507/* CMU_FREEZE */
508#define CMU_FREEZE_REGFREEZE (1 << 0)
509
510/* CMU_LFACLKEN0 */
511#define CMU_LFACLKEN0_RTC (1 << 0)
512
513/* CMU_LFBCLKEN0 */
514#define CMU_LFBCLKEN0_LEUART0 (1 << 0)
515
516/* CMU_LFCCLKEN0 */
517#define CMU_LFCCLKEN0_USBLE (1 << 0)
518
519/* CMU_LFAPRESC0 */
520#define CMU_LFAPRESC0_RTC_SHIFT (0)
521#define CMU_LFAPRESC0_RTC_MASK (0xF << CMU_LFAPRESC0_RTC_SHIFT)
522#define CMU_LFAPRESC0_RTC(v) \
523 (((v) << CMU_LFAPRESC0_RTC_SHIFT) & CMU_LFAPRESC0_RTC_MASK)
524#define CMU_LFAPRESC0_RTC_DIV1 CMU_LFAPRESC0_RTC(0)
525#define CMU_LFAPRESC0_RTC_DIV2 CMU_LFAPRESC0_RTC(1)
526#define CMU_LFAPRESC0_RTC_DIV4 CMU_LFAPRESC0_RTC(2)
527#define CMU_LFAPRESC0_RTC_DIV8 CMU_LFAPRESC0_RTC(3)
528#define CMU_LFAPRESC0_RTC_DIV16 CMU_LFAPRESC0_RTC(4)
529#define CMU_LFAPRESC0_RTC_DIV32 CMU_LFAPRESC0_RTC(5)
530#define CMU_LFAPRESC0_RTC_DIV64 CMU_LFAPRESC0_RTC(6)
531#define CMU_LFAPRESC0_RTC_DIV128 CMU_LFAPRESC0_RTC(7)
532#define CMU_LFAPRESC0_RTC_DIV256 CMU_LFAPRESC0_RTC(8)
533#define CMU_LFAPRESC0_RTC_DIV512 CMU_LFAPRESC0_RTC(9)
534#define CMU_LFAPRESC0_RTC_DIV1024 CMU_LFAPRESC0_RTC(10)
535#define CMU_LFAPRESC0_RTC_DIV2048 CMU_LFAPRESC0_RTC(11)
536#define CMU_LFAPRESC0_RTC_DIV4096 CMU_LFAPRESC0_RTC(12)
537#define CMU_LFAPRESC0_RTC_DIV8192 CMU_LFAPRESC0_RTC(13)
538#define CMU_LFAPRESC0_RTC_DIV16384 CMU_LFAPRESC0_RTC(14)
539#define CMU_LFAPRESC0_RTC_DIV32768 CMU_LFAPRESC0_RTC(15)
540#define CMU_LFAPRESC0_RTC_NODIV CMU_LFAPRESC0_RTC_DIV1
541
542/* CMU_LFBPRESC0 */
543#define CMU_LFBPRESC0_LEUART0_SHIFT (0)
544#define CMU_LFBPRESC0_LEUART0_MASK (0x3 << CMU_LFBPRESC0_LEUART0_SHIFT)
545#define CMU_LFBPRESC0_LEUART0(v) \
546 (((v) << CMU_LFBPRESC0_LEUART0_SHIFT) & CMU_LFBPRESC0_LEUART0_MASK)
547#define CMU_LFBPRESC0_LEUART0_DIV1 CMU_LFBPRESC0_LEUART0(0)
548#define CMU_LFBPRESC0_LEUART0_DIV2 CMU_LFBPRESC0_LEUART0(1)
549#define CMU_LFBPRESC0_LEUART0_DIV4 CMU_LFBPRESC0_LEUART0(2)
550#define CMU_LFBPRESC0_LEUART0_DIV8 CMU_LFBPRESC0_LEUART0(3)
551#define CMU_LFBPRESC0_LEUART0_NODIV CMU_LFBPRESC0_LEUART0_DIV1
552
553/* CMU_PCNTCTRL */
554#define CMU_PCNTCTRL_PCNT0CLKSEL (1 << 1)
555#define CMU_PCNTCTRL_PCNT0CLKEN (1 << 0)
556
557/* CMU_ROUTE */
558#define CMU_ROUTE_LOCATION_SHIFT (2)
559#define CMU_ROUTE_LOCATION_MASK (0x7 << CMU_ROUTE_LOCATION_SHIFT)
560#define CMU_ROUTE_LOCATION_LOCx(i) \
561 (((i) << CMU_ROUTE_LOCATION_SHIFT) & CMU_ROUTE_LOCATION_MASK)
562#define CMU_ROUTE_LOCATION_LOC0 CMU_ROUTE_LOCATION_LOCx(0)
563#define CMU_ROUTE_LOCATION_LOC1 CMU_ROUTE_LOCATION_LOCx(1)
564#define CMU_ROUTE_LOCATION_LOC2 CMU_ROUTE_LOCATION_LOCx(2)
565#define CMU_ROUTE_LOCATION_LOC3 CMU_ROUTE_LOCATION_LOCx(3)
566
567#define CMU_ROUTE_CLKOUT1PEN (1 << 1)
568#define CMU_ROUTE_CLKOUT0PEN (1 << 0)
569
570/* CMU_LOCK */
571#define CMU_LOCK_LOCKKEY_SHIFT (0)
572#define CMU_LOCK_LOCKKEY_MASK (0xFFFF << CMU_LOCK_LOCKKEY_SHIFT)
573#define CMU_LOCK_LOCKKEY_UNLOCKED (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
574#define CMU_LOCK_LOCKKEY_LOCKED (0x0001 << CMU_LOCK_LOCKKEY_SHIFT)
575#define CMU_LOCK_LOCKKEY_LOCK (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
576#define CMU_LOCK_LOCKKEY_UNLOCK (0x580E << CMU_LOCK_LOCKKEY_SHIFT)
577
578/* CMU_USBCRCTRL */
579#define CMU_USBCRCTRL_LSMODE (1 << 1)
580#define CMU_USBCRCTRL_EN (1 << 0)
581
582/* CMU_USHFRCOCTRL */
583/* Bits 31:20 - Reserved */
584#define CMU_USHFRCOCTRL_TIMEOUT_MASK (0xff << 12)
585/* Bits 11:10 - Reserved */
586#define CMU_USHFRCOCTRL_SUSPEND (1 << 9)
587#define CMU_USHFRCOCTRL_DITHEN (1 << 8)
588/* Bit 7 - Reserved */
589#define CMU_USHFRCOCTRL_TUNING_MASK (0x7f << 0)
590
591/* CMU_USHFRCOTUNE */
592/* Bits 31:6 - Reserved */
593#define CMU_USHFRCOTUNE_FINETUNING_MASK (0x3f << 0)
594
595/* CMU_USHFRCOCONF */
596/* Bits 31:5 - Reserved */
597#define CMU_USHFRCOTUNE_USHFRCODIV2DIS (1 << 4)
598/* Bit 3 - Reserved */
599#define CMU_USHFRCOCONF_BAND_MASK (0x7 << 0)
600#define CMU_USHFRCOCONF_BAND_48MHZ (0x1 << 0)
601#define CMU_USHFRCOCONF_BAND_24MHZ (0x3 << 0)
602
603#define _REG_BIT(base, bit) (((base) << 5) + (bit))
604
606 /* CMU_PCNTCTRL */
607 CMU_PCNT0 = _REG_BIT(0x078, 1),
608
609 /* CMU_LFCCLKEN0 */
610 CMU_USBLE = _REG_BIT(0x064, 0),
611
612 /* CMU_LFBCLKEN0 */
614
615 /* CMU_LFACLKEN0 */
616 CMU_RTC = _REG_BIT(0x058, 0),
617
618 /* CMU_HFPERCLKEN0 */
619 CMU_I2C0 = _REG_BIT(0x044, 11),
620 CMU_ADC0 = _REG_BIT(0x044, 10),
621 CMU_VCMP = _REG_BIT(0x044, 9),
622 CMU_GPIO = _REG_BIT(0x044, 8),
623 CMU_IDAC0 = _REG_BIT(0x044, 7),
624 CMU_PRS = _REG_BIT(0x044, 6),
625 CMU_ACMP0 = _REG_BIT(0x044, 5),
626 CMU_USART1 = _REG_BIT(0x044, 4),
627 CMU_USART0 = _REG_BIT(0x044, 3),
628 CMU_TIMER2 = _REG_BIT(0x044, 2),
629 CMU_TIMER1 = _REG_BIT(0x044, 1),
630 CMU_TIMER0 = _REG_BIT(0x044, 0),
631
632 /* CMU_HFCORECLKEN0 */
633 CMU_USB = _REG_BIT(0x040, 4),
634 CMU_USBC = _REG_BIT(0x040, 3),
635 CMU_LE = _REG_BIT(0x040, 2),
636 CMU_DMA = _REG_BIT(0x040, 1)
638
640 HFRCO, /**< Internal, 1 - 28Mhz */
641 LFRCO, /**< Internal, 32.768kHz */
642 HFXO, /**< External, 4-48Mhz */
643 LFXO, /**< External, 32.768kHz */
644 AUXHFRCO, /**< Internal, 1-28Mhz */
645 USHFRCO, /**< Internal, 48MHz */
646 USHFRCODIV2, /**< Internal, 24MHz */
647};
648
649/* --- Function prototypes ------------------------------------------------- */
650
652
653void cmu_enable_lock(void);
654void cmu_disable_lock(void);
655bool cmu_get_lock_flag(void);
656
659
660/* TODO: CMU_CTRL, CMU_HFCORECLKDIV, CMU_HFPERCLKDIV, CMU_HFRCOCTRL,
661 * CMU_LFRCOCTRL, CMU_AUXHFRCOCTRL, CMU_CALCTRL, CMU_CALCNT */
662
663void cmu_osc_on(enum cmu_osc osc);
664void cmu_osc_off(enum cmu_osc osc);
665
666/* TODO: CMU_CMD, CMU_LFCLKSEL */
667
668/* TODO: portions of CMU_STATUS */
669bool cmu_osc_ready_flag(enum cmu_osc osc);
670void cmu_wait_for_osc_ready(enum cmu_osc osc);
671void cmu_set_hfclk_source(enum cmu_osc osc);
673
674void cmu_set_usbclk_source(enum cmu_osc osc);
676
677/* TODO: CMU_IF, CMU_IFS, CMU_IFC, CMU_IEN */
678
679/* TODO: CMU_SYNCBUSY, CMU_FREEZE, CMU_LFACLKEN0 */
680
681/* TODO: CMU_LFAPRESC0, CMU_LFBPRESC0, CMU_PCNTCTRL, CMU_LCDCTRL, CMU_ROUTE */
682
684
685/**@}*/
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
Dispatcher for the base address definitions, depending on the particular Gecko family.
void cmu_wait_for_usbclk_selected(enum cmu_osc osc)
Wait while USBCLK is not selected.
Definition: cmu.c:296
cmu_periph_clken
Definition: hg/cmu.h:605
void cmu_osc_off(enum cmu_osc osc)
Turn off Oscillator.
Definition: cmu.c:123
enum cmu_osc cmu_get_hfclk_source(void)
Get HFCLK clock source.
Definition: cmu.c:251
void cmu_periph_clock_enable(enum cmu_periph_clken periph)
Enable Peripheral Clock in running mode.
Definition: cmu.c:68
void cmu_set_usbclk_source(enum cmu_osc osc)
Set USBCLK clock source.
Definition: cmu.c:274
bool cmu_get_lock_flag(void)
Get CMU register lock flag.
Definition: cmu.c:49
void cmu_periph_clock_disable(enum cmu_periph_clken periph)
Disable Peripheral Clock in running mode.
Definition: cmu.c:83
#define _REG_BIT(base, bit)
Definition: hg/cmu.h:603
bool cmu_osc_ready_flag(enum cmu_osc osc)
Get Oscillator read flag.
Definition: cmu.c:156
void cmu_enable_lock(void)
Enable CMU registers lock.
Definition: cmu.c:31
cmu_osc
Definition: hg/cmu.h:639
void cmu_disable_lock(void)
Disable CMU registers lock.
Definition: cmu.c:39
void cmu_osc_on(enum cmu_osc osc)
Turn on Oscillator.
Definition: cmu.c:92
void cmu_set_hfclk_source(enum cmu_osc osc)
Set HFCLK clock source.
Definition: cmu.c:223
void cmu_wait_for_osc_ready(enum cmu_osc osc)
Wait while oscillator is not ready.
Definition: cmu.c:189
@ CMU_TIMER1
Definition: hg/cmu.h:629
@ CMU_LEUART0
Definition: hg/cmu.h:613
@ CMU_LE
Definition: hg/cmu.h:635
@ CMU_I2C0
Definition: hg/cmu.h:619
@ CMU_TIMER0
Definition: hg/cmu.h:630
@ CMU_USBLE
Definition: hg/cmu.h:610
@ CMU_USBC
Definition: hg/cmu.h:634
@ CMU_ACMP0
Definition: hg/cmu.h:625
@ CMU_GPIO
Definition: hg/cmu.h:622
@ CMU_USART1
Definition: hg/cmu.h:626
@ CMU_USART0
Definition: hg/cmu.h:627
@ CMU_ADC0
Definition: hg/cmu.h:620
@ CMU_DMA
Definition: hg/cmu.h:636
@ CMU_USB
Definition: hg/cmu.h:633
@ CMU_TIMER2
Definition: hg/cmu.h:628
@ CMU_PRS
Definition: hg/cmu.h:624
@ CMU_RTC
Definition: hg/cmu.h:616
@ CMU_IDAC0
Definition: hg/cmu.h:623
@ CMU_VCMP
Definition: hg/cmu.h:621
@ CMU_PCNT0
Definition: hg/cmu.h:607
@ AUXHFRCO
Internal, 1-28Mhz.
Definition: hg/cmu.h:644
@ USHFRCO
Internal, 48MHz.
Definition: hg/cmu.h:645
@ HFRCO
Internal, 1 - 28Mhz.
Definition: hg/cmu.h:640
@ LFRCO
Internal, 32.768kHz.
Definition: hg/cmu.h:641
@ HFXO
External, 4-48Mhz.
Definition: hg/cmu.h:642
@ USHFRCODIV2
Internal, 24MHz.
Definition: hg/cmu.h:646
@ LFXO
External, 32.768kHz.
Definition: hg/cmu.h:643