12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef __HAL_FLASH_H__
- #define __HAL_FLASH_H__
- /*************************************
- *INCLUDES
- */
- #include "bsp_flash.h"
- #include "app_step.h"
- #include "exception.h"
- #include "app_power.h"
- #include "nrf_gpio.h"
- #include "nrf_delay.h"
- #include "nrf_sdm.h"
- /*************************************
- *DEFINITION
- */
- //ERROR CODE
- #define ZONE_OP_SUCCESS 0x00 //ZONE操作成功
- #define ZONE_ERROR_NO_PAGE (ZONE_OP_SUCCESS+0x01) //需要分配的页数不够
- #define ZONE_ERROR_PARAM_PAGE_NUM (ZONE_OP_SUCCESS+0x02) //初始化分配的页数不能为0或小于0
- #define ZONE_ERROR_NO_INDEX (ZONE_OP_SUCCESS+0x03) //没有区域对应索引(没有申请对应区域)
- #define ZONE_ERROR_READ_FAIL (ZONE_OP_SUCCESS+0x04) //读取该区域失败
- #define ZONE_ERROR_WRITE_FAIL (ZONE_OP_SUCCESS+0x05) //写入该区域失败
- #define ZONE_ERROR_ERASE_FAIL (ZONE_OP_SUCCESS+0x06) //擦除该区域失败
- /********************************************
- *API FUCTIONS
- */
- //分配一个区域
- uint32_t Zone_Alloca(uint8_t page_num, uint32_t *zone_start_addr);
- //读取一个区域中指定位置的数据
- uint32_t Zone_Read(uint32_t destination_addr, uint32_t *pData, uint32_t dataLen);
- //往一个区域指定位置写入数据
- uint32_t Zone_Write(uint32_t destination_addr, uint32_t *pData, uint32_t dataLen);
- //擦除一个区域
- uint32_t Zone_Erase(uint32_t zone_start_addr);
- //获取一个区域的总字节大小
- uint32_t Zone_GetByteSize(uint32_t zone_start_addr, uint32_t *bytes);
- #endif
|