stm32f3: flash: add prefetch helpers

Should be added to f2/f4 as well, but the bit definitions are different.
This commit is contained in:
Karl Palsson 2018-04-30 23:29:07 +00:00
parent f0e128673d
commit 389ec82538
2 changed files with 29 additions and 0 deletions

View File

@ -67,6 +67,14 @@
#define FLASH_CR_MER (1 << 2)
#define FLASH_CR_PER (1 << 1)
#define FLASH_CR_PG (1 << 0)
BEGIN_DECLS
void flash_prefetch_enable(void);
void flash_prefetch_disable(void);
END_DECLS
/**@}*/
#endif

View File

@ -58,5 +58,26 @@ void flash_clear_status_flags(void)
flash_clear_eop_flag();
flash_clear_bsy_flag();
}
/**
* Enable the FLASH Prefetch Buffer
* This buffer is used for instruction fetches and is enabled by default after
* reset.
*/
void flash_prefetch_enable(void)
{
FLASH_ACR |= FLASH_ACR_PRFTBE;
}
/**
* Disable the FLASH Prefetch Buffer
* This buffer is used for instruction fetches and is enabled by default after
* reset.
*/
void flash_prefetch_disable(void)
{
FLASH_ACR &= ~FLASH_ACR_PRFTBE;
}
/**@}*/