Merge pull request #571 from pu-cc/gatemate-jtag-bypass
colognechip: Simplify handling of JTAG bypass bits
This commit is contained in:
commit
5e91e20e29
|
|
@ -324,25 +324,14 @@ void CologneChip::programJTAG_sram(const uint8_t *data, int length)
|
|||
|
||||
ProgressBar progress("Load SRAM via JTAG", length, 50, _quiet);
|
||||
|
||||
/* make sure to only send multiples of 8 bits */
|
||||
int bits_before = _jtag->get_devices_list().size() - _jtag->get_device_index() - 1;
|
||||
if (bits_before > 0) {
|
||||
int n = 8 - (bits_before % 8);
|
||||
uint8_t tx[n];
|
||||
memset(tx, 0x00, n);
|
||||
_jtag->shiftDR(tx, NULL, n, Jtag::SHIFT_DR);
|
||||
}
|
||||
|
||||
/* the bypass register defaults to '0'.
|
||||
* in order to generate a proper 'nop' command (0x00, 0xFF), send a
|
||||
* sequence of zeros instead of ones.
|
||||
*/
|
||||
int bits_after = _jtag->get_device_index();
|
||||
if (bits_after > 0) {
|
||||
int n = (bits_after + 7) / 8;
|
||||
uint8_t tx[n];
|
||||
memset(tx, 0x00, n);
|
||||
_jtag->shiftDR(tx, NULL, 8-bits_after, Jtag::SHIFT_DR);
|
||||
if (_jtag->get_devices_list().size() > 1) {
|
||||
int bits_before = 8 - (_jtag->get_device_index() % 8);
|
||||
_jtag->set_state(Jtag::SHIFT_DR, 0);
|
||||
_jtag->toggleClk(bits_before, 0);
|
||||
}
|
||||
|
||||
Jtag::tapState_t next_state = Jtag::SHIFT_DR;
|
||||
|
|
|
|||
Loading…
Reference in New Issue