cdms_update

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of CDMS_SD_MNG_OVERDRIVE by saikiran cholleti

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Flash.cpp Source File

Flash.cpp

00001 #include "mbed.h"
00002 #include "FreescaleIAP.h"
00003 #include "Flash.h"
00004 
00005 int strt_add = flash_size() - (4*SECTOR_SIZE);  
00006 uint32_t flasharray[256+(3*1024)];
00007 char *nativeflash = (char*)strt_add;
00008 
00009 /*Writing to the Flash*/
00010 void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t block)
00011 {
00012     for(int64_t i=0;i<(256+(3*1024));i++)
00013     {
00014         flasharray[i]=nativeflash[i];
00015     }
00016     flasharray[j]=block;
00017     erase_sector(strt_add);
00018     program_flash(strt_add, (char*)&flasharray,4*(256+(1024*3)));
00019 }
00020 /*End*/
00021 
00022 /*Reading from Flash*/
00023 uint32_t FCTN_CDMS_RD_FLASH(uint16_t j)
00024 {
00025     for(int64_t i=0;i<(256+(3*1024));i++)
00026     {
00027         flasharray[i]=nativeflash[i];
00028     }
00029     return flasharray[j];
00030 }
00031 /*End*/