Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/libgpiodJtagBitbang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,27 @@ int LibgpiodJtagBitbang::toggleClk(uint8_t tms, uint8_t tdi, uint32_t clk_len)

return clk_len;
}

bool LibgpiodJtagBitbang::writeTMSTDI(const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo,
uint32_t len)
{
memset(tdo, 0, (len+7) / 8);

for (uint32_t i = 0; i < len; i++) {
#ifdef GPIOD_APIV2
gpiod_line_value tdix = (tdi[i >> 3] & (1 << (i & 7))) ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE;
gpiod_line_value tmsx = (tms[i >> 3] & (1 << (i & 7))) ? GPIOD_LINE_VALUE_ACTIVE : GPIOD_LINE_VALUE_INACTIVE;
update_pins(tmsx, tdix);
#else
int tdix = (tdi[i >> 3] & (1 << (i & 7))) ? 1 : 0;
int tmsx = (tms[i >> 3] & (1 << (i & 7))) ? 1 : 0;

update_pins(0, tmsx, tdix);
update_pins(1, tmsx, tdix);
#endif
if (read_tdo() > 0)
tdo[i >> 3] |= 1 << (i & 7);
}

return true;
}
2 changes: 2 additions & 0 deletions src/libgpiodJtagBitbang.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class LibgpiodJtagBitbang : public JtagInterface {
int writeTMS(const uint8_t *tms_buf, uint32_t len, bool flush_buffer, const uint8_t tdi = 1) override;
int writeTDI(const uint8_t *tx, uint8_t *rx, uint32_t len, bool end) override;
int toggleClk(uint8_t tms, uint8_t tdo, uint32_t clk_len) override;
bool writeTMSTDI(const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo,
uint32_t len) override;

int get_buffer_size() override { return 0; }
bool isFull() override { return false; }
Expand Down
8 changes: 8 additions & 0 deletions src/xvc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <stdexcept>

#include "ftdiJtagMPSSE.hpp"
#ifdef ENABLE_LIBGPIOD
#include "libgpiodJtagBitbang.hpp"
#endif
#include "cable.hpp"
#include "display.hpp"

Expand All @@ -36,6 +39,11 @@ XVC_server::XVC_server(int port, const cable_t & cable,
_jtag = new FtdiJtagMPSSE(cable, dev, serial, clkHZ,
invert_read_edge, _verbose);
break;
#ifdef ENABLE_LIBGPIOD
case MODE_LIBGPIOD_BITBANG:
_jtag = new LibgpiodJtagBitbang(pin_conf, dev, clkHZ, verbose);
break;
#endif
#if 0
case MODE_ANLOGICCABLE:
_jtag = new AnlogicCable(clkHZ);
Expand Down
Loading