ftdiJtagMPSSE,jtag,jtagInterface: allows to force read/write edge configuration (useful to mimic SPI through JTAG)

This commit is contained in:
Gwenhael Goavec-Merou 2023-10-24 07:26:19 +02:00
parent b76a67963e
commit fd8497026a
3 changed files with 69 additions and 0 deletions

View File

@ -32,6 +32,31 @@ class FtdiJtagMPSSE : public JtagInterface, public FTDIpp_MPSSE {
uint32_t getClkFreq() override {return FTDIpp_MPSSE::getClkFreq();}
/*!
* Return constant to describe if read is on rising or falling TCK edge
*/
tck_edge_t getReadEdge() {
return _read_mode == MPSSE_READ_NEG ? FALLING_EDGE : RISING_EDGE;
}
/*!
* configure TCK edge used for read
*/
void setReadEdge(tck_edge_t rd_edge) {
_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() {
return _write_mode == MPSSE_WRITE_NEG ? FALLING_EDGE : RISING_EDGE;
}
/*!
* configure TCK edge used for write
*/
void setWriteEdge(tck_edge_t wr_edge) {
_write_mode = wr_edge == FALLING_EDGE ? MPSSE_WRITE_NEG : 0;
}
/* TMS */
int writeTMS(const uint8_t *tms, uint32_t len, bool flush_buffer) override;
/* clock */

View File

@ -28,6 +28,27 @@ class Jtag {
int setClkFreq(uint32_t clkHZ) { return _jtag->setClkFreq(clkHZ);}
uint32_t getClkFreq() { return _jtag->getClkFreq();}
/*!
* Return constant to describe if read is on rising or falling TCK edge
*/
JtagInterface::tck_edge_t getReadEdge() { return _jtag->getReadEdge();}
/*!
* configure TCK edge used for read
*/
void setReadEdge(JtagInterface::tck_edge_t rd_edge) {
_jtag->setReadEdge(rd_edge);
}
/*!
* Return constant to describe if write is on rising or falling TCK edge
*/
JtagInterface::tck_edge_t getWriteEdge() { return _jtag->getWriteEdge();}
/*!
* configure TCK edge used for write
*/
void setWriteEdge(JtagInterface::tck_edge_t wr_edge) {
_jtag->setWriteEdge(wr_edge);
}
/*!
* \brief scan JTAG chain to obtain IDCODE. Fill
* a vector with all idcode and another

View File

@ -24,6 +24,29 @@ class JtagInterface {
virtual int setClkFreq(uint32_t clkHZ) = 0;
virtual uint32_t getClkFreq() {return _clkHZ;}
enum tck_edge_t {
FALLING_EDGE = 0,
RISING_EDGE = 1,
NONE_EDGE = 2,
};
/*!
* Return constant to describe if read is on rising or falling TCK edge
*/
tck_edge_t getReadEdge() { return NONE_EDGE; }
/*!
* configure TCK edge used for read
*/
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; }
/*!
* configure TCK edge used for write
*/
void setWriteEdge(tck_edge_t wr_edge) { (void)wr_edge; }
/*!
* \brief flush TMS internal buffer (ie. transmit to converter)
* \param tdo: pointer for read operation. May be NULL