void eefill(uint8_t fillPattern)
{
uint32_t i, j, z;
z = (fillPattern << 24 |
fillPattern << 16 |
fillPattern << 8|
fillPattern << 0 );
for (i = 0; i < EE_SIZE; i+=16)
{
for (j = 0; j < 16; j+=4)
{
writeEEPROM( (uint8_t*) i + j,
(uint8_t*) &z, sizeof(z));
}
}
} |
i = 0x00006000; writeEEPROM( (uint8_t*) i, (uint8_t*) &z, sizeof(z)); |
case 4:
{
uint8_t* adr = 12;
writeEEPROM((uint8_t *) adr, &z, sizeof(z));
} |
union{
struct{
unsigned int AM :24;
}dayAM;
struct{
unsigned int PM :24;
}dayPM;
}tDay[7]; |
SaveIntoFlashINT(F_DRZAVA, 0); |
SaveIntoFlashINT(count, 0); |
void SaveIntoFlashINT(void* naslov, void* input_data){
unsigned int cfs = ((unsigned int)naslov >> 12);
unsigned int cfss = 1;
static uint32_t prestavljen_data = 0;
//#define CONFIG_FLASH_SECTOR_SIZE 1
// Prepare the sector for erase
iap_status = (__e_iap_status) iap_prepare_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
// Erase the sector
iap_status = (__e_iap_status) iap_erase_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
// Prepare the sector for writing
iap_status = (__e_iap_status) iap_prepare_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
prestavljen_data = input_data;
// write data to flash
iap_status = (__e_iap_status) iap_copy_ram_to_flash(&prestavljen_data,
(void *)naslov, 256);
if (iap_status != CMD_SUCCESS) while(1);
} |
SaveIntoFlashINT(F_DRZAVA, 0); |
SaveIntoFlashINT(count, 0); |
void SaveIntoFlashINT(void* naslov, void* input_data){
unsigned int cfs = ((unsigned int)naslov >> 12);
unsigned int cfss = 1;
static uint32_t prestavljen_data = 0;
//#define CONFIG_FLASH_SECTOR_SIZE 1
// Prepare the sector for erase
iap_status = (__e_iap_status) iap_prepare_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
// Erase the sector
iap_status = (__e_iap_status) iap_erase_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
// Prepare the sector for writing
iap_status = (__e_iap_status) iap_prepare_sector(cfs,
(cfs + cfss));
if (iap_status != CMD_SUCCESS) while(1);
prestavljen_data = input_data;
// write data to flash
iap_status = (__e_iap_status) iap_copy_ram_to_flash(&prestavljen_data,
(void *)naslov, 256);
if (iap_status != CMD_SUCCESS) while(1);
} |
static uint8_t input_data; |
static uint8_t input_data; |
SRC_ADDR_ERROR, |
st = * ((uint8_t *) 0x00006000); |
static uint8_t demo_messg = 123; |
#define CONFIG_FLASH_OFFSET 0x00006000 |
#define CONFIG_FLASH_OFFSET 0x61A8 |