stm32_flash.h 643 B

123456789101112131415161718192021222324252627
  1. struct stm32_flash_regs {
  2. u32 acr;
  3. u32 key;
  4. u32 optkeyr;
  5. u32 sr;
  6. u32 cr;
  7. u32 optcr;
  8. u32 optcr1;
  9. };
  10. #define STM32_FLASH_KEY1 0x45670123
  11. #define STM32_FLASH_KEY2 0xCDEF89AB
  12. #define STM32_FLASH_SR_BSY (1 << 16)
  13. #define STM32_FLASH_CR_PG (1 << 0)
  14. #define STM32_FLASH_CR_SER (1 << 1)
  15. #define STM32_FLASH_CR_STRT (1 << 16)
  16. #define STM32_FLASH_CR_LOCK (1 << 31)
  17. #define STM32_FLASH_CR_SNB_OFFSET 3
  18. #define STM32_FLASH_CR_SNB_MASK (15 << STM32_FLASH_CR_SNB_OFFSET)
  19. /* Flash ACR: Access control register */
  20. #define FLASH_ACR_WS(n) n
  21. #define FLASH_ACR_PRFTEN (1 << 8)
  22. #define FLASH_ACR_ICEN (1 << 9)
  23. #define FLASH_ACR_DCEN (1 << 10)