temporary mod

This commit is contained in:
Gwenhael Goavec-Merou 2023-08-05 15:32:42 +02:00
parent 33b393cbc8
commit 2dc71ea612
3 changed files with 23 additions and 15 deletions

View File

@ -166,7 +166,7 @@ int Jtag::detectChain(int max_dev)
unsigned int tmp;
/* cleanup */
_devices_list.clear();
_f_device_list.clear();
_irlength_list.clear();
go_test_logic_reset();
@ -210,7 +210,7 @@ int Jtag::detectChain(int max_dev)
}
go_test_logic_reset();
flushTMS(true);
return _devices_list.size();
return _f_device_list.size();
}
bool Jtag::search_and_insert_device_with_idcode(uint32_t idcode)
@ -269,7 +269,7 @@ bool Jtag::insert_first(uint32_t device_id, bool is_misc, uint16_t irlength, dev
{
found_device dev = {device_id, irlength, is_misc, device};
_f_device_list.insert(_f_device_list.begin(), dev);
_devices_list.insert(_devices_list.begin(), device_id);
//_devices_list.insert(_devices_list.begin(), device_id);
_irlength_list.insert(_irlength_list.begin(), irlength);
return true;
@ -277,7 +277,7 @@ bool Jtag::insert_first(uint32_t device_id, bool is_misc, uint16_t irlength, dev
uint16_t Jtag::device_select(uint16_t index)
{
if (index > (uint16_t) _devices_list.size())
if (index > (uint16_t) _f_device_list.size())
return -1;
device_index = index;
return device_index;
@ -363,7 +363,7 @@ int Jtag::shiftDR(unsigned char *tdi, unsigned char *tdo, int drlen, int end_sta
/* get number of devices, in the JTAG chain,
* before the selected one
*/
int bits_before = _devices_list.size() - device_index - 1;
int bits_before = _f_device_list.size() - device_index - 1;
/* if not 0 send enough bits
*/
@ -432,7 +432,7 @@ int Jtag::shiftIR(unsigned char *tdi, unsigned char *tdo, int irlen, int end_sta
* before targeted and irlength of each one
*/
int bypass_before = 0;
for (unsigned int i = device_index + 1; i < _devices_list.size(); i++)
for (unsigned int i = device_index + 1; i < _f_device_list.size(); i++)
bypass_before += _irlength_list[i];
/* if > 0 send bits */

View File

@ -48,14 +48,14 @@ class Jtag {
* \brief return list of devices in the chain
* \return list of devices
*/
std::vector<int> get_devices_list() {return _devices_list;}
std::vector<found_device> get_devices_list2() {return _f_device_list;}
//std::vector<int> get_devices_list() {return _devices_list;}
std::vector<found_device> get_devices_list() {return _f_device_list;}
/*!
* \brief return current selected device idcode
* \return device idcode
*/
uint32_t get_target_device_id() {return _devices_list[device_index];}
uint32_t get_target_device_id() {return _f_device_list[device_index].idcode;}
/*!
* \brief set index for targeted FPGA
@ -145,7 +145,7 @@ class Jtag {
std::string _board_name;
int device_index; /*!< index for targeted FPGA */
std::vector<int32_t> _devices_list; /*!< ordered list of devices idcode */
//std::vector<int32_t> _devices_list; /*!< ordered list of devices idcode */
std::vector<int16_t> _irlength_list; /*!< ordered list of irlength */
std::vector<found_device> _f_device_list;
};

View File

@ -453,7 +453,7 @@ int main(int argc, char **argv)
}
/* chain detection */
vector<int> listDev = jtag->get_devices_list();
//vector<int> listDev = jtag->get_devices_list();
int found = listDev.size();
int idcode = -1, index = 0;
@ -464,7 +464,7 @@ int main(int argc, char **argv)
* display full chain with details
*/
if (args.verbose > 0 || args.detect) {
std::vector<Jtag::found_device> fd = jtag->get_devices_list2();
std::vector<Jtag::found_device> fd = jtag->get_devices_list();
for (auto f: fd) {
printf("\tidcode 0x%x\n\tmanufacturer %s\n\tfamily %s\n\tmodel %s\n",
f.idcode,
@ -481,7 +481,15 @@ int main(int argc, char **argv)
if (found != 0) {
if (args.index_chain == -1) {
for (int i = 0; i < found; i++) {
if (jtag->get_nb_targets() != 1) {
printError("Error: more than one FPGA found");
printError("Use --index-chain to force selection");
for (int i = 0; i < found; i++)
printf("0x%08x\n", listDev[i]);
delete(jtag);
return EXIT_FAILURE;
}
/*for (int i = 0; i < found; i++) {
if (fpga_list.find(listDev[i]) != fpga_list.end()) {
index = i;
if (idcode != -1) {
@ -495,7 +503,7 @@ int main(int argc, char **argv)
idcode = listDev[i];
}
}
}
}*/
} else {
index = args.index_chain;
if (index > found || index < 0) {
@ -503,8 +511,8 @@ int main(int argc, char **argv)
delete(jtag);
return EXIT_FAILURE;
}
idcode = listDev[index];
}
idcode = jtag->get_target_device_id();
} else {
printError("Error: no device found");
delete(jtag);