vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
Diff: Flash.cpp
- Revision:
- 10:2c8b9ebc79e9
- Parent:
- 8:607ae92fa6af
- Child:
- 11:d6dc9074075b
--- a/Flash.cpp Sat Jul 04 09:44:31 2015 +0000 +++ b/Flash.cpp Sat Jul 04 10:48:18 2015 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" +#include "FreescaleIAP.h" + +//--------------------------------------in bae init : + + int strt_add = flash_size() - (4*SECTOR_SIZE); + + uint32_t flasharray[256+(3*1024)]; + + char *nativeflash = (char*)strt_add; + + + //--------------------------WRITING AND READING FLASH--------------------------------------------------------------------------------// + + void P_BAE_WRFLASH() + { + erase_sector(strt_add); + program_flash(strt_add, (char*)&flasharray,4*(256+(1024*3))); + + } + void P_BAE_RDFLASH() + { + for(int64_t i=0;i<(256+(3*1024));i++)flasharray[i]=nativeflash[i]; + } +int P_CDMS_WRITEBLOCK(int i,uint32_t block) +{ P_BAE_RDFLASH(); + flasharray[i]=block; + P_BAE_WRFLASH(); + return 0; +} + +uint32_t P_CDMS_READBLOCK(int i) +{ P_BAE_RDFLASH(); + return flasharray[i]; +} \ No newline at end of file