internal_flash.h 877 B

123456789101112131415161718192021222324
  1. #ifndef INTERNAL_FLASH_H
  2. #define INTERNAL_FLASH_H
  3. #include <stdint.h>
  4. /* 擦 APP 区前 ceil(len/128KB) 个扇区(Sector2 起, 跨 bank 自动分段)。0=OK */
  5. uint8_t int_flash_erase_app(uint32_t len);
  6. /* 32B flashword 编程(内部已对齐补齐+未擦检查)。返回码: 0=OK 1=地址错 2=编程错 3=未擦除 */
  7. uint8_t int_flash_program(uint32_t dst, const uint8_t *src, uint32_t len);
  8. /* 内部 Flash [addr,len) 流式 CRC32(zlib) */
  9. uint32_t int_flash_crc32(uint32_t addr, uint32_t len);
  10. /* 安全读取(带 cache 刷新) */
  11. void int_flash_read(uint32_t addr, uint8_t *out, uint32_t len);
  12. /* NOR -> 内部 Flash 整段烧录 */
  13. uint8_t int_flash_program_from_nor(uint32_t dst, uint32_t src_nor, uint32_t len);
  14. /* 内部 Flash -> NOR 整段备份 */
  15. uint8_t int_flash_backup_to_nor(uint32_t src, uint32_t dst_nor, uint32_t len);
  16. #endif /* INTERNAL_FLASH_H */