libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
burtc_common.h
Go to the documentation of this file.
1
/** @addtogroup burtc_defines
2
*/
3
/*
4
* This file is part of the libopencm3 project.
5
*
6
* Copyright (C) 2015 Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
7
*
8
* This library is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with this library. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#pragma once
23
24
#include <
libopencm3/efm32/memorymap.h
>
25
#include <
libopencm3/cm3/common.h
>
26
27
/**@{*/
28
29
#define BURTC_CTRL MMIO32(BURTC_BASE + 0x000)
30
#define BURTC_LPMODE MMIO32(BURTC_BASE + 0x004)
31
#define BURTC_CNT MMIO32(BURTC_BASE + 0x008)
32
#define BURTC_COMP0 MMIO32(BURTC_BASE + 0x00C)
33
#define BURTC_TIMESTAMP MMIO32(BURTC_BASE + 0x010)
34
#define BURTC_LFXOFDET MMIO32(BURTC_BASE + 0x014)
35
#define BURTC_STATUS MMIO32(BURTC_BASE + 0x018)
36
#define BURTC_CMD MMIO32(BURTC_BASE + 0x01C)
37
#define BURTC_POWERDOWN MMIO32(BURTC_BASE + 0x020)
38
#define BURTC_LOCK MMIO32(BURTC_BASE + 0x024)
39
#define BURTC_IF MMIO32(BURTC_BASE + 0x028)
40
#define BURTC_IFS MMIO32(BURTC_BASE + 0x02C)
41
#define BURTC_IFC MMIO32(BURTC_BASE + 0x030)
42
#define BURTC_IEN MMIO32(BURTC_BASE + 0x034)
43
#define BURTC_FREEZE MMIO32(BURTC_BASE + 0x038)
44
#define BURTC_SYNCBUSY MMIO32(BURTC_BASE + 0x03C)
45
46
#define RETx_REG(x) MMIO32(BURTC_BASE + 0x100 + (4 * (x)))
47
/* [for ease] */
48
#define BURTC_RETx(x) RETx_REG(x)
49
50
/* BURTC_CTRL */
51
#define BURTC_CTRL_BUMODETSEN (1 << 14)
52
53
#define BURTC_CTRL_CLKSEL_SHIFT (8)
54
#define BURTC_CTRL_CLKSEL_MASK (0x3 << BURTC_CTRL_CLKSEL_SHIFT)
55
#define BURTC_CTRL_CLKSEL(v) \
56
(((v) << BURTC_CTRL_CLKSEL_SHIFT) & BURTC_CTRL_CLKSEL_MASK)
57
#define BURTC_CTRL_CLKSEL_NONE 0
58
#define BURTC_CTRL_CLKSEL_LFRCO 1
59
#define BURTC_CTRL_CLKSEL_LFXO 2
60
#define BURTC_CTRL_CLKSEL_ULFRCO 3
61
62
#define BURTC_CTRL_PRESC_SHIFT (12)
63
#define BURTC_CTRL_PRESC_MASK (0x7 << BURTC_CTRL_PRESC_SHIFT)
64
#define BURTC_CTRL_PRESC(v) \
65
(((v) << BURTC_CTRL_PRESC_SHIFT) & BURTC_CTRL_PRESC_MASK)
66
#define BURTC_CTRL_PRESC_DIV1 0
67
#define BURTC_CTRL_PRESC_DIV2 1
68
#define BURTC_CTRL_PRESC_DIV4 2
69
#define BURTC_CTRL_PRESC_DIV8 3
70
#define BURTC_CTRL_PRESC_DIV16 4
71
#define BURTC_CTRL_PRESC_DIV32 5
72
#define BURTC_CTRL_PRESC_DIV64 6
73
#define BURTC_CTRL_PRESC_DIV128 7
74
#define BURTC_CTRL_PRESC_NODIV BURTC_CTRL_PRESC_DIV1
75
76
#define BURTC_CTRL_LPCOMPC_SHIFT (5)
77
#define BURTC_CTRL_LPCOMPC_MASK (0x7 << BURTC_CTRL_LPCOMPC_SHIFT)
78
#define BURTC_CTRL_LPCOMPC(v) \
79
(((v) << BURTC_CTRL_LPCOMPC_SHIFT) & BURTC_CTRL_LPCOMPC_MASK)
80
#define BURTC_CTRL_LPCOMPC_IGNxLSB(x) BURTC_CTRL_LPCOMPC(x)
81
#define BURTC_CTRL_LPCOMPC_IGN0LSB 0
82
#define BURTC_CTRL_LPCOMPC_IGN1LSB 1
83
#define BURTC_CTRL_LPCOMPC_IGN2LSB 2
84
#define BURTC_CTRL_LPCOMPC_IGN3LSB 3
85
#define BURTC_CTRL_LPCOMPC_IGN4LSB 4
86
#define BURTC_CTRL_LPCOMPC_IGN5LSB 5
87
#define BURTC_CTRL_LPCOMPC_IGN6LSB 6
88
#define BURTC_CTRL_LPCOMPC_IGN7LSB 7
89
90
#define BURTC_CTRL_COMP0TOP (1 << 4)
91
#define BURTC_CTRL_RSTEN (1 << 3)
92
#define BURTC_CTRL_DEBUGRUN (1 << 2)
93
94
#define BURTC_CTRL_MODE_SHIFT (0)
95
#define BURTC_CTRL_MODE_MASK (0x3 << BURTC_CTRL_MODE_SHIFT)
96
#define BURTC_CTRL_MODE(v) \
97
(((v) << BURTC_CTRL_MODE_SHIFT) & BURTC_CTRL_MODE_MASK)
98
#define BURTC_CTRL_MODE_DISABLE 0
99
#define BURTC_CTRL_MODE_EM2EN 1
100
#define BURTC_CTRL_MODE_EM3EN 2
101
#define BURTC_CTRL_MODE_EM4EN 3
102
103
/* BURTC_LPMODE */
104
#define BURTC_LPMODE_LPMODE_SHIFT (0)
105
#define BURTC_LPMODE_LPMODE_MASK (0x3 << BURTC_LPMODE_LPMODE_SHIFT)
106
#define BURTC_LPMODE_LPMODE(v) \
107
(((v) << BURTC_LPMODE_LPMODE_SHIFT) & BURTC_LPMODE_LPMODE_MASK)
108
#define BURTC_LPMODE_LPMODE_DISABLE 0
109
#define BURTC_LPMODE_LPMODE_ENABLE 1
110
#define BURTC_LPMODE_LPMODE_BUEN 2
111
112
/* BURTC_LFXOFDET */
113
#define BURTC_LFXOFDET_TOP_SHIFT (4)
114
#define BURTC_LFXOFDET_TOP_MASK (0xF << BURTC_LFXOFDET_TOP_SHIFT)
115
#define BURTC_LFXOFDET_TOP(v) \
116
(((v) << BURTC_LFXOFDET_TOP_SHIFT) & BURTC_LFXOFDET_TOP_MASK)
117
118
#define BURTC_LFXOFDET_OSC_SHIFT (0)
119
#define BURTC_LFXOFDET_OSC_MASK (0x3 << BURTC_LFXOFDET_OSC_SHIFT)
120
#define BURTC_LFXOFDET_OSC(v) \
121
(((v) << BURTC_LFXOFDET_OSC_SHIFT) & BURTC_LFXOFDET_OSC_MASK)
122
#define BURTC_LFXOFDET_OSC_DISABLE 0
123
#define BURTC_LFXOFDET_OSC_LFRCO 1
124
#define BURTC_LFXOFDET_OSC_ULFRCO 2
125
126
/* BURTC_STATUS */
127
#define BURTC_STATUS_RAMWERR (1 << 2)
128
#define BURTC_STATUS_BUMODETS (1 << 1)
129
#define BURTC_STATUS_LPMODEACT (1 << 0)
130
131
/* BURTC_CMD */
132
#define BURTC_CMD_CLRSTATUS (1 << 0)
133
134
/* BURTC_POWERDOWN */
135
#define BURTC_POWERDOWN_RAM (1 << 0)
136
137
/* BURTC_LOCK */
138
#define BURTC_LOCK_LOCKKEY_SHIFT (0)
139
#define BURTC_LOCK_LOCKKEY_MASK (0xFFFF << BURTC_LOCK_LOCKKEY_SHIFT)
140
#define BURTC_LOCK_LOCKKEY_UNLOCKED (0x0000 << BURTC_LOCK_LOCKKEY_SHIFT)
141
#define BURTC_LOCK_LOCKKEY_LOCKED (0x0001 << BURTC_LOCK_LOCKKEY_SHIFT)
142
#define BURTC_LOCK_LOCKKEY_LOCK (0x0000 << BURTC_LOCK_LOCKKEY_SHIFT)
143
#define BURTC_LOCK_LOCKKEY_UNLOCK (0xAEE8 << BURTC_LOCK_LOCKKEY_SHIFT)
144
145
/* BURTC_IF */
146
#define BURTC_IF_LFXOFAIL (1 << 2)
147
#define BURTC_IF_COMP0 (1 << 1)
148
#define BURTC_IF_OF (1 << 0)
149
150
/* BURTC_IFS */
151
#define BURTC_IFS_LFXOFAIL (1 << 2)
152
#define BURTC_IFS_COMP0 (1 << 1)
153
#define BURTC_IFS_OF (1 << 0)
154
155
/* BURTC_IFC */
156
#define BURTC_IFC_LFXOFAIL (1 << 2)
157
#define BURTC_IFC_COMP0 (1 << 1)
158
#define BURTC_IFC_OF (1 << 0)
159
160
/* BURTC_IEN */
161
#define BURTC_IEN_LFXOFAIL (1 << 2)
162
#define BURTC_IEN_COMP0 (1 << 1)
163
#define BURTC_IEN_OF (1 << 0)
164
165
/* BURTC_FREEZE */
166
#define BURTC_FREEZE_REGFREEZE (1 << 0)
167
168
/* BURTC_SYNCBUSY */
169
#define BURTC_SYNCBUSY_COMP0 (1 << 1)
170
#define BURTC_SYNCBUSY_LPMODE (1 << 0)
171
172
/**@}*/
173
common.h
memorymap.h
Dispatcher for the base address definitions, depending on the particular Gecko family.
include
libopencm3
efm32
common
burtc_common.h
Generated on Tue Mar 7 2023 16:12:40 for libopencm3 by
1.9.4