all cables: writeTMS len int -> uint32_t

This commit is contained in:
Gwenhael Goavec-Merou 2021-11-06 10:31:00 +01:00
parent 4e294a244a
commit fb6a3b9f03
13 changed files with 21 additions and 17 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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)

View File

@ -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;

View File

@ -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;