12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "interFlash.h"
- #include "nwy_file.h"
- #define flash_addr 0x607b0000
- static nwyspiflash_t *interFp = NULL;
- /*初始化内部FLASH接口*/
- bool interFlashInit(void){
- nwyspiflash_t *fp=NULL;
- if(NULL!=interFp) return true;
- fp==nwy_flash_open(NAME_FLASH_1);
- if(NULL==fp) return false;
- interFp=fp;
- return true;
- }
- /*擦出内部FLASH接口*/
- bool interFlashErace(unsigned int flash_addr, int size){
- if(NULL==interFp) return false;
- return nwy_flash_erase(interFp,flash_addr, size);
- }
- /*写内部FLASH接口*/
- bool interFlashWrite(unsigned int flash_addr, unsigned char *data_ptr, int size){
- if(NULL==interFp) return false;
- return nwy_flash_write(interFp,flash_addr, data_ptr, size);
- }
- /*读内部FLASH接口*/
- bool interFlashRead(unsigned int flash_addr, unsigned char *data_ptr, int size){
- if(NULL==interFp) return false;
- return nwy_flash_read(interFp, flash_addr, data_ptr, size);
- }
- char interFlashTest(void){
- if(false==interFlashInit()) return 1;
- if(false==interFlashErace(
- }
|