diff options
author | Karl Palsson <karlp@tweak.net.au> | 2018-07-25 01:43:08 +0300 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2018-07-29 23:31:17 +0300 |
commit | ddc7ab8c6cdecda1c071513147a0b67f66c2a5d1 (patch) | |
tree | 81906c08f46071b591f2c9eeb2bb1b13bb6c3ea9 | |
parent | 659d52b952e04023b006bbef7f7d2afa4a9c821b (diff) |
stm32l4: flash: don't use misleading names
flash_clear_pgperr_flag is a name used on f247, which is actually most
analogous to the SIZERR bit on l4, (it's a parallelism error)
the bit being cleared originally in this function, PROGERR is a new bit,
and should have it's own name.
Add a function to handle the previously unhandled size/parallelism flag,
and rename the existing one to properly reflect it's new name.
-rw-r--r-- | include/libopencm3/stm32/l4/flash.h | 3 | ||||
-rw-r--r-- | lib/stm32/l4/flash.c | 23 |
2 files changed, 17 insertions, 9 deletions
diff --git a/include/libopencm3/stm32/l4/flash.h b/include/libopencm3/stm32/l4/flash.h index b883cf99..5f1dddef 100644 --- a/include/libopencm3/stm32/l4/flash.h +++ b/include/libopencm3/stm32/l4/flash.h @@ -222,8 +222,9 @@ BEGIN_DECLS -void flash_clear_pgperr_flag(void); +void flash_clear_progerr_flag(void); void flash_clear_pgserr_flag(void); +void flash_clear_size_flag(void); void flash_clear_pgaerr_flag(void); void flash_clear_wrperr_flag(void); void flash_lock_option_bytes(void); diff --git a/lib/stm32/l4/flash.c b/lib/stm32/l4/flash.c index e32142d5..58374b29 100644 --- a/lib/stm32/l4/flash.c +++ b/lib/stm32/l4/flash.c @@ -42,13 +42,6 @@ #include <libopencm3/stm32/flash.h> -/** @brief Clear the Programming Error Status Flag - */ -void flash_clear_pgperr_flag(void) -{ - FLASH_SR |= FLASH_SR_PROGERR; -} - /** @brief Wait until Last Operation has Ended * This loops indefinitely until an operation (write or erase) has completed * by testing the busy flag. @@ -66,6 +59,12 @@ void flash_clear_pgserr_flag(void) FLASH_SR |= FLASH_SR_PGSERR; } +/** Clear programming size error flag */ +void flash_clear_size_flag(void) +{ + FLASH_SR |= FLASH_SR_SIZERR; +} + /** @brief Clear the Programming Alignment Error Flag */ void flash_clear_pgaerr_flag(void) @@ -80,15 +79,23 @@ void flash_clear_wrperr_flag(void) FLASH_SR |= FLASH_SR_WRPERR; } +/** @brief Clear the Programming Error Status Flag + */ +void flash_clear_progerr_flag(void) +{ + FLASH_SR |= FLASH_SR_PROGERR; +} + /** @brief Clear All Status Flags * Program error, end of operation, write protect error, busy. */ void flash_clear_status_flags(void) { flash_clear_pgserr_flag(); + flash_clear_size_flag(); flash_clear_pgaerr_flag(); flash_clear_wrperr_flag(); - flash_clear_pgperr_flag(); + flash_clear_progerr_flag(); flash_clear_eop_flag(); } |