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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,16 +59,6 @@ void flash_clear_pgerr_flag(void)
|
||||
FLASH_SR |= FLASH_SR_PGERR;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @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
|
||||
|
||||
|
||||
@@ -55,17 +55,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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user