libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
l4/syscfg.h
Go to the documentation of this file.
1/** @defgroup syscfg_defines SYSCFG Defines
2 *
3 * @ingroup STM32L4xx_defines
4 *
5 * @brief Defined Constants and Types for the STM32L4xx Sysconfig
6 *
7 * @version 1.0.0
8 *
9 * @date 28 December 2017
10 *
11 * LGPL License Terms @ref lgpl_license
12 */
13
14/*
15 * This file is part of the libopencm3 project.
16 *
17 * Copyright (C) Bruno Randolf <br1@einfach.org>
18 *
19 * This library is free software: you can redistribute it and/or modify
20 * it under the terms of the GNU Lesser General Public License as published by
21 * the Free Software Foundation, either version 3 of the License, or
22 * (at your option) any later version.
23 *
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU Lesser General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public License
30 * along with this library. If not, see <http://www.gnu.org/licenses/>.
31 */
32
33#ifndef LIBOPENCM3_SYSCFG_H
34#define LIBOPENCM3_SYSCFG_H
35/**@{*/
36
37/* --- SYSCFG registers ---------------------------------------------------- */
38
39#define SYSCFG_MEMRMP MMIO32(SYSCFG_BASE + 0x00)
40#define SYSCFG_CFGR1 MMIO32(SYSCFG_BASE + 0x04)
41#define SYSCFG_EXTICR(i) MMIO32(SYSCFG_BASE + 0x08 + (i)*4)
42#define SYSCFG_EXTICR1 SYSCFG_EXTICR(0)
43#define SYSCFG_EXTICR2 SYSCFG_EXTICR(1)
44#define SYSCFG_EXTICR3 SYSCFG_EXTICR(2)
45#define SYSCFG_EXTICR4 SYSCFG_EXTICR(3)
46#define SYSCFG_SCSR MMIO32(SYSCFG_BASE + 0x18)
47#define SYSCFG_CFGR2 MMIO32(SYSCFG_BASE + 0x1C)
48#define SYSCFG_SWPR MMIO32(SYSCFG_BASE + 0x20)
49#define SYSCFG_SKR MMIO32(SYSCFG_BASE + 0x24)
50#define SYSCFG_SWPR2 MMIO32(SYSCFG_BASE + 0x29)
51
52/* --- SYSCFG_MEMRMP Values ------------------------------------------------ */
53
54#define SYSCFG_MEMRMP_MEM_MODE_MASK 7
55#define SYSCFG_MEMRMP_MEM_MODE_FLASH 0
56#define SYSCFG_MEMRMP_MEM_MODE_SYSTEM 1
57#define SYSCFG_MEMRMP_MEM_MODE_FMC 2
58#define SYSCFG_MEMRMP_MEM_MODE_SRAM 3
59#define SYSCFG_MEMRMP_MEM_MODE_QSPI 6
60
61/* --- SYSCFG_CFGR1 Values ------------------------------------------------- */
62
63#define SYSCFG_CFGR1_FPU_IE_INEXACT (1 << 31)
64#define SYSCFG_CFGR1_FPU_IE_DENORMAL (1 << 30)
65#define SYSCFG_CFGR1_FPU_IE_OVERFLOW (1 << 29)
66#define SYSCFG_CFGR1_FPU_IE_UNDERFLOW (1 << 28)
67#define SYSCFG_CFGR1_FPU_IE_DIVZERO (1 << 27)
68#define SYSCFG_CFGR1_FPU_IE_INVALID (1 << 26)
69
70#define SYSCFG_CFGR1_I2C3_FMP (1 << 22)
71#define SYSCFG_CFGR1_I2C2_FMP (1 << 21)
72#define SYSCFG_CFGR1_I2C1_FMP (1 << 20)
73
74#define SYSCFG_CFGR1_I2C_PB9_FMP (1 << 19)
75#define SYSCFG_CFGR1_I2C_PB8_FMP (1 << 18)
76#define SYSCFG_CFGR1_I2C_PB7_FMP (1 << 17)
77#define SYSCFG_CFGR1_I2C_PB6_FMP (1 << 16)
78
79#define SYSCFG_CFGR1_BOOSTEN (1 << 8)
80#define SYSCFG_CFGR1_FWDIS (1 << 0)
81
82/* --- SYSCFG_EXTICR Values -------------------------------------------------*/
83
84#define SYSCFG_EXTICR_FIELDSIZE 4
85#define SYSCFG_EXTICR_GPIOA 0
86#define SYSCFG_EXTICR_GPIOB 1
87#define SYSCFG_EXTICR_GPIOC 2
88#define SYSCFG_EXTICR_GPIOD 3
89#define SYSCFG_EXTICR_GPIOE 4
90#define SYSCFG_EXTICR_GPIOH 7
91
92/* --- SYSCFG_SCSR Values -------------------------------------------------- */
93
94#define SYSCFG_SCSR_SRAM2BSY (1 << 1)
95#define SYSCFG_SCSR_SRAM2ER (1 << 0)
96
97/* --- SYSCFG_CFGR2 Values ------------------------------------------------- */
98
99#define SYSCFG_CFGR2_SPF (1 << 8)
100#define SYSCFG_CFGR2_ECCL (1 << 3)
101#define SYSCFG_CFGR2_PVDL (1 << 2)
102#define SYSCFG_CFGR2_SPL (1 << 1)
103#define SYSCFG_CFGR2_CCL (1 << 0)
104
105/* --- SYSCFG_SWPR Values -------------------------------------------------- */
106
107/* 0 - 15 or 0 - 32 depending on L4 version */
108#define SYSCFG_SWPR_PxWP(x) (1 << x)
109
110/* --- SYSCFG_SKR Values --------------------------------------------------- */
111
112#define SYSCFG_SKR_KEY1 0xCA
113#define SYSCFG_SKR_KEY2 0x53
114
115/* --- SYSCFG_SWPR2 Values -------------------------------------------------- */
116
117/* 32 - 63 or not available depending on L4 version */
118#define SYSCFG_SWPR2_PxWP(x) (1 << (x - 32))
119
120/**@}*/
121
122#endif