libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
flash_common_all.h
Go to the documentation of this file.
1/** @addtogroup flash_defines
2 *
3 */
4/*
5 * This file is part of the libopencm3 project.
6 *
7 * This library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
24
26
27/**
28 * This buffer is used for instruction fetches and may or may not be
29 * enabled by default, depending on platform. (F1: yes, most others: no)
30 *
31 * Note carefully the clock restrictions under which the prefetch buffer may be
32 * enabled or disabled. Changes are normally made while the clock is running in
33 * the power-on low frequency mode before being set to a higher speed mode.
34 *
35 * Note carefully that prefetch may also results in increased consumption
36 * and can only improve performance on "mostly linear" workloads where there
37 * is at least one flash wait state.
38 *
39 * See the reference manual for your particular target for more details.
40 */
41void flash_prefetch_enable(void);
42
43/**
44 * Note carefully the clock restrictions under which the prefetch buffer may be
45 * set to disabled. See the reference manual for details.
46 */
47void flash_prefetch_disable(void);
48
49
50/** Set the Number of Wait States.
51
52Used to match the system clock to the FLASH memory access time. See the
53programming manual for more information on clock speed ranges. The latency must
54be changed to the appropriate value <b>before</b> any increase in clock
55speed, or <b>after</b> any decrease in clock speed.
56
57@param[in] ws values from @ref flash_latency.
58*/
59void flash_set_ws(uint32_t ws);
60
61/** Lock the Flash Program and Erase Controller
62 * Used to prevent spurious writes to FLASH.
63 */
64void flash_lock(void);
65
66/** Unlock the Flash Program and Erase Controller
67 * This enables write access to the Flash memory. It is locked by default on
68 * reset.
69 */
70void flash_unlock(void);
71
72/** Unlock the Option Byte Access.
73 * This enables write access to the option bytes. It is locked by default on
74 * reset.
75 */
77
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void flash_prefetch_enable(void)
This buffer is used for instruction fetches and may or may not be enabled by default,...
void flash_prefetch_disable(void)
Note carefully the clock restrictions under which the prefetch buffer may be set to disabled.
void flash_unlock(void)
Unlock the Flash Program and Erase Controller This enables write access to the Flash memory.
Definition: flash.c:203
void flash_unlock_option_bytes(void)
Unlock the Option Byte Access.
void flash_set_ws(uint32_t ws)
Set the Number of Wait States.
void flash_lock(void)
Lock the Flash Program and Erase Controller Used to prevent spurious writes to FLASH.
Definition: flash.c:209