vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
Flash.cpp
- Committer:
- pradeepvk2208
- Date:
- 2015-07-04
- Revision:
- 10:2c8b9ebc79e9
- Parent:
- 8:607ae92fa6af
- Child:
- 11:d6dc9074075b
File content as of revision 10:2c8b9ebc79e9:
#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]; }