Bugfix to allow NULL tx pointer
Also set the _clkHZ variable which is needed for timing operations such as erase.
This commit is contained in:
parent
12955b8711
commit
8d920d7ed0
|
|
@ -83,6 +83,10 @@ LibgpiodJtagBitbang::LibgpiodJtagBitbang(
|
||||||
_curr_tdi = 0;
|
_curr_tdi = 0;
|
||||||
_curr_tck = 0;
|
_curr_tck = 0;
|
||||||
_curr_tms = 1;
|
_curr_tms = 1;
|
||||||
|
|
||||||
|
// FIXME: I'm unsure how this value should be set.
|
||||||
|
// Maybe experiment, or think through what it should be.
|
||||||
|
_clkHZ = 5000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibgpiodJtagBitbang::~LibgpiodJtagBitbang()
|
LibgpiodJtagBitbang::~LibgpiodJtagBitbang()
|
||||||
|
|
@ -191,16 +195,16 @@ int LibgpiodJtagBitbang::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool e
|
||||||
if (end && (i == len - 1))
|
if (end && (i == len - 1))
|
||||||
tms = 1;
|
tms = 1;
|
||||||
|
|
||||||
|
if (tx)
|
||||||
tdi = (tx[i >> 3] & (1 << (i & 7))) ? 1 : 0;
|
tdi = (tx[i >> 3] & (1 << (i & 7))) ? 1 : 0;
|
||||||
|
|
||||||
update_pins(0, tms, tdi);
|
update_pins(0, tms, tdi);
|
||||||
|
update_pins(1, tms, tdi);
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
if (read_tdo() > 0)
|
if (read_tdo() > 0)
|
||||||
rx[i >> 3] |= 1 << (i & 7);
|
rx[i >> 3] |= 1 << (i & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_pins(1, tms, tdi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_pins(0, tms, tdi);
|
update_pins(0, tms, tdi);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue