rework board structure to add an optional pin mapping for bitbang mode
This commit is contained in:
parent
706219016e
commit
84298839ea
|
|
@ -3,16 +3,49 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
static std::map <std::string, std::string > board_list = {
|
#include "cable.hpp"
|
||||||
{"arty", "digilent"},
|
|
||||||
{"colorlight", ""},
|
/* AN_232R-01_Bit_Bang_Mode_Available_For_FT232R_and_Ft245R */
|
||||||
{"cyc1000", "ft2232"},
|
enum {
|
||||||
{"de0nano", "usbblaster"},
|
FT232RL_TXD = 0,
|
||||||
{"ecp5_evn", "ft2232"},
|
FT232RL_RXD = 1,
|
||||||
{"machXO3SK", "ft2232"},
|
FT232RL_RTS = 2,
|
||||||
{"littleBee", "ft2232"},
|
FT232RL_CTS = 3,
|
||||||
{"spartanEdgeAccelBoard", ""},
|
FT232RL_DTR = 4,
|
||||||
{"tangnano", "ft2232"}
|
FT232RL_DSR = 5,
|
||||||
|
FT232RL_DCD = 6,
|
||||||
|
FT232RL_RI = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief for bitbang mode this structure provide offset for each JTAG signals
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint8_t tms_pin; /*! TMS pin offset */
|
||||||
|
uint8_t tck_pin; /*! TCK pin offset */
|
||||||
|
uint8_t tdi_pin; /*! TDI pin offset */
|
||||||
|
uint8_t tdo_pin; /*! TDO pin offset */
|
||||||
|
} jtag_pins_conf_t;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief a board has a target cable and optionnally a pin configuration
|
||||||
|
* (bitbang mode)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
std::string cable_name; /*! provide name of one entry in cable_list */
|
||||||
|
jtag_pins_conf_t pins_config; /*! for bitbang, provide struct with pins offset */
|
||||||
|
} target_cable_t;
|
||||||
|
|
||||||
|
static std::map <std::string, target_cable_t> board_list = {
|
||||||
|
{"arty", {"digilent", {}}},
|
||||||
|
{"colorlight", {"", {}}},
|
||||||
|
{"cyc1000", {"ft2232", {}}},
|
||||||
|
{"de0nano", {"usbblaster", {}}},
|
||||||
|
{"ecp5_evn", {"ft2232", {}}},
|
||||||
|
{"machXO3SK", {"ft2232", {}}},
|
||||||
|
{"littleBee", {"ft2232", {}}},
|
||||||
|
{"spartanEdgeAccelBoard", {"",{}}},
|
||||||
|
{"tangnano", {"ft2232", {}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ static std::map <std::string, cable_t> cable_list = {
|
||||||
{"digilent", {MODE_FTDI_SERIAL, {0x0403, 0x6010, INTERFACE_A, 0xe8, 0xeb, 0x00, 0x60}}},
|
{"digilent", {MODE_FTDI_SERIAL, {0x0403, 0x6010, INTERFACE_A, 0xe8, 0xeb, 0x00, 0x60}}},
|
||||||
{"digilent_hs2", {MODE_FTDI_SERIAL, {0x0403, 0x6014, INTERFACE_A, 0xe8, 0xeb, 0x00, 0x60}}},
|
{"digilent_hs2", {MODE_FTDI_SERIAL, {0x0403, 0x6014, INTERFACE_A, 0xe8, 0xeb, 0x00, 0x60}}},
|
||||||
{"digilent_hs3", {MODE_FTDI_SERIAL, {0x0403, 0x6014, INTERFACE_A, 0x88, 0x8B, 0x20, 0x30}}},
|
{"digilent_hs3", {MODE_FTDI_SERIAL, {0x0403, 0x6014, INTERFACE_A, 0x88, 0x8B, 0x20, 0x30}}},
|
||||||
{"ft2232", {MODE_FTDI_SERIAL, {0x0403, 0x6010, INTERFACE_A, 0x08, 0x0B, 0x08, 0x0B}}}
|
{"ft2232", {MODE_FTDI_SERIAL, {0x0403, 0x6010, INTERFACE_A, 0x08, 0x0B, 0x08, 0x0B}}},
|
||||||
|
{"ft232RL", {MODE_FTDI_BITBANG, {0x0403, 0x6001, INTERFACE_A, 0x08, 0x0B, 0x08, 0x0B}}}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* if a board name is specified try to use this to determine cable */
|
/* 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()) {
|
if (args.board[0] != '-' && board_list.find(args.board) != board_list.end()) {
|
||||||
auto t = cable_list.find(board_list[args.board]);
|
auto t = cable_list.find(board_list[args.board].cable_name);
|
||||||
if (t == cable_list.end()) {
|
if (t == cable_list.end()) {
|
||||||
args.cable = "-";
|
args.cable = "-";
|
||||||
cout << "Board " << args.board << " has not default cable" << endl;
|
cout << "Board " << args.board << " has not default cable" << endl;
|
||||||
|
|
@ -282,7 +282,8 @@ void displaySupported(const struct arguments &args)
|
||||||
printSuccess(t.str());
|
printSuccess(t.str());
|
||||||
for (auto b = board_list.begin(); b != board_list.end(); b++) {
|
for (auto b = board_list.begin(); b != board_list.end(); b++) {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << setw(15) << left << (*b).first << " " << (*b).second;
|
target_cable_t c = (*b).second;
|
||||||
|
ss << setw(15) << left << (*b).first << " " << c.cable_name;
|
||||||
printInfo(ss.str());
|
printInfo(ss.str());
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue