stm32f3: flash_common_f24 now includes f3 support. Also, renamed to f234.

- Makefiles of other stm32s updated accordingly.
- f3/rcc.c updated to some definition changes.
- f3/flash.c removed in order to use flash_common_f234.c to comply with new organization.
This commit is contained in:
Federico Ruiz Ugalde
2013-06-26 04:44:47 -06:00
committed by Piotr Esden-Tempski
parent 74a313625f
commit efe08e4898
11 changed files with 98 additions and 323 deletions

View File

@@ -20,6 +20,7 @@
#include <libopencm3/stm32/flash.h>
#if !defined(STM32F3)
static inline void flash_set_program_size(uint32_t psize)
{
FLASH_CR &= ~(((1 << 0) | (1 << 1)) << 8);
@@ -66,6 +67,24 @@ void flash_icache_reset(void)
FLASH_ACR |= FLASH_ACR_ICRST;
}
void flash_clear_pgserr_flag(void)
{
FLASH_SR |= FLASH_SR_PGSERR;
}
void flash_clear_pgaerr_flag(void)
{
FLASH_SR |= FLASH_SR_PGAERR;
}
void flash_clear_wrperr_flag(void)
{
FLASH_SR |= FLASH_SR_WRPERR;
}
#endif
void flash_set_ws(uint32_t ws)
{
uint32_t reg32;
@@ -91,31 +110,16 @@ void flash_lock(void)
FLASH_CR |= FLASH_CR_LOCK;
}
void flash_clear_pgserr_flag(void)
{
FLASH_SR |= FLASH_SR_PGSERR;
}
void flash_clear_pgperr_flag(void)
{
FLASH_SR |= FLASH_SR_PGPERR;
}
void flash_clear_pgaerr_flag(void)
{
FLASH_SR |= FLASH_SR_PGAERR;
}
void flash_clear_eop_flag(void)
{
FLASH_SR |= FLASH_SR_EOP;
}
void flash_clear_wrperr_flag(void)
{
FLASH_SR |= FLASH_SR_WRPERR;
}
void flash_clear_bsy_flag(void)
{
FLASH_SR &= ~FLASH_SR_BSY;
@@ -123,14 +127,23 @@ void flash_clear_bsy_flag(void)
void flash_clear_status_flags(void)
{
#if !defined(STM32F3)
flash_clear_pgserr_flag();
flash_clear_pgperr_flag();
flash_clear_pgaerr_flag();
flash_clear_eop_flag();
flash_clear_wrperr_flag();
#endif
flash_clear_pgperr_flag();
flash_clear_eop_flag();
flash_clear_bsy_flag();
}
void flash_wait_for_last_operation(void)
{
while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY);
}
#if !defined(STM32F3)
void flash_unlock_option_bytes(void)
{
/* Clear the unlock state. */
@@ -146,11 +159,6 @@ void flash_lock_option_bytes(void)
FLASH_OPTCR |= FLASH_OPTCR_OPTLOCK;
}
void flash_wait_for_last_operation(void)
{
while ((FLASH_SR & FLASH_SR_BSY) == FLASH_SR_BSY);
}
void flash_program_double_word(uint32_t address, uint64_t data)
{
/* Ensure that all flash operations are complete. */
@@ -267,3 +275,5 @@ void flash_program_option_bytes(uint32_t data)
FLASH_OPTCR |= FLASH_OPTCR_OPTSTRT; /* Enable option byte prog. */
flash_wait_for_last_operation();
}
#endif