ftdiJtagMPSSE,jtagInterface: {set|get}{Read|Write}Edge signature

This commit is contained in:
Gwenhael Goavec-Merou 2023-10-29 06:12:09 +01:00
parent b54205fc15
commit 43ae0d8fdd
2 changed files with 14 additions and 13 deletions

View File

@ -35,25 +35,25 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE {
/*! /*!
* Return constant to describe if read is on rising or falling TCK edge * Return constant to describe if read is on rising or falling TCK edge
*/ */
tck_edge_t getReadEdge() { tck_edge_t getReadEdge() override {
return _read_mode == MPSSE_READ_NEG ? FALLING_EDGE : RISING_EDGE; return _read_mode == MPSSE_READ_NEG ? FALLING_EDGE : RISING_EDGE;
} }
/*! /*!
* configure TCK edge used for read * configure TCK edge used for read
*/ */
void setReadEdge(tck_edge_t rd_edge) { void setReadEdge(tck_edge_t rd_edge) override {
_read_mode = rd_edge == FALLING_EDGE ? MPSSE_READ_NEG : 0; _read_mode = rd_edge == FALLING_EDGE ? MPSSE_READ_NEG : 0;
} }
/*! /*!
* Return constant to describe if write is on rising or falling TCK edge * Return constant to describe if write is on rising or falling TCK edge
*/ */
tck_edge_t getWriteEdge() { tck_edge_t getWriteEdge() override {
return _write_mode == MPSSE_WRITE_NEG ? FALLING_EDGE : RISING_EDGE; return _write_mode == MPSSE_WRITE_NEG ? FALLING_EDGE : RISING_EDGE;
} }
/*! /*!
* configure TCK edge used for write * configure TCK edge used for write
*/ */
void setWriteEdge(tck_edge_t wr_edge) { void setWriteEdge(tck_edge_t wr_edge) override {
_write_mode = wr_edge == FALLING_EDGE ? MPSSE_WRITE_NEG : 0; _write_mode = wr_edge == FALLING_EDGE ? MPSSE_WRITE_NEG : 0;
} }
@ -72,7 +72,7 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE {
* \param len: number of bit to send/receive * \param len: number of bit to send/receive
* \return true with full buffers are sent, false otherwise * \return true with full buffers are sent, false otherwise
*/ */
virtual bool writeTMSTDI(const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo, bool writeTMSTDI(const uint8_t *tms, const uint8_t *tdi, uint8_t *tdo,
uint32_t len) override; uint32_t len) override;
/*! /*!
* \brief return internal buffer size (in byte). * \brief return internal buffer size (in byte).
@ -97,7 +97,7 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE {
* \return < 0 if transaction fails, offset + 1 when append and 0 when flush * \return < 0 if transaction fails, offset + 1 when append and 0 when flush
*/ */
int32_t update_tms_buff(uint8_t *buffer, uint8_t bit, int32_t update_tms_buff(uint8_t *buffer, uint8_t bit,
uint32_t offset, uint8_t tdi, uint8_t *tdo, bool end=false); uint32_t offset, uint8_t tdi, uint8_t *tdo, bool end = false);
uint32_t update_tdo_buff(uint8_t *buffer, uint8_t *tdo, uint32_t len); uint32_t update_tdo_buff(uint8_t *buffer, uint8_t *tdo, uint32_t len);
/*! /*!
* \brief configure read and write edge (pos or neg), with freq < 15MHz * \brief configure read and write edge (pos or neg), with freq < 15MHz

View File

@ -3,8 +3,8 @@
* Copyright (C) 2020 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> * Copyright (C) 2020 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*/ */
#ifndef _JTAGINTERFACE_H_ #ifndef SRC_JTAGINTERFACE_HPP_
#define _JTAGINTERFACE_H_ #define SRC_JTAGINTERFACE_HPP_
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
@ -33,19 +33,19 @@ class JtagInterface {
/*! /*!
* Return constant to describe if read is on rising or falling TCK edge * Return constant to describe if read is on rising or falling TCK edge
*/ */
tck_edge_t getReadEdge() { return NONE_EDGE; } virtual tck_edge_t getReadEdge() { return NONE_EDGE; }
/*! /*!
* configure TCK edge used for read * configure TCK edge used for read
*/ */
void setReadEdge(tck_edge_t rd_edge) { (void) rd_edge; } virtual void setReadEdge(tck_edge_t rd_edge) { (void) rd_edge; }
/*! /*!
* Return constant to describe if write is on rising or falling TCK edge * Return constant to describe if write is on rising or falling TCK edge
*/ */
tck_edge_t getWriteEdge() { return NONE_EDGE; } virtual tck_edge_t getWriteEdge() { return NONE_EDGE; }
/*! /*!
* configure TCK edge used for write * configure TCK edge used for write
*/ */
void setWriteEdge(tck_edge_t wr_edge) { (void)wr_edge; } virtual void setWriteEdge(tck_edge_t wr_edge) { (void)wr_edge; }
/*! /*!
* \brief flush TMS internal buffer (ie. transmit to converter) * \brief flush TMS internal buffer (ie. transmit to converter)
@ -102,7 +102,8 @@ class JtagInterface {
* \return 1 if success, 0 if nothing to write, -1 is something wrong * \return 1 if success, 0 if nothing to write, -1 is something wrong
*/ */
virtual int flush() = 0; virtual int flush() = 0;
protected: protected:
uint32_t _clkHZ; /*!< current clk frequency */ uint32_t _clkHZ; /*!< current clk frequency */
}; };
#endif // _JTAGINTERFACE_H_ #endif // SRC_JTAGINTERFACE_HPP_