aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmaple/include/libmaple/flash.h19
-rw-r--r--libmaple/stm32f1/include/family/flash.h9
2 files changed, 22 insertions, 6 deletions
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 <family/flash.h>
#include <libmaple/libmaple_types.h>
-/*
- * 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 <family/flash.h>
+
+/*
+ * Setup routines
+ */
void flash_enable_prefetch(void);
void flash_set_latency(uint32 wait_states);
diff --git a/libmaple/stm32f1/include/family/flash.h b/libmaple/stm32f1/include/family/flash.h
index aedb326..918a434 100644
--- a/libmaple/stm32f1/include/family/flash.h
+++ b/libmaple/stm32f1/include/family/flash.h
@@ -29,7 +29,8 @@
* @brief STM32F1 Flash header.
*
* Provides register map, base pointer, and register bit definitions
- * for the Flash controller on the STM32F1 line.
+ * for the Flash controller on the STM32F1 line, along with
+ * family-specific configuration values.
*/
#ifndef _LIBMAPLE_STM32F1_FLASH_H_
@@ -128,6 +129,12 @@ typedef struct flash_reg_map {
#define FLASH_OBR_RDPRT BIT(FLASH_OBR_RDPRT_BIT)
#define FLASH_OBR_OPTERR BIT(FLASH_OBR_OPTERR_BIT)
+/*
+ * Family-specific configuration values.
+ */
+
+#define FLASH_SAFE_WAIT_STATES FLASH_WAIT_STATE_2
+
#ifdef __cplusplus
}
#endif