Support ATF20V8B

This commit is contained in:
rhgndf 2023-10-30 22:13:25 +08:00
parent 13bc7bdad9
commit ab9fa88437
2 changed files with 23 additions and 4 deletions

View File

@ -150,6 +150,7 @@ typedef enum {
GAL6001, GAL6001,
GAL6002, GAL6002,
ATF16V8B, ATF16V8B,
ATF20V8B,
ATF22V10B, ATF22V10B,
ATF22V10C, ATF22V10C,
LAST_GAL_TYPE //dummy LAST_GAL_TYPE //dummy
@ -301,6 +302,7 @@ galinfo[]=
{GAL6001, 0x40, 0x41, 8294, 24, 78, 75, 97, 8222, 9, 63, 62, 96, 8, 8, CFG_BASE_600 , cfg6001, sizeof(cfg6001) , CFG_SET_ROW }, {GAL6001, 0x40, 0x41, 8294, 24, 78, 75, 97, 8222, 9, 63, 62, 96, 8, 8, CFG_BASE_600 , cfg6001, sizeof(cfg6001) , CFG_SET_ROW },
{GAL6002, 0x44, 0x44, 8330, 24, 78, 75, 97, 8258, 9, 63, 62, 96, 8, 8, CFG_BASE_600 , cfg6002, sizeof(cfg6002) , CFG_SET_ROW }, {GAL6002, 0x44, 0x44, 8330, 24, 78, 75, 97, 8258, 9, 63, 62, 96, 8, 8, CFG_BASE_600 , cfg6002, sizeof(cfg6002) , CFG_SET_ROW },
{ATF16V8B, 0x00, 0x00, 2194, 20, 32, 64, 32, 2056, 8, 63, 62, 58, 8, 60, CFG_BASE_16 , cfgV8AB, sizeof(cfgV8AB) , CFG_STROBE_ROW}, {ATF16V8B, 0x00, 0x00, 2194, 20, 32, 64, 32, 2056, 8, 63, 62, 58, 8, 60, CFG_BASE_16 , cfgV8AB, sizeof(cfgV8AB) , CFG_STROBE_ROW},
{ATF20V8B, 0x00, 0x00, 2706, 24, 40, 64, 40, 2568, 8, 63, 62, 58, 8, 60, CFG_BASE_20 , cfgV8AB, sizeof(cfgV8AB) , CFG_STROBE_ROW},
{ATF22V10B, 0x00, 0x00, 5892, 24, 44, 132, 44, 5828, 8, 61, 62, 58, 10, 16, CFG_BASE_22 , cfgV10, sizeof(cfgV10) , CFG_SET_ROW }, {ATF22V10B, 0x00, 0x00, 5892, 24, 44, 132, 44, 5828, 8, 61, 62, 58, 10, 16, CFG_BASE_22 , cfgV10, sizeof(cfgV10) , CFG_SET_ROW },
{ATF22V10C, 0x00, 0x00, 5892, 24, 44, 132, 44, 5828, 8, 61, 62, 58, 10, 16, CFG_BASE_22 , cfgV10, sizeof(cfgV10) , CFG_SET_ROW }, {ATF22V10C, 0x00, 0x00, 5892, 24, 44, 132, 44, 5828, 8, 61, 62, 58, 10, 16, CFG_BASE_22 , cfgV10, sizeof(cfgV10) , CFG_SET_ROW },
}; };
@ -381,6 +383,7 @@ static void setPinMux(uint8_t pm) {
break; break;
case GAL20V8: case GAL20V8:
case ATF20V8B:
pinMode(PIN_ZIF10, pm); pinMode(PIN_ZIF10, pm);
pinMode(PIN_ZIF11, pm); pinMode(PIN_ZIF11, pm);
pinMode(PIN_ZIF13, pm); pinMode(PIN_ZIF13, pm);
@ -745,7 +748,7 @@ static void setVPP(char on) {
// when PES is read the VPP is not determined via PES // when PES is read the VPP is not determined via PES
if (on == READPES) { if (on == READPES) {
if (gal == ATF16V8B || gal == ATF22V10B || gal == ATF22V10B) { if (gal == ATF16V8B || gal == ATF20V8B || gal == ATF22V10B || gal == ATF22V10B) {
v = VPP_10V0; v = VPP_10V0;
} else { } else {
v = VPP_11V5; v = VPP_11V5;
@ -963,6 +966,10 @@ static void sendBit(char bitValue, char skipClkLow = 0)
{ {
setSDIN(bitValue); setSDIN(bitValue);
setSCLK(1); setSCLK(1);
// For some reason ATF20V8B needs a slower clock
if (gal == ATF20V8B) {
delay(1);
}
if (!skipClkLow) { if (!skipClkLow) {
setSCLK(0); setSCLK(0);
} }
@ -1015,6 +1022,7 @@ static void strobeRow(char row, char setBit = BIT_NONE)
switch(gal) { switch(gal) {
case GAL16V8: case GAL16V8:
case GAL20V8: case GAL20V8:
case ATF20V8B:
case ATF16V8B: case ATF16V8B:
setRow(row); // set RA0-5 to row number setRow(row); // set RA0-5 to row number
if (setBit) { if (setBit) {
@ -1084,7 +1092,7 @@ static void writePes(void) {
uint8_t rbit; uint8_t rbit;
uint8_t b, p; uint8_t b, p;
if (gal == ATF16V8B || gal == ATF22V10B || gal == ATF22V10C) { if (gal == ATF16V8B || gal == ATF20V8B || gal == ATF22V10B || gal == ATF22V10C) {
Serial.println(F("ER write PES not supported")); Serial.println(F("ER write PES not supported"));
return; return;
} }
@ -1136,7 +1144,7 @@ static unsigned char getDuration(unsigned char index) {
} }
static void setGalDefaults(void) { static void setGalDefaults(void) {
if (gal == ATF16V8B || gal == ATF22V10B || gal == ATF22V10C) { if (gal == ATF16V8B || gal == ATF20V8B || gal == ATF22V10B || gal == ATF22V10C) {
progtime = 20; progtime = 20;
erasetime = 100; erasetime = 100;
vpp = 40; /* 10V */ vpp = 40; /* 10V */
@ -1161,6 +1169,7 @@ void parsePes(char type) {
switch (type) { switch (type) {
case ATF16V8B: case ATF16V8B:
case ATF20V8B:
case ATF22V10B: case ATF22V10B:
case ATF22V10C: case ATF22V10C:
progtime = 20; progtime = 20;
@ -1267,6 +1276,7 @@ void printPes(char type) {
case GAL6001: Serial.print(F("GAL6001 ")); break; case GAL6001: Serial.print(F("GAL6001 ")); break;
case GAL6002: Serial.print(F("GAL6002 ")); break; case GAL6002: Serial.print(F("GAL6002 ")); break;
case ATF16V8B: Serial.print(0 == (flagBits & FLAG_BIT_ATF16V8C) ? F("ATF16V8B "): F("ATF16V8C ")); break; case ATF16V8B: Serial.print(0 == (flagBits & FLAG_BIT_ATF16V8C) ? F("ATF16V8B "): F("ATF16V8C ")); break;
case ATF20V8B: Serial.print(F("ATF20V8B ")); break;
case ATF22V10B: Serial.print(F("ATF22V10B ")); break; case ATF22V10B: Serial.print(F("ATF22V10B ")); break;
case ATF22V10C: Serial.print(F("ATF22V10C ")); break; case ATF22V10C: Serial.print(F("ATF22V10C ")); break;
} }
@ -1696,6 +1706,7 @@ static void readOrVerifyGal(char verify)
break; break;
case ATF16V8B: case ATF16V8B:
case ATF20V8B:
//read without delay, no discard //read without delay, no discard
if (verify) { if (verify) {
i = verifyGalFuseMap(cfgV8AB, 0, 0); i = verifyGalFuseMap(cfgV8AB, 0, 0);
@ -1703,7 +1714,7 @@ static void readOrVerifyGal(char verify)
readGalFuseMap(cfgV8AB, 0, 0); readGalFuseMap(cfgV8AB, 0, 0);
} }
break; break;
case GAL6001: case GAL6001:
case GAL6002: case GAL6002:
cfgArray = (gal == GAL6001) ? (unsigned char*) cfg6001 : (unsigned char*) cfg6002; cfgArray = (gal == GAL6001) ? (unsigned char*) cfg6001 : (unsigned char*) cfg6002;
@ -1934,6 +1945,7 @@ static void writeGal()
break; break;
case ATF16V8B: case ATF16V8B:
case ATF20V8B:
writeGalFuseMapV8(cfgV8AB); writeGalFuseMapV8(cfgV8AB);
break; break;
@ -1991,6 +2003,7 @@ static void secureGAL(void)
static char checkGalTypeViaPes(void) static char checkGalTypeViaPes(void)
{ {
char type = UNKNOWN; char type = UNKNOWN;
static const char PROGMEM pesATF20V8B[] = "0B8V02F1";
#ifdef DEBUG_PES #ifdef DEBUG_PES
char i; char i;
@ -2010,6 +2023,9 @@ static char checkGalTypeViaPes(void)
type = ATF22V10C; type = ATF22V10C;
} }
} }
else if (strncmp_P((const char*)pes, pesATF20V8B, 8) == 0) {
type = ATF20V8B;
}
else if (pes[6] == 'F' && pes[5] == '1' && pes[4]== '6' && pes[3] == 'V' && pes[2]=='8') { else if (pes[6] == 'F' && pes[5] == '1' && pes[4]== '6' && pes[3] == 'V' && pes[2]=='8') {
type = ATF16V8B; type = ATF16V8B;
if (pes[1] == 'C' || pes[1] == 'Z') { // ATF16V8C, ATF16V8CZ if (pes[1] == 'C' || pes[1] == 'Z') { // ATF16V8C, ATF16V8CZ
@ -2140,6 +2156,7 @@ static void printGalName() {
Serial.println(F("ATF16V8B")); Serial.println(F("ATF16V8B"));
} }
break; break;
case ATF20V8B: Serial.println(F("ATF20V8B")); break;
case ATF22V10B: Serial.println(F("ATF22V10B")); break; case ATF22V10B: Serial.println(F("ATF22V10B")); break;
case ATF22V10C: Serial.println(F("ATF22V10C")); break; case ATF22V10C: Serial.println(F("ATF22V10C")); break;
default: Serial.println(F("GAL")); break; default: Serial.println(F("GAL")); break;

View File

@ -62,6 +62,7 @@ typedef enum {
GAL6001, GAL6001,
GAL6002, GAL6002,
ATF16V8B, ATF16V8B,
ATF20V8B,
ATF22V10B, ATF22V10B,
ATF22V10C ATF22V10C
} Galtype; } Galtype;
@ -95,6 +96,7 @@ galinfo[] = {
{GAL6001, 0x40, 0x41, "GAL6001", 8294, 24, 78, 75, 97, 8222, 9, 63, 62, 96, 8, 8, 68}, {GAL6001, 0x40, 0x41, "GAL6001", 8294, 24, 78, 75, 97, 8222, 9, 63, 62, 96, 8, 8, 68},
{GAL6002, 0x44, 0x44, "GAL6002", 8330, 24, 78, 75, 97, 8258, 9, 63, 62, 96, 8, 8, 104}, {GAL6002, 0x44, 0x44, "GAL6002", 8330, 24, 78, 75, 97, 8258, 9, 63, 62, 96, 8, 8, 104},
{ATF16V8B, 0x00, 0x00, "ATF16V8B", 2194, 20, 32, 64, 32, 2056, 8, 63, 54, 58, 8, 60, 82}, {ATF16V8B, 0x00, 0x00, "ATF16V8B", 2194, 20, 32, 64, 32, 2056, 8, 63, 54, 58, 8, 60, 82},
{ATF20V8B, 0x00, 0x00, "ATF20V8B", 2706, 24, 40, 64, 40, 2568, 8, 63, 59, 58, 8, 60, 82},
{ATF22V10B, 0x00, 0x00, "ATF22V10B", 5892, 24, 44, 132, 44, 5828, 8, 61, 60, 58, 10, 16, 20}, {ATF22V10B, 0x00, 0x00, "ATF22V10B", 5892, 24, 44, 132, 44, 5828, 8, 61, 60, 58, 10, 16, 20},
{ATF22V10C, 0x00, 0x00, "ATF22V10C", 5892, 24, 44, 132, 44, 5828, 8, 61, 60, 58, 10, 16, 20}, {ATF22V10C, 0x00, 0x00, "ATF22V10C", 5892, 24, 44, 132, 44, 5828, 8, 61, 60, 58, 10, 16, 20},
}; };