mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-30 00:14:15 +01:00
Fix verifyFlash()
This commit is contained in:
parent
fefd959e84
commit
ce4e26c686
@ -1793,17 +1793,26 @@ void blankcheck_Flash() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void verifyFlash() {
|
void verifyFlash() {
|
||||||
verifyFlash(0, 0);
|
verifyFlash(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyFlash(unsigned long verifyStart, unsigned long verifyEnd) {
|
void verifyFlash(byte romChips) {
|
||||||
if (openVerifyFlashFile()) {
|
if (openVerifyFlashFile()) {
|
||||||
blank = 0;
|
blank = 0;
|
||||||
|
|
||||||
if (verifyStart != 0)
|
if (romChips == 1) {
|
||||||
myFile.seekCur(verifyStart);
|
myFile.seekCur(0);
|
||||||
if (verifyEnd != 0)
|
// Truncate file to size of 1st flash chip
|
||||||
fileSize = verifyEnd;
|
if (fileSize > flashSize / 2) {
|
||||||
|
fileSize = flashSize / 2;
|
||||||
|
}
|
||||||
|
} else if (romChips == 2) {
|
||||||
|
if (fileSize > flashSize / 2) {
|
||||||
|
myFile.seekCur(flashSize / 2);
|
||||||
|
fileSize = fileSize - (flashSize / 2);
|
||||||
|
} else
|
||||||
|
fileSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
|
for (unsigned long currByte = 0; currByte < fileSize; currByte += 512) {
|
||||||
//fill sdBuffer
|
//fill sdBuffer
|
||||||
@ -2608,17 +2617,25 @@ void writeCFI_Flash(byte romChips) {
|
|||||||
// If we have two ROM chips only write half the ROM file here and skip to second half of file on second write
|
// If we have two ROM chips only write half the ROM file here and skip to second half of file on second write
|
||||||
if (romChips == 0) {
|
if (romChips == 0) {
|
||||||
println_Msg(F(""));
|
println_Msg(F(""));
|
||||||
} else if (romChips == 1) {
|
}
|
||||||
|
|
||||||
|
else if (romChips == 1) {
|
||||||
println_Msg(F(" 1/2"));
|
println_Msg(F(" 1/2"));
|
||||||
myFile.seekCur(0);
|
myFile.seekCur(0);
|
||||||
// Truncate file to size of 1st flash chip
|
// Truncate file to size of 1st flash chip
|
||||||
if (fileSize > flashSize / 2) {
|
if (fileSize > flashSize / 2) {
|
||||||
fileSize = flashSize / 2;
|
fileSize = flashSize / 2;
|
||||||
}
|
}
|
||||||
} else if (romChips == 2) {
|
}
|
||||||
|
|
||||||
|
else if (romChips == 2) {
|
||||||
println_Msg(F(" 2/2"));
|
println_Msg(F(" 2/2"));
|
||||||
myFile.seekCur(flashSize / 2);
|
if (fileSize > flashSize / 2) {
|
||||||
fileSize = fileSize - flashSize / 2;
|
myFile.seekCur(flashSize / 2);
|
||||||
|
fileSize = fileSize - (flashSize / 2);
|
||||||
|
} else {
|
||||||
|
fileSize = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
display_Update();
|
display_Update();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void reproCFIMenu() {
|
|||||||
flashSize = 4194304;
|
flashSize = 4194304;
|
||||||
// Write first rom chip
|
// Write first rom chip
|
||||||
writeCFI_Flash(1);
|
writeCFI_Flash(1);
|
||||||
verifyFlash(0, 2097152);
|
verifyFlash(1);
|
||||||
delay(300);
|
delay(300);
|
||||||
|
|
||||||
// Switch to second ROM chip, see flash.ino low level functions line 811
|
// Switch to second ROM chip, see flash.ino low level functions line 811
|
||||||
@ -121,7 +121,7 @@ void reproCFIMenu() {
|
|||||||
// Write second rom chip
|
// Write second rom chip
|
||||||
display_Clear();
|
display_Clear();
|
||||||
writeCFI_Flash(2);
|
writeCFI_Flash(2);
|
||||||
verifyFlash(2097152, 2097152);
|
verifyFlash(2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
Loading…
Reference in New Issue
Block a user