propagate jtag_pins_conf_t and add support for bitbang mode
This commit is contained in:
parent
e8bff2d2f2
commit
c4f6178733
20
src/jtag.cpp
20
src/jtag.cpp
|
|
@ -63,23 +63,24 @@ using namespace std;
|
|||
* - envoyer le dernier avec 0x4B ou 0x6B
|
||||
*/
|
||||
|
||||
Jtag::Jtag(cable_t &cable, string dev,
|
||||
Jtag::Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, string dev,
|
||||
uint32_t clkHZ, bool verbose):
|
||||
_verbose(verbose),
|
||||
_state(RUN_TEST_IDLE),
|
||||
_tms_buffer_size(128), _num_tms(0),
|
||||
_board_name("nope")
|
||||
{
|
||||
init_internal(cable, clkHZ);
|
||||
init_internal(cable, pin_conf, clkHZ);
|
||||
}
|
||||
|
||||
Jtag::Jtag(cable_t &cable, uint32_t clkHZ, bool verbose):
|
||||
Jtag::Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf,
|
||||
uint32_t clkHZ, bool verbose):
|
||||
_verbose(verbose),
|
||||
_state(RUN_TEST_IDLE),
|
||||
_tms_buffer_size(128), _num_tms(0),
|
||||
_board_name("nope")
|
||||
{
|
||||
init_internal(cable, clkHZ);
|
||||
init_internal(cable, pin_conf, clkHZ);
|
||||
}
|
||||
|
||||
Jtag::~Jtag()
|
||||
|
|
@ -88,9 +89,16 @@ Jtag::~Jtag()
|
|||
delete _jtag;
|
||||
}
|
||||
|
||||
void Jtag::init_internal(cable_t &cable, uint32_t clkHZ)
|
||||
void Jtag::init_internal(cable_t &cable, const jtag_pins_conf_t *pin_conf,
|
||||
uint32_t clkHZ)
|
||||
{
|
||||
_jtag = new FtdiJtagMPSSE(cable.config, clkHZ, _verbose);
|
||||
if (cable.type == MODE_FTDI_BITBANG) {
|
||||
if (pin_conf == NULL)
|
||||
throw std::exception();
|
||||
_jtag = new FtdiJtagBitBang(cable.config, pin_conf, clkHZ, _verbose);
|
||||
} else {
|
||||
_jtag = new FtdiJtagMPSSE(cable.config, clkHZ, _verbose);
|
||||
}
|
||||
|
||||
_tms_buffer = (unsigned char *)malloc(sizeof(unsigned char) * _tms_buffer_size);
|
||||
bzero(_tms_buffer, _tms_buffer_size);
|
||||
|
|
|
|||
|
|
@ -22,15 +22,16 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "board.hpp"
|
||||
#include "cable.hpp"
|
||||
#include "ftdipp_mpsse.hpp"
|
||||
#include "jtagInterface.hpp"
|
||||
|
||||
class Jtag {
|
||||
public:
|
||||
Jtag(cable_t &cable, std::string dev,
|
||||
Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, std::string dev,
|
||||
uint32_t clkHZ, bool verbose = false);
|
||||
Jtag(cable_t &cable,
|
||||
Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf,
|
||||
uint32_t clkHZ, bool verbose);
|
||||
~Jtag();
|
||||
|
||||
|
|
@ -81,7 +82,8 @@ class Jtag {
|
|||
void setVerbose(bool verbose){_verbose = verbose;}
|
||||
|
||||
private:
|
||||
void init_internal(cable_t &cable, uint32_t clkHZ);
|
||||
void init_internal(cable_t &cable, const jtag_pins_conf_t *pin_conf,
|
||||
uint32_t clkHZ);
|
||||
bool _verbose;
|
||||
int _state;
|
||||
int _tms_buffer_size;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ void displaySupported(const struct arguments &args);
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
cable_t cable;
|
||||
jtag_pins_conf_t *pins_config = NULL;
|
||||
|
||||
/* command line args. */
|
||||
struct arguments args = {false, false, false, 0, "", "-", "-", "-",
|
||||
|
|
@ -100,6 +101,9 @@ int main(int argc, char **argv)
|
|||
|
||||
/* if a board name is specified try to use this to determine cable */
|
||||
if (args.board[0] != '-' && board_list.find(args.board) != board_list.end()) {
|
||||
/* set pins config */
|
||||
pins_config = &board_list[args.board].pins_config;
|
||||
/* search for cable */
|
||||
auto t = cable_list.find(board_list[args.board].cable_name);
|
||||
if (t == cable_list.end()) {
|
||||
args.cable = "-";
|
||||
|
|
@ -124,9 +128,9 @@ int main(int argc, char **argv)
|
|||
/* jtag base */
|
||||
Jtag *jtag;
|
||||
if (args.device == "-")
|
||||
jtag = new Jtag(cable, 6000000, false);
|
||||
jtag = new Jtag(cable, pins_config, 6000000, false);
|
||||
else
|
||||
jtag = new Jtag(cable, args.device, 6000000, false);
|
||||
jtag = new Jtag(cable, pins_config, args.device, 6000000, false);
|
||||
|
||||
/* chain detection */
|
||||
vector<int> listDev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue