bsp_flash.h 1002 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef __BSP_FLASH_H__
  2. #define __BSP_FLASH_H__
  3. //flash 1.0V
  4. /*********************************************************************
  5. * INCLUDES
  6. */
  7. #include "nrf_fstorage.h"
  8. #include "nrf_fstorage_sd.h"
  9. #include "nrf_pwr_mgmt.h"
  10. #include "nrf_soc.h"
  11. #include "nrf_log.h"
  12. #include "app_error.h"
  13. #include "SEGGER_RTT.h"
  14. #define FLASH_PAGE_SIZE 4096
  15. #define PAGE_INT_SIZE (FLASH_PAGE_SIZE/4) //一页所包含的4字节个数
  16. #define START_FSTORAGE_ADDR 0x00074000UL //FLASH起始地址
  17. #define END_FSTORAGE_ADDR 0x00078000UL //FLASH结束地址
  18. //ERROR CODE
  19. typedef enum{
  20. FLASH_OP_SUCCESS =0, //ZONE操作成功
  21. FLASH_ERROR_READ_FAIL, //读取该区域失败
  22. FLASH_ERROR_WRITE_FAIL, //写入该区域失败
  23. FLASH_ERROR_ERASE_FAIL, //擦除该区域失败
  24. FLASH_ERROR_ADDRESS_FAIL, //输入地址越界
  25. }flash_OPER_Result;
  26. flash_OPER_Result sdflash_write(uint32_t *p_dst, uint32_t const *p_src, uint32_t sizewords);
  27. flash_OPER_Result sdflash_page_erase(uint32_t page_addr);
  28. #endif