diff options
author | Karl Palsson <karlp@tweak.net.au> | 2018-07-23 12:47:26 +0300 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2018-07-29 23:31:17 +0300 |
commit | eafc46ff247e70f1f25d2c51361a0c8ccfe7c032 (patch) | |
tree | d392e165f9b9b343092025fbaa0a03d3277afc51 | |
parent | c272ea410efac24b4a4828035e8faa8cb0edd526 (diff) |
stm32: flash: extract wait_for_last_operation to top level
This then eliminates the misguided attempts at merging f2/4 and f3 flash
support. Some headers remain.
-rw-r--r-- | include/libopencm3/stm32/common/flash_common_f.h | 5 | ||||
-rw-r--r-- | include/libopencm3/stm32/common/flash_common_f01.h | 1 | ||||
-rw-r--r-- | include/libopencm3/stm32/common/flash_common_f234.h | 2 | ||||
-rw-r--r-- | include/libopencm3/stm32/f7/flash.h | 1 | ||||
-rw-r--r-- | include/libopencm3/stm32/l4/flash.h | 1 | ||||
-rw-r--r-- | lib/stm32/common/flash_common_f234.c | 40 | ||||
-rw-r--r-- | lib/stm32/common/flash_common_f24.c | 5 | ||||
-rw-r--r-- | lib/stm32/f2/Makefile | 2 | ||||
-rw-r--r-- | lib/stm32/f3/Makefile | 2 | ||||
-rw-r--r-- | lib/stm32/f4/Makefile | 2 |
10 files changed, 13 insertions, 48 deletions
diff --git a/include/libopencm3/stm32/common/flash_common_f.h b/include/libopencm3/stm32/common/flash_common_f.h index 006e8ae0..fc400a7a 100644 --- a/include/libopencm3/stm32/common/flash_common_f.h +++ b/include/libopencm3/stm32/common/flash_common_f.h @@ -35,5 +35,10 @@ void flash_clear_eop_flag(void); */ void flash_clear_status_flags(void); +/** Wait until Last Operation has Ended. + * This loops indefinitely until an operation (write or erase) has completed by + * testing the busy flag + */ +void flash_wait_for_last_operation(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 42417931..f310fee1 100644 --- a/include/libopencm3/stm32/common/flash_common_f01.h +++ b/include/libopencm3/stm32/common/flash_common_f01.h @@ -105,7 +105,6 @@ BEGIN_DECLS void flash_clear_pgerr_flag(void); void flash_clear_wrprterr_flag(void); uint32_t flash_get_status_flags(void); -void flash_wait_for_last_operation(void); void flash_program_word(uint32_t address, uint32_t data); void flash_program_half_word(uint32_t address, uint16_t data); void flash_erase_page(uint32_t page_address); diff --git a/include/libopencm3/stm32/common/flash_common_f234.h b/include/libopencm3/stm32/common/flash_common_f234.h index e7377924..ae4d4637 100644 --- a/include/libopencm3/stm32/common/flash_common_f234.h +++ b/include/libopencm3/stm32/common/flash_common_f234.h @@ -75,8 +75,6 @@ BEGIN_DECLS -void flash_wait_for_last_operation(void); - END_DECLS /**@}*/ diff --git a/include/libopencm3/stm32/f7/flash.h b/include/libopencm3/stm32/f7/flash.h index 297cce55..451f5593 100644 --- a/include/libopencm3/stm32/f7/flash.h +++ b/include/libopencm3/stm32/f7/flash.h @@ -155,7 +155,6 @@ BEGIN_DECLS void flash_clear_pgperr_flag(void); -void flash_wait_for_last_operation(void); void flash_lock_option_bytes(void); void flash_clear_erserr_flag(void); diff --git a/include/libopencm3/stm32/l4/flash.h b/include/libopencm3/stm32/l4/flash.h index e324a92e..b883cf99 100644 --- a/include/libopencm3/stm32/l4/flash.h +++ b/include/libopencm3/stm32/l4/flash.h @@ -223,7 +223,6 @@ BEGIN_DECLS void flash_clear_pgperr_flag(void); -void flash_wait_for_last_operation(void); void flash_clear_pgserr_flag(void); void flash_clear_pgaerr_flag(void); void flash_clear_wrperr_flag(void); diff --git a/lib/stm32/common/flash_common_f234.c b/lib/stm32/common/flash_common_f234.c deleted file mode 100644 index d12baa29..00000000 --- a/lib/stm32/common/flash_common_f234.c +++ /dev/null @@ -1,40 +0,0 @@ -/** @addtogroup flash_file - * - */ - -/* - * This file is part of the libopencm3 project. - * - * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org> - * Copyright (C) 2010 Mark Butler <mbutler@physics.otago.ac.nz> - * - * 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/>. - */ - -/**@{*/ - -#include <libopencm3/stm32/flash.h> - -/*---------------------------------------------------------------------------*/ -/** @brief Wait until Last Operation has Ended - -This loops indefinitely until an operation (write or erase) has completed by -testing the busy flag. -*/ - -void flash_wait_for_last_operation(void) -{ - while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY); -} -/**@}*/ diff --git a/lib/stm32/common/flash_common_f24.c b/lib/stm32/common/flash_common_f24.c index 366c9e74..d6ae0d02 100644 --- a/lib/stm32/common/flash_common_f24.c +++ b/lib/stm32/common/flash_common_f24.c @@ -26,6 +26,11 @@ #include <libopencm3/stm32/flash.h> +void flash_wait_for_last_operation(void) +{ + while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY); +} + /*---------------------------------------------------------------------------*/ /** @brief Set the Program Parallelism Size diff --git a/lib/stm32/f2/Makefile b/lib/stm32/f2/Makefile index f6236aea..040566c2 100644 --- a/lib/stm32/f2/Makefile +++ b/lib/stm32/f2/Makefile @@ -45,7 +45,7 @@ OBJS += crc_common_all.o dac_common_all.o dma_common_f24.o \ timer_common_f24.o usart_common_all.o usart_common_f124.o \ hash_common_f24.o \ crypto_common_f24.o exti_common_all.o rcc_common_all.o -OBJS += flash_common_all.o flash_common_f.o flash_common_f234.o flash_common_f24.o +OBJS += flash_common_all.o flash_common_f.o flash_common_f24.o OBJS += flash_common_idcache.o OBJS += rng_common_v1.o OBJS += spi_common_all.o spi_common_v1.o spi_common_v1_frf.o diff --git a/lib/stm32/f3/Makefile b/lib/stm32/f3/Makefile index 304d5a5c..1c098e81 100644 --- a/lib/stm32/f3/Makefile +++ b/lib/stm32/f3/Makefile @@ -45,7 +45,7 @@ OBJS += gpio_common_all.o gpio_common_f0234.o \ timer_common_all.o timer_common_f0234.o \ exti_common_all.o rcc_common_all.o OBJS += adc_common_v2.o adc_common_v2_multi.o -OBJS += flash_common_all.o flash_common_f.o flash_common_f234.o +OBJS += flash_common_all.o flash_common_f.o OBJS += usart_common_v2.o usart_common_all.o OBJS += i2c_common_v2.o OBJS += spi_common_all.o spi_common_v2.o diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile index f0f34d5e..172aae06 100644 --- a/lib/stm32/f4/Makefile +++ b/lib/stm32/f4/Makefile @@ -50,7 +50,7 @@ OBJS += crc_common_all.o dac_common_all.o dma_common_f24.o \ usart_common_f124.o \ hash_common_f24.o crypto_common_f24.o exti_common_all.o \ rcc_common_all.o -OBJS += flash_common_all.o flash_common_f.o flash_common_f234.o flash_common_f24.o +OBJS += flash_common_all.o flash_common_f.o flash_common_f24.o OBJS += flash_common_idcache.o OBJS += rng_common_v1.o OBJS += spi_common_all.o spi_common_v1.o spi_common_v1_frf.o |