1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #ifndef NRF_FLASH_H__
- #define NRF_FLASH_H__
- #include <stdbool.h>
- #include <stdio.h>
- #include <stdint.h>
- #include "boards.h"
- #include "bsp.h"
- #ifndef FLASH_PAGE_SIZE
- #define FLASH_PAGE_SIZE 4096
- #endif
- #define FLASH_BASE_ADDRESS 0x6D000
- #define FLASH_SIZE (FLASH_PAGE_SIZE<<1)
- enum {
- WSYS_FLASH_OK = 0,
- WSYS_FLASH_INVALID_ADDRESS,
- WSYS_FLASH_INVALID_LENGTH
- };
- /*******************************************************************
- * Function Nume: flash_write_data
- * Descriptions : write data from flash
- * In Para : address: address to access(address must be word-aligned), length: length to be read(4 integer multiple)
- * In-Out Para : none
- * Out Para : data: data buffer to be read
- * Return Value : FLASH_SUCCESS: success, FLASH_ERROR_INVALID_ADDRESS: address error
- *******************************************************************/
- uint8_t flash_write_data(uint32_t address, uint8_t *data, uint16_t length);
- /*******************************************************************
- * Function Nume: flash_read_data
- * Descriptions : read data from flash
- * In Para : address: address to access(align=2), length: length to be read(4 integer multiple)
- * In-Out Para : none
- * Out Para : data: data buffer to be read
- * Return Value : FLASH_SUCCESS: success, FLASH_ERROR_INVALID_ADDRESS: address error
- *******************************************************************/
- uint8_t flash_read_data(uint32_t address, uint32_t *data, uint16_t length);
- /*******************************************************************
- * Function Nume: flash_erase_data
- * Descriptions : erase flash data
- * In Para : address: address to access(align=2), length: length to be erased(4 integer multiple)
- * In-Out Para : none
- * Out Para : none
- * Return Value : FLASH_SUCCESS: success, FLASH_ERROR_INVALID_ADDRESS: address error
- *******************************************************************/
- uint8_t flash_erase_data(uint32_t address, uint16_t length);
- #endif //NRF_FLASH_H__
|