libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
rcc.h
Go to the documentation of this file.
1/** @defgroup rcc_defines RCC Defines
2 *
3 * @brief <b>Defined Constants and Types for the LM3S Reset and Clock
4 * Control</b>
5 *
6 * @ingroup LM3S_defines
7 *
8 * @version 1.0.0
9 *
10 * @author @htmlonly &copy; @endhtmlonly 2009
11 * Daniele Lacamera <root at danielinux dot net>
12 *
13 * @date 21 November 2015
14 *
15 * LGPL License Terms @ref lgpl_license
16 * */
17/*
18 * This file is part of the libopencm3 project.
19 *
20 * Copyright (C) 2015 Daniele Lacamera <root@danielinux.net>
21 *
22 * This library is free software: you can redistribute it and/or modify
23 * it under the terms of the GNU Lesser General Public License as published by
24 * the Free Software Foundation, either version 3 of the License, or
25 * (at your option) any later version.
26 *
27 * This library is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public License
33 * along with this library. If not, see <http://www.gnu.org/licenses/>.
34 */
35
36#ifndef LIBOPENCM3_RCC_H
37#define LIBOPENCM3_RCC_H
39
40/* --- RCC registers ------------------------------------------------------- */
41
42#define RCC_RIS MMIO32(0x400FE050)
43#define RCC_CR MMIO32(0x400FE060)
44#define RCC2_CR MMIO32(0x400FE070)
45
46/* RCC1 bits */
47#define RCC_SYSDIV_MASK (0x0F << 23)
48#define RCC_SYSDIV_12_5MHZ (0x0F << 23)
49#define RCC_SYSDIV_50MHZ (0x03 << 23)
50
51#define RCC_USESYSDIV (1 << 22)
52#define RCC_USEPWMDIV (1 << 20)
53
54#define RCC_PWMDIV_MASK (0x07 << 17)
55#define RCC_PWMDIV_64 (0x07 << 17)
56
57#define RCC_OFF (1 << 13)
58#define RCC_BYPASS (1 << 11)
59
60#define RCC_XTAL_MASK (0x0F << 6)
61/* For other values, see datasheet section 23.2.2 - table 23-9 */
62#define RCC_XTAL_6MHZ_RESET (0x0B << 6)
63#define RCC_XTAL_8MHZ_400MHZ (0x0D << 6)
64
65
66#define RCC_OSCRC_MASK (0x03 << 4)
67#define RCC_OSCRC_MOSC (0x00 << 4)
68#define RCC_OSCRC_IOSC (0x01 << 4)
69#define RCC_OSCRC_IOSC_Q (0x02 << 4)
70#define RCC_OSCRC_30KHZ (0x03 << 4)
71
72#define RCC_IOSCDIS (1 << 1)
73#define RCC_MOSCDIS (1 << 0)
74
75/* RCC2 bits */
76#define RCC2_USERRCC2 (1 << 31)
77#define RCC2_SYSDIV2_MASK 0x7f
78#define RCC2_SYSDIV2_SHIFT 23
79
80#define RCC2_OFF (1 << 13)
81#define RCC2_BYPASS (1 << 11)
82
83/* RIS bit */
84#define RIS_PLLLRIS (1 << 6)
85
86
87/* From Datasheet description for reset values
88 * Section 6.4 - Register Descriptions
89 */
90
91/* Register 8: RCC
92 * Type R/W, reset 0x078E.3AD1
93 */
94#define RCC_RESET_VALUE (0x078E3AD1)
95
96/* Register 10: RCC2
97 * Type R/W, reset 0x0780.2810
98 */
99#define RCC2_RESET_VALUE (0x07802810)
100
102
104
106
107#endif
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
int rcc_clock_setup_in_xtal_8mhz_out_50mhz(void)
Definition: rcc.c:39