From ea175caf4bbcc3b32c161dd52cb773fa8fdba707 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 28 Nov 2011 23:21:21 -0500 Subject: libmaple/flash: Add family-specific FLASH_SAFE_WAIT_STATES. This is the smallest wait state value that is safe for use when the MCU is at its fastest rate, not considering overclocking. This requires moving the FLASH_WAIT_STATE defines above the family include, so do that, and add the missing #defines (for wait states up to 7). For the STM32F1, the correct value for FLASH_SAFE_WAIT_STATES is FLASH_WAIT_STATE_2; say so in the F1-family flash.h. Signed-off-by: Marti Bolivar --- libmaple/include/libmaple/flash.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libmaple/include') diff --git a/libmaple/include/libmaple/flash.h b/libmaple/include/libmaple/flash.h index 01d45f5..66d5b8e 100644 --- a/libmaple/include/libmaple/flash.h +++ b/libmaple/include/libmaple/flash.h @@ -36,16 +36,25 @@ extern "C"{ #endif -#include #include -/* - * Setup routines - */ - #define FLASH_WAIT_STATE_0 0x0 #define FLASH_WAIT_STATE_1 0x1 #define FLASH_WAIT_STATE_2 0x2 +#define FLASH_WAIT_STATE_3 0x3 +#define FLASH_WAIT_STATE_4 0x4 +#define FLASH_WAIT_STATE_5 0x5 +#define FLASH_WAIT_STATE_6 0x6 +#define FLASH_WAIT_STATE_7 0x7 + +/* The family header must define FLASH_SAFE_WAIT_STATES, the smallest + * number of wait states that it is safe to use when the MCU clock is + * at its fastest rate (not considering overclocking). */ +#include + +/* + * Setup routines + */ void flash_enable_prefetch(void); void flash_set_latency(uint32 wait_states); -- cgit v1.2.3