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.
This commit is contained in:
Karl Palsson 2018-07-24 22:43:08 +00:00
parent 659d52b952
commit ddc7ab8c6c
2 changed files with 17 additions and 9 deletions

View File

@ -222,8 +222,9 @@
BEGIN_DECLS BEGIN_DECLS
void flash_clear_pgperr_flag(void); void flash_clear_progerr_flag(void);
void flash_clear_pgserr_flag(void); void flash_clear_pgserr_flag(void);
void flash_clear_size_flag(void);
void flash_clear_pgaerr_flag(void); void flash_clear_pgaerr_flag(void);
void flash_clear_wrperr_flag(void); void flash_clear_wrperr_flag(void);
void flash_lock_option_bytes(void); void flash_lock_option_bytes(void);

View File

@ -42,13 +42,6 @@
#include <libopencm3/stm32/flash.h> #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 /** @brief Wait until Last Operation has Ended
* This loops indefinitely until an operation (write or erase) has completed * This loops indefinitely until an operation (write or erase) has completed
* by testing the busy flag. * by testing the busy flag.
@ -66,6 +59,12 @@ void flash_clear_pgserr_flag(void)
FLASH_SR |= FLASH_SR_PGSERR; 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 /** @brief Clear the Programming Alignment Error Flag
*/ */
void flash_clear_pgaerr_flag(void) void flash_clear_pgaerr_flag(void)
@ -80,15 +79,23 @@ void flash_clear_wrperr_flag(void)
FLASH_SR |= FLASH_SR_WRPERR; 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 /** @brief Clear All Status Flags
* Program error, end of operation, write protect error, busy. * Program error, end of operation, write protect error, busy.
*/ */
void flash_clear_status_flags(void) void flash_clear_status_flags(void)
{ {
flash_clear_pgserr_flag(); flash_clear_pgserr_flag();
flash_clear_size_flag();
flash_clear_pgaerr_flag(); flash_clear_pgaerr_flag();
flash_clear_wrperr_flag(); flash_clear_wrperr_flag();
flash_clear_pgperr_flag(); flash_clear_progerr_flag();
flash_clear_eop_flag(); flash_clear_eop_flag();
} }