From 43ae0d8fdd63c5050af8a9b53f3a27bb92e8f260 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Sun, 29 Oct 2023 06:12:09 +0100 Subject: [PATCH] ftdiJtagMPSSE,jtagInterface: {set|get}{Read|Write}Edge signature --- src/ftdiJtagMPSSE.hpp | 12 ++++++------ src/jtagInterface.hpp | 15 ++++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/ftdiJtagMPSSE.hpp b/src/ftdiJtagMPSSE.hpp index 8694063..421cd6c 100644 --- a/src/ftdiJtagMPSSE.hpp +++ b/src/ftdiJtagMPSSE.hpp @@ -35,25 +35,25 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE { /*! * 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; } /*! * 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; } /*! * 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; } /*! * 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; } @@ -72,7 +72,7 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE { * \param len: number of bit to send/receive * \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; /*! * \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 */ 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); /*! * \brief configure read and write edge (pos or neg), with freq < 15MHz diff --git a/src/jtagInterface.hpp b/src/jtagInterface.hpp index 56cb4c7..b6b2036 100644 --- a/src/jtagInterface.hpp +++ b/src/jtagInterface.hpp @@ -3,8 +3,8 @@ * Copyright (C) 2020 Gwenhael Goavec-Merou */ -#ifndef _JTAGINTERFACE_H_ -#define _JTAGINTERFACE_H_ +#ifndef SRC_JTAGINTERFACE_HPP_ +#define SRC_JTAGINTERFACE_HPP_ #include #include @@ -33,19 +33,19 @@ class JtagInterface { /*! * 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 */ - 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 */ - tck_edge_t getWriteEdge() { return NONE_EDGE; } + virtual tck_edge_t getWriteEdge() { return NONE_EDGE; } /*! * 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) @@ -102,7 +102,8 @@ class JtagInterface { * \return 1 if success, 0 if nothing to write, -1 is something wrong */ virtual int flush() = 0; + protected: uint32_t _clkHZ; /*!< current clk frequency */ }; -#endif // _JTAGINTERFACE_H_ +#endif // SRC_JTAGINTERFACE_HPP_