gatemate: fix configuration in jtag chains
This commit is contained in:
parent
ed547ed893
commit
1dfdec6ce1
|
|
@ -7,6 +7,7 @@
|
||||||
#include "colognechip.hpp"
|
#include "colognechip.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define JTAG_CONFIGURE 0x06
|
#define JTAG_CONFIGURE 0x06
|
||||||
#define JTAG_SPI_BYPASS 0x05
|
#define JTAG_SPI_BYPASS 0x05
|
||||||
|
|
@ -279,6 +280,25 @@ void CologneChip::programJTAG_sram(const uint8_t *data, int length)
|
||||||
|
|
||||||
ProgressBar progress("Load SRAM via JTAG", length, 50, _quiet);
|
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);
|
||||||
|
_jtag->toggleClk(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length; i += size) {
|
for (int i = 0; i < length; i += size) {
|
||||||
if (length < i + size)
|
if (length < i + size)
|
||||||
size = length-i;
|
size = length-i;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,12 @@ class Jtag {
|
||||||
*/
|
*/
|
||||||
std::vector<int> get_devices_list() {return _devices_list;}
|
std::vector<int> get_devices_list() {return _devices_list;}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief return device index in list
|
||||||
|
* \return device index
|
||||||
|
*/
|
||||||
|
int get_device_index() {return device_index;}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief return current selected device idcode
|
* \brief return current selected device idcode
|
||||||
* \return device idcode
|
* \return device idcode
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue