libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
gd32/f1x0/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 GD32F1x0 Flash memory</b>
4
*
5
* @ingroup GD32F1x0_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
/*****************************************************************************/
44
/* Register values */
45
/*****************************************************************************/
46
47
/* --- FLASH_ACR values ---------------------------------------------------- */
48
49
/** @defgroup flash_latency FLASH Wait States
50
@ingroup flash_defines
51
@{*/
52
#define FLASH_ACR_LATENCY_000_024MHZ 0
53
#define FLASH_ACR_LATENCY_024_048MHZ 1
54
#define FLASH_ACR_LATENCY_048_072MHZ 2
55
#define FLASH_ACR_LATENCY_0WS 0
56
#define FLASH_ACR_LATENCY_1WS 1
57
#define FLASH_ACR_LATENCY_2WS 1
58
/**@}*/
59
60
/* --- FLASH_SR values ----------------------------------------------------- */
61
62
#define FLASH_SR_EOP (1 << 5)
63
#define FLASH_SR_WRPRTERR (1 << 4)
64
#define FLASH_SR_PGERR (1 << 2)
65
#define FLASH_SR_BSY (1 << 0)
66
67
/* --- FLASH_CR values ----------------------------------------------------- */
68
69
#define FLASH_CR_OBL_LAUNCH (1 << 13)
70
71
/* --- FLASH_OBR values ---------------------------------------------------- */
72
73
#define FLASH_OBR_DATA1_SHIFT 24
74
#define FLASH_OBR_DATA1 (0xFF << FLASH_OBR_DATA1_SHIFT)
75
#define FLASH_OBR_DATA0_SHIFT 16
76
#define FLASH_OBR_DATA0 (0xFF << FLASH_OBR_DATA0_SHIFT)
77
#define FLASH_OBR_USER_SHIFT 8
78
#define FLASH_OBR_USER (0xFF << FLASH_OBR_USER_SHIFT)
79
80
#define FLASH_OBR_RDPRT (3 << FLASH_OBR_RDPRT_SHIFT)
81
#define FLASH_OBR_RDPRT_L0 (0 << FLASH_OBR_RDPRT_SHIFT)
82
#define FLASH_OBR_RDPRT_L1 (1 << FLASH_OBR_RDPRT_SHIFT)
83
#define FLASH_OBR_RDPRT_L2 (3 << FLASH_OBR_RDPRT_SHIFT)
84
85
/*****************************************************************************/
86
/* API definitions */
87
/*****************************************************************************/
88
89
/* Read protection option byte protection level setting */
90
#define FLASH_RDP_L0 ((uint8_t)0xa5)
91
#define FLASH_RDP_L1 ((uint8_t)0xf0)
/* any value */
92
#define FLASH_RDP_L2 ((uint8_t)0xcc)
93
94
/*****************************************************************************/
95
/* API Functions */
96
/*****************************************************************************/
97
98
BEGIN_DECLS
99
100
END_DECLS
101
/**@}*/
102
103
#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
gd32
f1x0
flash.h
Generated on Tue Mar 7 2023 16:12:29 for libopencm3 by
1.9.4