Merge pull request #1031 from MCUdude/jtagmki-fuses-fix
Apply jtagmki patch provided in #443
This commit is contained in:
commit
33ae3719e3
|
@ -1058,7 +1058,7 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
{
|
{
|
||||||
unsigned char cmd[6], datacmd[1 * 2 + 1];
|
unsigned char cmd[6], datacmd[1 * 2 + 1];
|
||||||
unsigned char resp[1], writedata;
|
unsigned char resp[1], writedata;
|
||||||
int len, need_progmode = 1;
|
int len, need_progmode = 1, need_dummy_read = 0;
|
||||||
|
|
||||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n",
|
avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n",
|
||||||
progname, mem->desc, addr);
|
progname, mem->desc, addr);
|
||||||
|
@ -1072,20 +1072,26 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||||
cmd[1] = MTYPE_EEPROM;
|
cmd[1] = MTYPE_EEPROM;
|
||||||
need_progmode = 0;
|
need_progmode = 0;
|
||||||
|
need_dummy_read = 1;
|
||||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||||
cmd[1] = MTYPE_FUSE_BITS;
|
cmd[1] = MTYPE_FUSE_BITS;
|
||||||
|
need_dummy_read = 1;
|
||||||
addr = 0;
|
addr = 0;
|
||||||
} else if (strcmp(mem->desc, "hfuse") == 0) {
|
} else if (strcmp(mem->desc, "hfuse") == 0) {
|
||||||
cmd[1] = MTYPE_FUSE_BITS;
|
cmd[1] = MTYPE_FUSE_BITS;
|
||||||
|
need_dummy_read = 1;
|
||||||
addr = 1;
|
addr = 1;
|
||||||
} else if (strcmp(mem->desc, "efuse") == 0) {
|
} else if (strcmp(mem->desc, "efuse") == 0) {
|
||||||
cmd[1] = MTYPE_FUSE_BITS;
|
cmd[1] = MTYPE_FUSE_BITS;
|
||||||
|
need_dummy_read = 1;
|
||||||
addr = 2;
|
addr = 2;
|
||||||
} else if (strcmp(mem->desc, "lock") == 0) {
|
} else if (strcmp(mem->desc, "lock") == 0) {
|
||||||
cmd[1] = MTYPE_LOCK_BITS;
|
cmd[1] = MTYPE_LOCK_BITS;
|
||||||
|
need_dummy_read = 1;
|
||||||
} else if (strcmp(mem->desc, "calibration") == 0) {
|
} else if (strcmp(mem->desc, "calibration") == 0) {
|
||||||
cmd[1] = MTYPE_OSCCAL_BYTE;
|
cmd[1] = MTYPE_OSCCAL_BYTE;
|
||||||
|
need_dummy_read = 1;
|
||||||
} else if (strcmp(mem->desc, "signature") == 0) {
|
} else if (strcmp(mem->desc, "signature") == 0) {
|
||||||
cmd[1] = MTYPE_SIGN_JTAG;
|
cmd[1] = MTYPE_SIGN_JTAG;
|
||||||
}
|
}
|
||||||
|
@ -1154,6 +1160,8 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||||
avrdude_message(MSG_NOTICE2, "OK\n");
|
avrdude_message(MSG_NOTICE2, "OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(need_dummy_read)
|
||||||
|
jtagmkI_recv(pgm, resp, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue