int test_eeprom(void) { u_int8 buf[PAGE_SIZE]; u_int8 answer[MEMORY_SIZE]; int i; int start_address; int error_code; printf ("Checking EEPROM page write\n"); for (start_address = 0; start_address < MEMORY_SIZE; start_address += PAGE_SIZE) { for (i=0; i < PAGE_SIZE; i++) { buf[i] = i + start_address; } if (error_code = write_eeprom_sector(start_address, buf, PAGE_SIZE)){ printf ("start address = %d ", start_address); return error_code; } } printf ("Checking EEPROM read\n"); if (error_code = check_eeprom_data(0)) return error_code; printf ("Checking EEPROM byte write\n"); for (start_address = MEMORY_SIZE-1; start_address >= 0; start_address--) { buf[0] = start_address + 128; if (error_code = write_eeprom_sector(start_address, buf, 1)){ printf ("address = %d ", start_address); return error_code; } } printf ("Checking EEPROM read\n"); if (error_code = check_eeprom_data(128)) return error_code; return 0; }