diff --git a/include/libopencm3/stm32/g0/flash.h b/include/libopencm3/stm32/g0/flash.h index d79f891b..cc667d9c 100644 --- a/include/libopencm3/stm32/g0/flash.h +++ b/include/libopencm3/stm32/g0/flash.h @@ -178,13 +178,19 @@ BEGIN_DECLS +/** Enable instruction cache */ void flash_icache_enable(void); +/** Disable instruction cache */ void flash_icache_disable(void); +/** Reset instruction cache */ void flash_icache_reset(void); +/** Unlock program memory */ void flash_unlock_progmem(void); +/** lock program memory */ void flash_lock_progmem(void); +/** Lock Option Byte Access */ void flash_lock_option_bytes(void); END_DECLS diff --git a/lib/stm32/g0/flash.c b/lib/stm32/g0/flash.c index 78e4d7d8..3356fc9d 100644 --- a/lib/stm32/g0/flash.c +++ b/lib/stm32/g0/flash.c @@ -30,51 +30,43 @@ #include -/* @brief Enable instruction cache */ void flash_icache_enable(void) { FLASH_ACR |= FLASH_ACR_ICEN; } -/* @brief Disable instruction cache */ void flash_icache_disable(void) { FLASH_ACR &= ~FLASH_ACR_ICEN; } -/* @brief Reset instruction cache */ void flash_icache_reset(void) { FLASH_ACR |= FLASH_ACR_ICRST; } -/* @brief Unlock program memory */ void flash_unlock_progmem(void) { FLASH_KEYR = FLASH_KEYR_KEY1; FLASH_KEYR = FLASH_KEYR_KEY2; } -/* @brief lock program memory */ void flash_lock_progmem(void) { FLASH_CR |= FLASH_CR_LOCK; } -/* @brief Lock Option Byte Access */ void flash_lock_option_bytes(void) { FLASH_CR |= FLASH_CR_OPTLOCK; } -/* @brief Unlock all segments of flash */ void flash_unlock(void) { flash_unlock_progmem(); flash_unlock_option_bytes(); } -/* @brief Lock all segments of flash */ void flash_lock(void) { flash_lock_option_bytes();