libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
f0/flash.h
Go to the documentation of this file.
1
/** @defgroup flash_defines FLASH Defines
2
*
3
* @brief <b>Defined Constants and Types for the STM32F0xx Flash memory</b>
4
*
5
* @ingroup STM32F0xx_defines
6
*
7
* @version 1.0.0
8
*
9
* @author @htmlonly © @endhtmlonly 2013
10
* Frantisek Burian <BuFran@seznam.cz>
11
*
12
* @date 14 January 2014
13
*
14
* LGPL License Terms @ref lgpl_license
15
*/
16
/*
17
* This file is part of the libopencm3 project.
18
*
19
* Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
20
*
21
* This library is free software: you can redistribute it and/or modify
22
* it under the terms of the GNU Lesser General Public License as published by
23
* the Free Software Foundation, either version 3 of the License, or
24
* (at your option) any later version.
25
*
26
* This library is distributed in the hope that it will be useful,
27
* but WITHOUT ANY WARRANTY; without even the implied warranty of
28
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
* GNU Lesser General Public License for more details.
30
*
31
* You should have received a copy of the GNU Lesser General Public License
32
* along with this library. If not, see <http://www.gnu.org/licenses/>.
33
*/
34
35
#ifndef LIBOPENCM3_FLASH_H
36
#define LIBOPENCM3_FLASH_H
37
/**@{*/
38
39
#include <
libopencm3/stm32/common/flash_common_all.h
>
40
#include <
libopencm3/stm32/common/flash_common_f.h
>
41
#include <
libopencm3/stm32/common/flash_common_f01.h
>
42
43
/* --- FLASH_OPTION values ------------------------------------------------- */
44
45
/** @defgroup flash_options Option Byte Addresses
46
@ingroup flash_defines
47
@{*/
48
#define FLASH_OPTION_BYTE_0 FLASH_OPTION_BYTE(0)
49
#define FLASH_OPTION_BYTE_1 FLASH_OPTION_BYTE(1)
50
#define FLASH_OPTION_BYTE_2 FLASH_OPTION_BYTE(2)
51
#define FLASH_OPTION_BYTE_3 FLASH_OPTION_BYTE(3)
52
#define FLASH_OPTION_BYTE_4 FLASH_OPTION_BYTE(4)
53
#define FLASH_OPTION_BYTE_5 FLASH_OPTION_BYTE(5)
54
/**@}*/
55
56
/*****************************************************************************/
57
/* Register values */
58
/*****************************************************************************/
59
60
/* --- FLASH_ACR values ---------------------------------------------------- */
61
62
/** @defgroup flash_latency FLASH Wait States
63
@ingroup flash_defines
64
@{*/
65
#define FLASH_ACR_LATENCY_000_024MHZ 0
66
#define FLASH_ACR_LATENCY_024_048MHZ 1
67
#define FLASH_ACR_LATENCY_0WS 0
68
#define FLASH_ACR_LATENCY_1WS 1
69
/**@}*/
70
71
/* --- FLASH_SR values ----------------------------------------------------- */
72
73
#define FLASH_SR_EOP (1 << 5)
74
#define FLASH_SR_WRPRTERR (1 << 4)
75
#define FLASH_SR_PGERR (1 << 2)
76
#define FLASH_SR_BSY (1 << 0)
77
78
/* --- FLASH_CR values ----------------------------------------------------- */
79
80
#define FLASH_CR_OBL_LAUNCH (1 << 13)
81
82
/* --- FLASH_OBR values ---------------------------------------------------- */
83
84
#define FLASH_OBR_DATA1_SHIFT 24
85
#define FLASH_OBR_DATA1 (0xFF << FLASH_OBR_DATA1_SHIFT)
86
#define FLASH_OBR_DATA0_SHIFT 16
87
#define FLASH_OBR_DATA0 (0xFF << FLASH_OBR_DATA0_SHIFT)
88
89
#define FLASH_OBR_BOOT_SEL (1 << 15)
90
#define FLASH_OBR_RAM_PARITY_CHECK (1 << 14)
91
#define FLASH_OBR_VDDA_MONITOR (1 << 13)
92
#define FLASH_OBR_NBOOT1 (1 << 12)
93
#define FLASH_OBR_NBOOT0 (1 << 11)
94
#define FLASH_OBR_NRST_STDBY (1 << 10)
95
#define FLASH_OBR_NRST_STOP (1 << 9)
96
#define FLASH_OBR_WDG_SW (1 << 8)
97
#define FLASH_OBR_RDPRT (3 << FLASH_OBR_RDPRT_SHIFT)
98
#define FLASH_OBR_RDPRT_L0 (0 << FLASH_OBR_RDPRT_SHIFT)
99
#define FLASH_OBR_RDPRT_L1 (1 << FLASH_OBR_RDPRT_SHIFT)
100
#define FLASH_OBR_RDPRT_L2 (3 << FLASH_OBR_RDPRT_SHIFT)
101
102
/*****************************************************************************/
103
/* API definitions */
104
/*****************************************************************************/
105
106
/* Read protection option byte protection level setting */
107
#define FLASH_RDP_L0 ((uint8_t)0xaa)
108
#define FLASH_RDP_L1 ((uint8_t)0xf0)
/* any value */
109
#define FLASH_RDP_L2 ((uint8_t)0xcc)
110
111
/*****************************************************************************/
112
/* API Functions */
113
/*****************************************************************************/
114
115
BEGIN_DECLS
116
117
END_DECLS
118
/**@}*/
119
120
#endif
END_DECLS
#define END_DECLS
Definition:
common.h:34
BEGIN_DECLS
#define BEGIN_DECLS
Definition:
common.h:33
flash_common_all.h
flash_common_f01.h
flash_common_f.h
include
libopencm3
stm32
f0
flash.h
Generated on Tue Mar 7 2023 16:11:16 for libopencm3 by
1.9.4