All pastes #45858 Raw Edit

Stuff

public text v1 · immutable
#45858 ·published 2006-03-15 22:51 UTC
rendered paste body
//read firmware settings
void load_PersonalData() {
  u32 src, count0, count1;

  // Find the settings area
  readFirmware(0x20, &src, 4);
  src = (src & 0xFFFF)*8;

  // Pick the most recent copy
  readFirmware(src+0x70, &count0, 4);
  readFirmware(src+0x170, &count1, 4);
  if ((u16)count0 < (u16)count1)
    src += 0x100;
		
  readFirmware(src, PersonalData, 0x80);
  if (swiCRC16(0xFFFF, PersonalData, 0x70) != ((u16*)PersonalData)[0x72/2]) //invalid / corrupt?
    readFirmware(src^0x100, PersonalData, 0x80);                            //try the older copy
}