xvc_client: allows to select port
This commit is contained in:
parent
d4a59bdf09
commit
2d66236533
|
|
@ -70,7 +70,7 @@ using namespace std;
|
||||||
|
|
||||||
Jtag::Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, string dev,
|
Jtag::Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, string dev,
|
||||||
const string &serial, uint32_t clkHZ, int8_t verbose,
|
const string &serial, uint32_t clkHZ, int8_t verbose,
|
||||||
const string &ip_adr,
|
const string &ip_adr, int port,
|
||||||
const bool invert_read_edge, const string &firmware_path):
|
const bool invert_read_edge, const string &firmware_path):
|
||||||
_verbose(verbose > 1),
|
_verbose(verbose > 1),
|
||||||
_state(RUN_TEST_IDLE),
|
_state(RUN_TEST_IDLE),
|
||||||
|
|
@ -78,7 +78,7 @@ Jtag::Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, string dev,
|
||||||
_board_name("nope"), device_index(0)
|
_board_name("nope"), device_index(0)
|
||||||
{
|
{
|
||||||
init_internal(cable, dev, serial, pin_conf, clkHZ, firmware_path,
|
init_internal(cable, dev, serial, pin_conf, clkHZ, firmware_path,
|
||||||
invert_read_edge, ip_adr);
|
invert_read_edge, ip_adr, port);
|
||||||
detectChain(5);
|
detectChain(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ Jtag::~Jtag()
|
||||||
|
|
||||||
void Jtag::init_internal(cable_t &cable, const string &dev, const string &serial,
|
void Jtag::init_internal(cable_t &cable, const string &dev, const string &serial,
|
||||||
const jtag_pins_conf_t *pin_conf, uint32_t clkHZ, const string &firmware_path,
|
const jtag_pins_conf_t *pin_conf, uint32_t clkHZ, const string &firmware_path,
|
||||||
const bool invert_read_edge, const string &ip_adr)
|
const bool invert_read_edge, const string &ip_adr, int port)
|
||||||
{
|
{
|
||||||
switch (cable.type) {
|
switch (cable.type) {
|
||||||
case MODE_ANLOGICCABLE:
|
case MODE_ANLOGICCABLE:
|
||||||
|
|
@ -129,7 +129,7 @@ void Jtag::init_internal(cable_t &cable, const string &dev, const string &serial
|
||||||
#endif
|
#endif
|
||||||
case MODE_XVC_CLIENT:
|
case MODE_XVC_CLIENT:
|
||||||
#ifdef ENABLE_XVC
|
#ifdef ENABLE_XVC
|
||||||
_jtag = new XVC_client(ip_adr, clkHZ, _verbose);
|
_jtag = new XVC_client(ip_adr, port, clkHZ, _verbose);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
std::cerr << "Jtag: support for xvc-client was not enabled at compile time" << std::endl;
|
std::cerr << "Jtag: support for xvc-client was not enabled at compile time" << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class Jtag {
|
||||||
public:
|
public:
|
||||||
Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, std::string dev,
|
Jtag(cable_t &cable, const jtag_pins_conf_t *pin_conf, std::string dev,
|
||||||
const std::string &serial, uint32_t clkHZ, int8_t verbose,
|
const std::string &serial, uint32_t clkHZ, int8_t verbose,
|
||||||
const std::string &ip_adr,
|
const std::string &ip_adr, int port,
|
||||||
const bool invert_read_edge = false,
|
const bool invert_read_edge = false,
|
||||||
const std::string &firmware_path = "");
|
const std::string &firmware_path = "");
|
||||||
~Jtag();
|
~Jtag();
|
||||||
|
|
@ -108,7 +108,8 @@ class Jtag {
|
||||||
const std::string &serial,
|
const std::string &serial,
|
||||||
const jtag_pins_conf_t *pin_conf, uint32_t clkHZ,
|
const jtag_pins_conf_t *pin_conf, uint32_t clkHZ,
|
||||||
const std::string &firmware_path,
|
const std::string &firmware_path,
|
||||||
const bool invert_read_edge, const std::string &ip_adr);
|
const bool invert_read_edge,
|
||||||
|
const std::string &ip_adr, int port);
|
||||||
/*!
|
/*!
|
||||||
* \brief search in fpga_list and misc_dev_list for a device with idcode
|
* \brief search in fpga_list and misc_dev_list for a device with idcode
|
||||||
* if found insert idcode and irlength in _devices_list and
|
* if found insert idcode and irlength in _devices_list and
|
||||||
|
|
|
||||||
|
|
@ -405,8 +405,8 @@ int main(int argc, char **argv)
|
||||||
Jtag *jtag;
|
Jtag *jtag;
|
||||||
try {
|
try {
|
||||||
jtag = new Jtag(cable, &pins_config, args.device, args.ftdi_serial,
|
jtag = new Jtag(cable, &pins_config, args.device, args.ftdi_serial,
|
||||||
args.freq, args.verbose, args.ip_adr, args.invert_read_edge,
|
args.freq, args.verbose, args.ip_adr, args.port,
|
||||||
args.probe_firmware);
|
args.invert_read_edge, args.probe_firmware);
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
printError("JTAG init failed with: " + string(e.what()));
|
printError("JTAG init failed with: " + string(e.what()));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
XVC_client::XVC_client(const std::string &ip_addr, uint32_t clkHz,
|
XVC_client::XVC_client(const std::string &ip_addr, int port,
|
||||||
int8_t verbose):
|
uint32_t clkHz, int8_t verbose):
|
||||||
_verbose(verbose > 0), _xfer_buf(NULL), _tms(NULL), _tditdo(NULL),
|
_verbose(verbose > 0), _xfer_buf(NULL), _tms(NULL), _tditdo(NULL),
|
||||||
_num_bits(0), _last_tms(0), _last_tdi(0), _buffer_size(0), _sock(0)
|
_num_bits(0), _last_tms(0), _last_tdi(0), _buffer_size(0), _sock(0),
|
||||||
|
_port(port)
|
||||||
{
|
{
|
||||||
if (!open_connection(ip_addr))
|
if (!open_connection(ip_addr))
|
||||||
throw std::runtime_error("connection failure");
|
throw std::runtime_error("connection failure");
|
||||||
|
|
@ -221,7 +222,7 @@ bool XVC_client::open_connection(const string &ip_addr)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons(2542);
|
addr.sin_port = htons(_port);
|
||||||
addr.sin_addr.s_addr = inet_addr(ip_addr.c_str());
|
addr.sin_addr.s_addr = inet_addr(ip_addr.c_str());
|
||||||
|
|
||||||
_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ class XVC_client: public JtagInterface {
|
||||||
* \param[in] verbose: verbose level -1 quiet, 0 normal,
|
* \param[in] verbose: verbose level -1 quiet, 0 normal,
|
||||||
* 1 verbose, 2 debug
|
* 1 verbose, 2 debug
|
||||||
*/
|
*/
|
||||||
XVC_client(const std::string &ip_addr, uint32_t clkHz, int8_t verbose);
|
XVC_client(const std::string &ip_addr, int port, uint32_t clkHz,
|
||||||
|
int8_t verbose);
|
||||||
|
|
||||||
~XVC_client();
|
~XVC_client();
|
||||||
|
|
||||||
|
|
@ -120,5 +121,6 @@ class XVC_client: public JtagInterface {
|
||||||
std::string _server_name;
|
std::string _server_name;
|
||||||
std::string _server_vers;
|
std::string _server_vers;
|
||||||
int _sock;
|
int _sock;
|
||||||
|
int _port; /*!< target port */
|
||||||
};
|
};
|
||||||
#endif // SRC_XVC_CLIENT_HPP_
|
#endif // SRC_XVC_CLIENT_HPP_
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue