aboutsummaryrefslogtreecommitdiff
path: root/include/libopencm3/efm32/tinygecko/cmu.h
blob: e690ebd9553795dcd6fbb665814632cbb5fde182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * This file is part of the libopencm3 project.
 *
 * Copyright (C) 2012 chrysn <chrysn@fsfe.org>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/** @file
 *
 * Definitions for the CMU (Clock Management Unit).
 *
 * This corresponds to the description in d0034_efm32tg_reference_manual.pdf
 * section 11.
 *
 * @see CMU_registers
 */
/* FIXME: i'd prefer not to @see CMU_registers but have some direct link placed
 * automatically from a file to its groups */

#ifndef LIBOPENCM3_EFM32_TINYGECKO_CMU_H
#define LIBOPENCM3_EFM32_TINYGECKO_CMU_H

#include <libopencm3/cm3/common.h>

#define CMU_BASE 0x400C8000 /**< Register base address for the CMU according to d0034_efm32tg_reference_manual.pdf figure 5.2. */

/** These definitions reflect d0034_efm32tg_reference_manual.pdf section 11.4.
 *
 * @defgroup CMU_registers CMU registers
 * @{ */

#define CMU_CTRL		MMIO32(CMU_BASE + 0x000)
#define CMU_HFCORECLKDIV	MMIO32(CMU_BASE + 0x004)
#define CMU_HFPERCLKDIV		MMIO32(CMU_BASE + 0x008)
#define CMU_HFRCOCTRL		MMIO32(CMU_BASE + 0x00C)
#define CMU_LFRCOCTRL		MMIO32(CMU_BASE + 0x010)
#define CMU_AUXHFRCOCTRL	MMIO32(CMU_BASE + 0x014)
#define CMU_CALCTRL		MMIO32(CMU_BASE + 0x018)
#define CMU_CALCNT		MMIO32(CMU_BASE + 0x01C)
#define CMU_OSCENCMD		MMIO32(CMU_BASE + 0x020)
#define CMU_CMD			MMIO32(CMU_BASE + 0x024)
#define CMU_LFCLKSEL		MMIO32(CMU_BASE + 0x028)
#define CMU_STATUS		MMIO32(CMU_BASE + 0x02C)
#define CMU_IF			MMIO32(CMU_BASE + 0x030)
#define CMU_IFS			MMIO32(CMU_BASE + 0x034)
#define CMU_IFC			MMIO32(CMU_BASE + 0x038)
#define CMU_IEN			MMIO32(CMU_BASE + 0x03C)
#define CMU_HFCORECLKEN0	MMIO32(CMU_BASE + 0x040)
#define CMU_HFPERCLKEN0		MMIO32(CMU_BASE + 0x044)
#define CMU_SYNCBUSY		MMIO32(CMU_BASE + 0x050)
#define CMU_FREEZE		MMIO32(CMU_BASE + 0x054)
#define CMU_LFACLKEN0		MMIO32(CMU_BASE + 0x058)
#define CMU_LFBCLKEN0		MMIO32(CMU_BASE + 0x060)
#define CMU_LFAPRESC0		MMIO32(CMU_BASE + 0x068)
#define CMU_LFBPRESC0		MMIO32(CMU_BASE + 0x070)
#define CMU_PCNTCTRL		MMIO32(CMU_BASE + 0x078)
#define CMU_LCDCTRL		MMIO32(CMU_BASE + 0x07C)
#define CMU_ROUTE		MMIO32(CMU_BASE + 0x080)
#define CMU_LOCK		MMIO32(CMU_BASE + 0x084)

/** @} */

/**
 * This section is incomplete because i'm impatient and want a working result
 * quickly
 *
 * @todo Include all bits and bit groups from the manual.
 */

#define CMU_HFPERCLKEN0_GPIO (1<<6)

#endif