main: use verbose, and transmit to cable and device
This commit is contained in:
parent
8bb8f60433
commit
04d6ad576d
14
main.cpp
14
main.cpp
|
|
@ -78,7 +78,8 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
args.cable = (*t).first;
|
args.cable = (*t).first;
|
||||||
} else if (args.cable[0] == '-') { /* if no board and no cable */
|
} else if (args.cable[0] == '-') { /* if no board and no cable */
|
||||||
cout << "No cable or board specified: using direct ft2232 interface" << endl;
|
if (args.verbose)
|
||||||
|
cout << "No cable or board specified: using direct ft2232 interface" << endl;
|
||||||
args.cable = "ft2232";
|
args.cable = "ft2232";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,15 +93,16 @@ int main(int argc, char **argv)
|
||||||
/* jtag base */
|
/* jtag base */
|
||||||
FtdiJtag *jtag;
|
FtdiJtag *jtag;
|
||||||
if (args.device == "-")
|
if (args.device == "-")
|
||||||
jtag = new FtdiJtag(cable, 1, 6000000);
|
jtag = new FtdiJtag(cable, 1, 6000000, args.verbose);
|
||||||
else
|
else
|
||||||
jtag = new FtdiJtag(cable, args.device, 1, 6000000);
|
jtag = new FtdiJtag(cable, args.device, 1, 6000000, args.verbose);
|
||||||
|
|
||||||
/* chain detection */
|
/* chain detection */
|
||||||
vector<int> listDev;
|
vector<int> listDev;
|
||||||
int found = jtag->detectChain(listDev, 5);
|
int found = jtag->detectChain(listDev, 5);
|
||||||
|
|
||||||
cout << "found " << std::to_string(found) << " devices" << endl;
|
if (args.verbose)
|
||||||
|
cout << "found " << std::to_string(found) << " devices" << endl;
|
||||||
if (found > 1) {
|
if (found > 1) {
|
||||||
cerr << "Error: currently only one device is supported" << endl;
|
cerr << "Error: currently only one device is supported" << endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
@ -114,7 +116,7 @@ int main(int argc, char **argv)
|
||||||
if (fpga_list.find(idcode) == fpga_list.end()) {
|
if (fpga_list.find(idcode) == fpga_list.end()) {
|
||||||
cerr << "Error: device not supported" << endl;
|
cerr << "Error: device not supported" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else if (args.verbose) {
|
||||||
printf("idcode 0x%x\nfunder %s\nmodel %s\nfamily %s\n",
|
printf("idcode 0x%x\nfunder %s\nmodel %s\nfamily %s\n",
|
||||||
idcode,
|
idcode,
|
||||||
fpga_list[idcode].funder.c_str(),
|
fpga_list[idcode].funder.c_str(),
|
||||||
|
|
@ -129,7 +131,7 @@ int main(int argc, char **argv)
|
||||||
} else if (fab == "altera") {
|
} else if (fab == "altera") {
|
||||||
fpga = new Altera(jtag, args.bit_file);
|
fpga = new Altera(jtag, args.bit_file);
|
||||||
} else {
|
} else {
|
||||||
fpga = new Lattice(jtag, args.bit_file);
|
fpga = new Lattice(jtag, args.bit_file, args.verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpga->program(args.offset);
|
fpga->program(args.offset);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue