Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2018-07-14 00:04:28 +0300
committerKarl Palsson <karlp@tweak.net.au>2018-07-29 23:31:17 +0300
commit4840b6bc7e98944bbd4647db99a6c9416f7de999 (patch)
tree2544de2e8f5eb90c1477d654eb791be0516025f9
parentda7ebafcbee5ac8c11cff3366f4c1ec8355c2979 (diff)
stm32: flash: pull up clear_eop
All the "f" type flash parts have an EOP flag, even if it's in different bit positions. Add a header for this common functionality, and move it's implementation to the existing common file.
-rw-r--r--include/libopencm3/stm32/common/flash_common_f.h32
-rw-r--r--include/libopencm3/stm32/common/flash_common_f01.h1
-rw-r--r--include/libopencm3/stm32/common/flash_common_f234.h1
-rw-r--r--include/libopencm3/stm32/f0/flash.h1
-rw-r--r--include/libopencm3/stm32/f1/flash.h1
-rw-r--r--include/libopencm3/stm32/f2/flash.h1
-rw-r--r--include/libopencm3/stm32/f3/flash.h1
-rw-r--r--include/libopencm3/stm32/f4/flash.h1
-rw-r--r--include/libopencm3/stm32/f7/flash.h2
-rw-r--r--include/libopencm3/stm32/l4/flash.h2
-rw-r--r--lib/stm32/common/flash_common_f.c7
-rw-r--r--lib/stm32/common/flash_common_f01.c10
-rw-r--r--lib/stm32/common/flash_common_f234.c11
-rw-r--r--lib/stm32/f7/flash.c10
-rw-r--r--lib/stm32/l4/flash.c7
15 files changed, 46 insertions, 42 deletions
diff --git a/include/libopencm3/stm32/common/flash_common_f.h b/include/libopencm3/stm32/common/flash_common_f.h
new file mode 100644
index 00000000..6a52e60c
--- /dev/null
+++ b/include/libopencm3/stm32/common/flash_common_f.h
@@ -0,0 +1,32 @@
+/** @addtogroup flash_defines
+ *
+ */
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <libopencm3/cm3/common.h>
+
+BEGIN_DECLS
+
+/**
+ * Clear the End of OPeration flag.
+ */
+void flash_clear_eop_flag(void);
+
+END_DECLS \ No newline at end of file
diff --git a/include/libopencm3/stm32/common/flash_common_f01.h b/include/libopencm3/stm32/common/flash_common_f01.h
index 70410f6d..33b02edd 100644
--- a/include/libopencm3/stm32/common/flash_common_f01.h
+++ b/include/libopencm3/stm32/common/flash_common_f01.h
@@ -100,7 +100,6 @@
BEGIN_DECLS
void flash_clear_pgerr_flag(void);
-void flash_clear_eop_flag(void);
void flash_clear_wrprterr_flag(void);
void flash_clear_status_flags(void);
uint32_t flash_get_status_flags(void);
diff --git a/include/libopencm3/stm32/common/flash_common_f234.h b/include/libopencm3/stm32/common/flash_common_f234.h
index 1c52c5bf..0842607b 100644
--- a/include/libopencm3/stm32/common/flash_common_f234.h
+++ b/include/libopencm3/stm32/common/flash_common_f234.h
@@ -75,7 +75,6 @@
BEGIN_DECLS
void flash_clear_pgperr_flag(void);
-void flash_clear_eop_flag(void);
void flash_clear_status_flags(void);
void flash_wait_for_last_operation(void);
diff --git a/include/libopencm3/stm32/f0/flash.h b/include/libopencm3/stm32/f0/flash.h
index 24ef2809..818e5f2c 100644
--- a/include/libopencm3/stm32/f0/flash.h
+++ b/include/libopencm3/stm32/f0/flash.h
@@ -37,6 +37,7 @@
/**@{*/
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
#include <libopencm3/stm32/common/flash_common_f01.h>
/* --- FLASH_OPTION values ------------------------------------------------- */
diff --git a/include/libopencm3/stm32/f1/flash.h b/include/libopencm3/stm32/f1/flash.h
index 937c83f3..d14df2ba 100644
--- a/include/libopencm3/stm32/f1/flash.h
+++ b/include/libopencm3/stm32/f1/flash.h
@@ -44,6 +44,7 @@
/**@{*/
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
#include <libopencm3/stm32/common/flash_common_f01.h>
/* --- FLASH_OPTION bytes ------------------------------------------------- */
diff --git a/include/libopencm3/stm32/f2/flash.h b/include/libopencm3/stm32/f2/flash.h
index e5b43080..d7d0e046 100644
--- a/include/libopencm3/stm32/f2/flash.h
+++ b/include/libopencm3/stm32/f2/flash.h
@@ -32,6 +32,7 @@
#define LIBOPENCM3_FLASH_H
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
#include <libopencm3/stm32/common/flash_common_f24.h>
#endif
diff --git a/include/libopencm3/stm32/f3/flash.h b/include/libopencm3/stm32/f3/flash.h
index eaaec2d5..f4024c50 100644
--- a/include/libopencm3/stm32/f3/flash.h
+++ b/include/libopencm3/stm32/f3/flash.h
@@ -33,6 +33,7 @@
/**@{*/
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
#include <libopencm3/stm32/common/flash_common_f234.h>
/* --- FLASH registers ----------------------------------------------------- */
diff --git a/include/libopencm3/stm32/f4/flash.h b/include/libopencm3/stm32/f4/flash.h
index 383cbe8c..5a5d7761 100644
--- a/include/libopencm3/stm32/f4/flash.h
+++ b/include/libopencm3/stm32/f4/flash.h
@@ -32,6 +32,7 @@
#define LIBOPENCM3_FLASH_H
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
#include <libopencm3/stm32/common/flash_common_f24.h>
#endif
diff --git a/include/libopencm3/stm32/f7/flash.h b/include/libopencm3/stm32/f7/flash.h
index befd63d6..ef3d141b 100644
--- a/include/libopencm3/stm32/f7/flash.h
+++ b/include/libopencm3/stm32/f7/flash.h
@@ -33,6 +33,7 @@
*/
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
/*
* For details see:
* PM0081 Programming manual: STM32F40xxx and STM32F41xxx Flash programming
@@ -153,7 +154,6 @@
BEGIN_DECLS
void flash_clear_pgperr_flag(void);
-void flash_clear_eop_flag(void);
void flash_wait_for_last_operation(void);
void flash_unlock_option_bytes(void);
diff --git a/include/libopencm3/stm32/l4/flash.h b/include/libopencm3/stm32/l4/flash.h
index 90286058..88332a2f 100644
--- a/include/libopencm3/stm32/l4/flash.h
+++ b/include/libopencm3/stm32/l4/flash.h
@@ -42,6 +42,7 @@
#define LIBOPENCM3_FLASH_H
#include <libopencm3/stm32/common/flash_common_all.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
/* --- FLASH registers ----------------------------------------------------- */
@@ -225,7 +226,6 @@
BEGIN_DECLS
void flash_clear_pgperr_flag(void);
-void flash_clear_eop_flag(void);
void flash_wait_for_last_operation(void);
void flash_dcache_enable(void);
void flash_dcache_disable(void);
diff --git a/lib/stm32/common/flash_common_f.c b/lib/stm32/common/flash_common_f.c
index b6f0ce50..d0a2188a 100644
--- a/lib/stm32/common/flash_common_f.c
+++ b/lib/stm32/common/flash_common_f.c
@@ -22,6 +22,7 @@
/**@{*/
#include <libopencm3/stm32/flash.h>
+#include <libopencm3/stm32/common/flash_common_f.h>
void flash_unlock(void)
@@ -39,3 +40,9 @@ void flash_lock(void)
FLASH_CR |= FLASH_CR_LOCK;
}
+/* The bit number for EOP moves sometimes, but it's always a write 1 to clear */
+void flash_clear_eop_flag(void)
+{
+ FLASH_SR |= FLASH_SR_EOP;
+}
+
diff --git a/lib/stm32/common/flash_common_f01.c b/lib/stm32/common/flash_common_f01.c
index 2d8917cc..fe1c1709 100644
--- a/lib/stm32/common/flash_common_f01.c
+++ b/lib/stm32/common/flash_common_f01.c
@@ -60,16 +60,6 @@ void flash_clear_pgerr_flag(void)
}
/*---------------------------------------------------------------------------*/
-/** @brief Clear the End of Operation Status Flag
-
-*/
-
-void flash_clear_eop_flag(void)
-{
- FLASH_SR |= FLASH_SR_EOP;
-}
-
-/*---------------------------------------------------------------------------*/
/** @brief Clear the Write Protect Error Status Flag
*/
diff --git a/lib/stm32/common/flash_common_f234.c b/lib/stm32/common/flash_common_f234.c
index e150ce79..0e01f811 100644
--- a/lib/stm32/common/flash_common_f234.c
+++ b/lib/stm32/common/flash_common_f234.c
@@ -56,17 +56,6 @@ void flash_clear_pgperr_flag(void)
}
/*---------------------------------------------------------------------------*/
-/** @brief Clear the End of Operation Status Flag
-
-*/
-
-void flash_clear_eop_flag(void)
-{
- FLASH_SR |= FLASH_SR_EOP;
-}
-
-
-/*---------------------------------------------------------------------------*/
/** @brief Wait until Last Operation has Ended
This loops indefinitely until an operation (write or erase) has completed by
diff --git a/lib/stm32/f7/flash.c b/lib/stm32/f7/flash.c
index a78b4bf6..846aa042 100644
--- a/lib/stm32/f7/flash.c
+++ b/lib/stm32/f7/flash.c
@@ -94,16 +94,6 @@ void flash_clear_pgperr_flag(void)
FLASH_SR |= FLASH_SR_PGPERR;
}
-/*---------------------------------------------------------------------------*/
-/** @brief Clear the End of Operation Status Flag
-
-*/
-
-void flash_clear_eop_flag(void)
-{
- FLASH_SR |= FLASH_SR_EOP;
-}
-
/*---------------------------------------------------------------------------*/
/** @brief Wait until Last Operation has Ended
diff --git a/lib/stm32/l4/flash.c b/lib/stm32/l4/flash.c
index d654ecc8..488017f0 100644
--- a/lib/stm32/l4/flash.c
+++ b/lib/stm32/l4/flash.c
@@ -68,13 +68,6 @@ void flash_clear_pgperr_flag(void)
FLASH_SR |= FLASH_SR_PROGERR;
}
-/** @brief Clear the End of Operation Status Flag
- */
-void flash_clear_eop_flag(void)
-{
- FLASH_SR |= FLASH_SR_EOP;
-}
-
/** @brief Wait until Last Operation has Ended
* This loops indefinitely until an operation (write or erase) has completed
* by testing the busy flag.