Fix CFG and UES

This commit is contained in:
rhgndf 2023-09-16 20:34:47 +08:00
parent 4145612445
commit 87a77ad4af

View File

@ -1253,7 +1253,7 @@ static void readGalFuseMap(const unsigned char* cfgArray, char useDelay, char do
if (doDiscardBits) { if (doDiscardBits) {
discardBits(doDiscardBits); discardBits(doDiscardBits);
} }
for(bit = 0; bit < 64; bit++) { for(bit = 0; bit < galinfo[gal].uesbytes * 8; bit++) {
if (receiveBit()) { if (receiveBit()) {
addr = galinfo[gal].uesfuse; addr = galinfo[gal].uesfuse;
addr += bit; addr += bit;
@ -1467,10 +1467,15 @@ static void readOrVerifyGal(char verify)
case ATF22V10C: case ATF22V10C:
//read with delay 1 ms, discard 68 cfg bits on ATFxx //read with delay 1 ms, discard 68 cfg bits on ATFxx
bool isGAL = (gal == GAL20XV10 || gal == GAL22V10); bool isGAL = (gal == GAL20XV10 || gal == GAL22V10);
if (verify) { if (gal == GAL20XV10) {
i = verifyGalFuseMap(cfgV10, 1, isGAL ? 0 : 68); cfgArray = (unsigned char*) cfgXV10;
} else { } else {
readGalFuseMap(cfgV10, 1, isGAL ? 0 : 68); cfgArray = (unsigned char*) cfgV10;
}
if (verify) {
i = verifyGalFuseMap(cfgArray, 1, isGAL ? 0 : 68);
} else {
readGalFuseMap(cfgArray, 1, isGAL ? 0 : 68);
} }
break; break;
} }
@ -1554,7 +1559,7 @@ static void writeGalFuseMapV10(const unsigned char* cfgArray, char fillUesStart,
if (fillUesStart) { if (fillUesStart) {
sendBits(68, 1); sendBits(68, 1);
} }
for (bit = 0; bit < 64; bit++) { for (bit = 0; bit < galinfo[gal].uesbytes * 8; bit++) {
addr = galinfo[gal].uesfuse; addr = galinfo[gal].uesfuse;
addr += bit; addr += bit;
sendBit(getFuseBit(addr)); sendBit(getFuseBit(addr));
@ -1616,8 +1621,13 @@ static void writeGal()
case GAL22V10: case GAL22V10:
case ATF22V10B: case ATF22V10B:
case ATF22V10C: case ATF22V10C:
bool isGAL = (gal == GAL20XV10 || gal == GAL22V10); bool isGAL = (gal == GAL22V10);
writeGalFuseMapV10(cfgV10, isGAL ? 0 : 1, isGAL ? 1 : 0); if (gal == GAL20XV10) {
cfgArray = (unsigned char*) cfgXV10;
} else {
cfgArray = (unsigned char*) cfgV10;
}
writeGalFuseMapV10(cfgArray, isGAL ? 0 : 1, (gal == ATF22V10C) ? 1 : 0);
break; break;
} }
turnOff(); turnOff();