diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-01-27 21:01:59 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-04-11 16:56:54 -0400 |
commit | b5a8e0386d5134839bf23e82110d2f1926201202 (patch) | |
tree | 50b4a7a328bbc848d877ac9c6f77166403afe586 /libmaple/stm32f1 | |
parent | 511a553334f36112bc2fd85f7c991840df727b60 (diff) | |
download | librambutan-b5a8e0386d5134839bf23e82110d2f1926201202.tar.gz librambutan-b5a8e0386d5134839bf23e82110d2f1926201202.zip |
Clean up Flash interface; add flash_enable_features().
Make a single function, flash_enable_features(), to control the access
characteristics of Flash memory (i.e. to write to the non-latency bits
of ACR).
In so doing, make everybody pretend to allow instruction and data
caching. On STM32F1, trying to turn these on simply has no
effect. This allows unconditionally trying to turn them on, which will
simplify users' lives.
This has the ancillary benefit of making the stm32f2- and
stm32f1-specific flash.c files unnecessary; delete these.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/stm32f1')
-rw-r--r-- | libmaple/stm32f1/flash.c | 41 | ||||
-rw-r--r-- | libmaple/stm32f1/include/series/flash.h | 8 | ||||
-rw-r--r-- | libmaple/stm32f1/rules.mk | 1 |
3 files changed, 8 insertions, 42 deletions
diff --git a/libmaple/stm32f1/flash.c b/libmaple/stm32f1/flash.c deleted file mode 100644 index 73fc93f..0000000 --- a/libmaple/stm32f1/flash.c +++ /dev/null @@ -1,41 +0,0 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2010 Perry Hung. - * Copyright (c) 2011 LeafLabs, LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/** - * @file libmaple/stm32f1/flash.c - * @brief Flash management functions - */ - -#include <libmaple/flash.h> -#include <libmaple/bitband.h> - -/** - * @brief Turn on the hardware prefetcher. - */ -void flash_enable_prefetch(void) { - *bb_perip(&FLASH_BASE->ACR, FLASH_ACR_PRFTBE_BIT) = 1; -} diff --git a/libmaple/stm32f1/include/series/flash.h b/libmaple/stm32f1/include/series/flash.h index efa608c..5603176 100644 --- a/libmaple/stm32f1/include/series/flash.h +++ b/libmaple/stm32f1/include/series/flash.h @@ -135,6 +135,14 @@ typedef struct flash_reg_map { #define FLASH_SAFE_WAIT_STATES FLASH_WAIT_STATE_2 +/* Flash memory features available via ACR */ +enum { + FLASH_PREFETCH = 0x10, + FLASH_HALF_CYCLE = 0x8, + FLASH_ICACHE = 0x0, /* Not available on STM32F1 */ + FLASH_DCACHE = 0x0, /* Not available on STM32F1 */ +}; + #ifdef __cplusplus } #endif diff --git a/libmaple/stm32f1/rules.mk b/libmaple/stm32f1/rules.mk index 32b3a2c..4c7db60 100644 --- a/libmaple/stm32f1/rules.mk +++ b/libmaple/stm32f1/rules.mk @@ -12,7 +12,6 @@ sSRCS_$(d) := isrs_performance.S \ vector_table_performance.S cSRCS_$(d) := rcc.c -cSRCS_$(d) += flash.c cSRCS_$(d) += gpio.c cSRCS_$(d) += bkp.c |