pass cable_t instead of mpsse_bit_config

This commit is contained in:
Gwenhael Goavec-Merou 2020-03-07 10:56:34 +01:00
parent f9591b89a7
commit 706219016e
3 changed files with 10 additions and 9 deletions

View File

@ -63,7 +63,7 @@ using namespace std;
* - envoyer le dernier avec 0x4B ou 0x6B * - envoyer le dernier avec 0x4B ou 0x6B
*/ */
Jtag::Jtag(FTDIpp_MPSSE::mpsse_bit_config &cable, string dev, Jtag::Jtag(cable_t &cable, string dev,
uint32_t clkHZ, bool verbose): uint32_t clkHZ, bool verbose):
_verbose(verbose), _verbose(verbose),
_state(RUN_TEST_IDLE), _state(RUN_TEST_IDLE),
@ -73,7 +73,7 @@ Jtag::Jtag(FTDIpp_MPSSE::mpsse_bit_config &cable, string dev,
init_internal(cable, clkHZ); init_internal(cable, clkHZ);
} }
Jtag::Jtag(FTDIpp_MPSSE::mpsse_bit_config &cable, uint32_t clkHZ, bool verbose): Jtag::Jtag(cable_t &cable, uint32_t clkHZ, bool verbose):
_verbose(verbose), _verbose(verbose),
_state(RUN_TEST_IDLE), _state(RUN_TEST_IDLE),
_tms_buffer_size(128), _num_tms(0), _tms_buffer_size(128), _num_tms(0),
@ -88,9 +88,9 @@ Jtag::~Jtag()
delete _jtag; delete _jtag;
} }
void Jtag::init_internal(FTDIpp_MPSSE::mpsse_bit_config &cable, uint32_t clkHZ) void Jtag::init_internal(cable_t &cable, uint32_t clkHZ)
{ {
_jtag = new FtdiJtagMPSSE(cable, clkHZ, _verbose); _jtag = new FtdiJtagMPSSE(cable.config, clkHZ, _verbose);
_tms_buffer = (unsigned char *)malloc(sizeof(unsigned char) * _tms_buffer_size); _tms_buffer = (unsigned char *)malloc(sizeof(unsigned char) * _tms_buffer_size);
bzero(_tms_buffer, _tms_buffer_size); bzero(_tms_buffer, _tms_buffer_size);

View File

@ -22,14 +22,15 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "cable.hpp"
#include "ftdipp_mpsse.hpp" #include "ftdipp_mpsse.hpp"
#include "jtagInterface.hpp" #include "jtagInterface.hpp"
class Jtag { class Jtag {
public: public:
Jtag(FTDIpp_MPSSE::mpsse_bit_config &cable, std::string dev, Jtag(cable_t &cable, std::string dev,
uint32_t clkHZ, bool verbose = false); uint32_t clkHZ, bool verbose = false);
Jtag(FTDIpp_MPSSE::mpsse_bit_config &cable, Jtag(cable_t &cable,
uint32_t clkHZ, bool verbose); uint32_t clkHZ, bool verbose);
~Jtag(); ~Jtag();
@ -80,7 +81,7 @@ class Jtag {
void setVerbose(bool verbose){_verbose = verbose;} void setVerbose(bool verbose){_verbose = verbose;}
private: private:
void init_internal(FTDIpp_MPSSE::mpsse_bit_config &cable, uint32_t clkHZ); void init_internal(cable_t &cable, uint32_t clkHZ);
bool _verbose; bool _verbose;
int _state; int _state;
int _tms_buffer_size; int _tms_buffer_size;

View File

@ -85,7 +85,7 @@ void displaySupported(const struct arguments &args);
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
FTDIpp_MPSSE::mpsse_bit_config cable; cable_t cable;
/* command line args. */ /* command line args. */
struct arguments args = {false, false, false, 0, "", "-", "-", "-", struct arguments args = {false, false, false, 0, "", "-", "-", "-",
@ -267,7 +267,7 @@ void displaySupported(const struct arguments &args)
t << setw(15) << left << "cable name:" << "vid:pid"; t << setw(15) << left << "cable name:" << "vid:pid";
printSuccess(t.str()); printSuccess(t.str());
for (auto b = cable_list.begin(); b != cable_list.end(); b++) { for (auto b = cable_list.begin(); b != cable_list.end(); b++) {
FTDIpp_MPSSE::mpsse_bit_config c = (*b).second; FTDIpp_MPSSE::mpsse_bit_config c = (*b).second.config;
stringstream ss; stringstream ss;
ss << setw(15) << left << (*b).first; ss << setw(15) << left << (*b).first;
ss << "0x" << hex << c.vid << ":" << c.pid; ss << "0x" << hex << c.vid << ":" << c.pid;