diff --git a/src/anlogicCable.cpp b/src/anlogicCable.cpp index 7efc564..795eac3 100644 --- a/src/anlogicCable.cpp +++ b/src/anlogicCable.cpp @@ -138,7 +138,7 @@ int AnlogicCable::setClkFreq(uint32_t clkHZ) return clkHZ; } -int AnlogicCable::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int AnlogicCable::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { (void) flush_buffer; diff --git a/src/anlogicCable.hpp b/src/anlogicCable.hpp index 8bd702f..00f7f89 100644 --- a/src/anlogicCable.hpp +++ b/src/anlogicCable.hpp @@ -25,7 +25,7 @@ class AnlogicCable : public JtagInterface { int setClkFreq(uint32_t clkHZ) override; /* TMS */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /* TDI */ int writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end) override; /* clk */ diff --git a/src/cmsisDAP.cpp b/src/cmsisDAP.cpp index 7a75b03..5b42abc 100644 --- a/src/cmsisDAP.cpp +++ b/src/cmsisDAP.cpp @@ -291,7 +291,7 @@ int CmsisDAP::setClkFreq(uint32_t clkHZ) * flush the buffer * tms states are written only if max or if flush_buffer set */ -int CmsisDAP::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int CmsisDAP::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { /* nothing to send * check if the buffer must be flushed @@ -303,7 +303,7 @@ int CmsisDAP::writeTMS(uint8_t *tms, int len, bool flush_buffer) } /* fill buffer with tms states */ - for (int pos = 0; pos < len; pos++) { + for (uint32_t pos = 0; pos < len; pos++) { /* max tms states allowed by CMSIS-DAP -> flush */ if (_num_tms == 256) { if (flush() < 0) { @@ -481,6 +481,8 @@ int CmsisDAP::flush() int CmsisDAP::xfer(uint8_t instruction, int tx_len, uint8_t *rx_buff, int rx_len) { + (void)tx_len; + _ll_buffer[0] = 0; _ll_buffer[1] = instruction; @@ -516,6 +518,8 @@ int CmsisDAP::xfer(uint8_t instruction, int tx_len, */ int CmsisDAP::xfer(int tx_len, uint8_t *rx_buff, int rx_len) { + (void)tx_len; + _ll_buffer[0] = 0; int ret = hid_write(_dev, _ll_buffer, 65); diff --git a/src/cmsisDAP.hpp b/src/cmsisDAP.hpp index e981119..5dee1d7 100644 --- a/src/cmsisDAP.hpp +++ b/src/cmsisDAP.hpp @@ -42,7 +42,7 @@ class CmsisDAP: public JtagInterface { * \param[in] flush_buffer: force buffer to be send or not * \return <= 0 if something wrong, len otherwise */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /*! * \brief write and read len bits with optional tms set to 1 if end diff --git a/src/dirtyJtag.cpp b/src/dirtyJtag.cpp index 1774b79..71d3e6b 100644 --- a/src/dirtyJtag.cpp +++ b/src/dirtyJtag.cpp @@ -167,7 +167,7 @@ int DirtyJtag::setClkFreq(uint32_t clkHZ) return clkHZ; } -int DirtyJtag::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int DirtyJtag::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { (void) flush_buffer; int actual_length; @@ -178,7 +178,7 @@ int DirtyJtag::writeTMS(uint8_t *tms, int len, bool flush_buffer) uint8_t mask = SIG_TCK | SIG_TMS; uint8_t buf[64]; u_int buffer_idx = 0; - for (int i = 0; i < len; i++) + for (uint32_t i = 0; i < len; i++) { uint8_t val = (tms[i >> 3] & (1 << (i & 0x07))) ? SIG_TMS : 0; buf[buffer_idx++] = CMD_SETSIG; diff --git a/src/dirtyJtag.hpp b/src/dirtyJtag.hpp index 13ccf89..11d304e 100644 --- a/src/dirtyJtag.hpp +++ b/src/dirtyJtag.hpp @@ -25,7 +25,7 @@ class DirtyJtag : public JtagInterface { int setClkFreq(uint32_t clkHZ) override; /* TMS */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /* TDI */ int writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end) override; /* clk */ diff --git a/src/ftdiJtagBitbang.cpp b/src/ftdiJtagBitbang.cpp index aa79c6b..ab48e07 100644 --- a/src/ftdiJtagBitbang.cpp +++ b/src/ftdiJtagBitbang.cpp @@ -104,7 +104,7 @@ int FtdiJtagBitBang::setBitmode(uint8_t mode) return ret; } -int FtdiJtagBitBang::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int FtdiJtagBitBang::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { int ret; @@ -127,7 +127,7 @@ int FtdiJtagBitBang::writeTMS(uint8_t *tms, int len, bool flush_buffer) } /* fill buffer to reduce USB transaction */ - for (int i = 0; i < len; i++) { + for (uint32_t i = 0; i < len; i++) { _curr_tms = ((tms[i >> 3] & (1 << (i & 0x07)))? _tms_pin : 0); uint8_t val = _tdi_pin | _curr_tms; _buffer[_num++] = val; diff --git a/src/ftdiJtagBitbang.hpp b/src/ftdiJtagBitbang.hpp index 1ef2a90..018d3dd 100644 --- a/src/ftdiJtagBitbang.hpp +++ b/src/ftdiJtagBitbang.hpp @@ -31,7 +31,7 @@ class FtdiJtagBitBang : public JtagInterface, private FTDIpp_MPSSE { int setClkFreq(uint32_t clkHZ) override; /* TMS */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /* TDI */ int writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end) override; diff --git a/src/ftdiJtagMPSSE.cpp b/src/ftdiJtagMPSSE.cpp index 2a34d0e..a875372 100644 --- a/src/ftdiJtagMPSSE.cpp +++ b/src/ftdiJtagMPSSE.cpp @@ -103,7 +103,7 @@ void FtdiJtagMPSSE::config_edge() } } -int FtdiJtagMPSSE::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int FtdiJtagMPSSE::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { (void) flush_buffer; display("%s %d %d\n", __func__, len, (len/8)+1); diff --git a/src/ftdiJtagMPSSE.hpp b/src/ftdiJtagMPSSE.hpp index efbecc6..7392640 100644 --- a/src/ftdiJtagMPSSE.hpp +++ b/src/ftdiJtagMPSSE.hpp @@ -31,7 +31,7 @@ class FtdiJtagMPSSE : public JtagInterface, private FTDIpp_MPSSE { uint32_t getClkFreq() override {return FTDIpp_MPSSE::getClkFreq();} /* TMS */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /* clock */ int toggleClk(uint8_t tms, uint8_t tdi, uint32_t clk_len) override; /* TDI */ diff --git a/src/jtagInterface.hpp b/src/jtagInterface.hpp index ba5d38c..37a3a63 100644 --- a/src/jtagInterface.hpp +++ b/src/jtagInterface.hpp @@ -29,7 +29,7 @@ class JtagInterface { * \param len: number of bit to send * \return number of bit send/received */ - virtual int writeTMS(uint8_t *tms, int len, bool flush_buffer) = 0; + virtual int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) = 0; /*! * \brief send TDI bits (mainly in shift DR/IR state) diff --git a/src/usbBlaster.cpp b/src/usbBlaster.cpp index c80a794..17ee633 100644 --- a/src/usbBlaster.cpp +++ b/src/usbBlaster.cpp @@ -90,7 +90,7 @@ uint32_t UsbBlaster::getClkFreq() return ll_driver->getClkFreq(); } -int UsbBlaster::writeTMS(uint8_t *tms, int len, bool flush_buffer) +int UsbBlaster::writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) { int ret; @@ -113,7 +113,7 @@ int UsbBlaster::writeTMS(uint8_t *tms, int len, bool flush_buffer) } /* fill buffer to reduce USB transaction */ - for (int i = 0; i < len; i++) { + for (uint32_t i = 0; i < len; i++) { _curr_tms = ((tms[i >> 3] & (1 << (i & 0x07)))? _tms_pin : 0); uint8_t val = DEFAULT | DO_WRITE | DO_BITBB | _tdi_pin | _curr_tms; _in_buf[_nb_bit++] = val; diff --git a/src/usbBlaster.hpp b/src/usbBlaster.hpp index a8204ba..69ba723 100644 --- a/src/usbBlaster.hpp +++ b/src/usbBlaster.hpp @@ -54,7 +54,7 @@ class UsbBlaster : public JtagInterface { * \param flush_buffer force flushing the buffer * \return number of state written * */ - int writeTMS(uint8_t *tms, int len, bool flush_buffer) override; + int writeTMS(uint8_t *tms, uint32_t len, bool flush_buffer) override; /* TDI */ int writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end) override;