Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Flash.h
- Committer:
- chaithanyarss
- Date:
- 2016-07-11
- Revision:
- 255:642ea552ac77
- Parent:
- 52:0bd68655c651
File content as of revision 255:642ea552ac77:
#include "FreescaleIAP.h"
int strt_add = flash_size() - (4*SECTOR_SIZE);
uint32_t flasharray[256+(3*1024)];
char *nativeflash = (char*)strt_add;
/*Writing to the Flash*/
void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t block)
{
for(int64_t i=0;i<(256+(3*1024));i++)
{
flasharray[i]=nativeflash[i];
}
flasharray[j]=block;
erase_sector(strt_add);
program_flash(strt_add, (char*)&flasharray,4*(256+(1024*3)));
}
/*End*/
/*Reading from Flash*/
uint32_t FCTN_CDMS_RD_FLASH(uint16_t j)
{
for(int64_t i=0;i<(256+(3*1024));i++)
{
flasharray[i]=nativeflash[i];
}
return flasharray[j];
}
/*===================================================MMS Functions=================================================*/
void WRITE_TO_FLASH(uint8_t *);
void WRITE_TO_FLASH(uint8_t *flash)
{
uint32_t FLASH[5];
FLASH[0] = ((uint32_t)flash[0] << 24) | ((uint32_t)flash[1] << 16) | ((uint32_t)flash[2] << 8) | ((uint32_t)flash[3]);
FLASH[1] = ((uint32_t)flash[4] << 24) | ((uint32_t)flash[5] << 16) | ((uint32_t)flash[6] << 8) | ((uint32_t)flash[7]);
FLASH[2] = ((uint32_t)flash[8] << 24) | ((uint32_t)flash[9] << 16) | ((uint32_t)flash[10] << 8) | ((uint32_t)flash[11]);
FLASH[3] = ((uint32_t)flash[12] << 24) | ((uint32_t)flash[13] << 16) | ((uint32_t)flash[14] << 8) | ((uint32_t)flash[15]);
FLASH[4] = ((uint32_t)flash[16] << 24) | ((uint32_t)flash[17] << 16) | ((uint32_t)flash[18] << 8) | ((uint32_t)flash[19]);
erase_sector(strt_add);
program_flash(strt_add, (char*)FLASH,160);
}
