Skip to content

Commit 05f41ac

Browse files
committed
colognechip: added build/define option to enable/disable dirtyJtag support
1 parent aac1967 commit 05f41ac

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/colognechip.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ CologneChip::CologneChip(Jtag* jtag, const std::string &filename,
4747
} else if (cable_name == "gatemate_pgm") {
4848
ftdi_board_name = "gatemate_pgm_spi";
4949
} else if (cable_name == "dirtyJtag") {
50+
#ifdef ENABLE_DIRTYJTAG
5051
_dirtyjtag = reinterpret_cast<DirtyJtag *>(_jtag->_jtag);
5152
_rstn_pin = (1 << 6);
5253
_done_pin = 0;
5354
_fail_pin = 0;
5455
_oen_pin = 0;
56+
#else
57+
std::cerr << "Jtag: support for dirtyJtag cable was not enabled at compile time" << std::endl;
58+
throw std::exception();
59+
#endif
5560
}
5661

5762
if (ftdi_board_name != "") {
@@ -90,10 +95,12 @@ void CologneChip::reset()
9095
_ftdi_jtag->gpio_clear(_rstn_pin | _oen_pin);
9196
usleep(SLEEP_US);
9297
_ftdi_jtag->gpio_set(_rstn_pin);
98+
#ifdef ENABLE_DIRTYJTAG
9399
} else if (_dirtyjtag) {
94100
_dirtyjtag->gpio_clear(_rstn_pin);
95101
_dirtyjtag->gpio_set(_rstn_pin);
96102
usleep(SLEEP_US);
103+
#endif
97104
}
98105
}
99106

@@ -142,10 +149,12 @@ bool CologneChip::prepare_flash_access()
142149
/* enable output and disable reset */
143150
_ftdi_jtag->gpio_clear(_oen_pin);
144151
_ftdi_jtag->gpio_set(_rstn_pin);
152+
#ifdef ENABLE_DIRTYJTAG
145153
} else if (_dirtyjtag) {
146154
_dirtyjtag->gpio_clear(_rstn_pin);
147155
_dirtyjtag->gpio_set(_rstn_pin);
148156
usleep(SLEEP_US);
157+
#endif
149158
}
150159

151160
return true;

src/colognechip.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#include <string>
1313

1414
#include "device.hpp"
15+
#ifdef ENABLE_DIRTYJTAG
1516
#include "dirtyJtag.hpp"
17+
#endif
1618
#include "jtag.hpp"
1719
#include "ftdispi.hpp"
1820
#include "ftdiJtagMPSSE.hpp"
@@ -70,7 +72,9 @@ class CologneChip: public Device, SPIInterface {
7072

7173
FtdiSpi *_spi = NULL;
7274
FtdiJtagMPSSE *_ftdi_jtag = NULL;
75+
#ifdef ENABLE_DIRTYJTAG
7376
DirtyJtag *_dirtyjtag = NULL;
77+
#endif
7478
uint16_t _rstn_pin;
7579
uint16_t _done_pin;
7680
uint16_t _fail_pin;

0 commit comments

Comments
 (0)