2021-06-26 15:24:07 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
|
|
|
|
|
*/
|
|
|
|
|
|
2019-09-26 18:29:20 +02:00
|
|
|
#ifndef BOARD_HPP
|
|
|
|
|
#define BOARD_HPP
|
|
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
2020-03-07 11:00:29 +01:00
|
|
|
#include "cable.hpp"
|
|
|
|
|
|
|
|
|
|
/* AN_232R-01_Bit_Bang_Mode_Available_For_FT232R_and_Ft245R */
|
|
|
|
|
enum {
|
2020-10-31 08:40:18 +01:00
|
|
|
FT232RL_TXD = (1 << 0),
|
|
|
|
|
FT232RL_RXD = (1 << 1),
|
|
|
|
|
FT232RL_RTS = (1 << 2),
|
|
|
|
|
FT232RL_CTS = (1 << 3),
|
|
|
|
|
FT232RL_DTR = (1 << 4),
|
|
|
|
|
FT232RL_DSR = (1 << 5),
|
|
|
|
|
FT232RL_DCD = (1 << 6),
|
|
|
|
|
FT232RL_RI = (1 << 7)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* AN_108_Command_Processor_for_MPSSE_and_MCU_Host_Bus_Emulation_Modes */
|
|
|
|
|
enum {
|
2020-10-31 10:44:14 +01:00
|
|
|
DBUS0 = (1 << 0),
|
|
|
|
|
DBUS1 = (1 << 1),
|
|
|
|
|
DBUS2 = (1 << 2),
|
|
|
|
|
DBUS3 = (1 << 3),
|
|
|
|
|
DBUS4 = (1 << 4),
|
|
|
|
|
DBUS5 = (1 << 5),
|
|
|
|
|
DBUS6 = (1 << 6),
|
|
|
|
|
DBUS7 = (1 << 7),
|
|
|
|
|
CBUS0 = (1 << 8),
|
|
|
|
|
CBUS1 = (1 << 9),
|
|
|
|
|
CBUS2 = (1 << 10),
|
|
|
|
|
CBUS3 = (1 << 11),
|
|
|
|
|
CBUS4 = (1 << 12),
|
|
|
|
|
CBUS5 = (1 << 13),
|
|
|
|
|
CBUS6 = (1 << 14),
|
|
|
|
|
CBUS7 = (1 << 15)
|
2020-03-07 11:00:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*!
|
2020-10-31 08:40:18 +01:00
|
|
|
* \brief for bitbang mode this structure provide value for each JTAG signals
|
2020-03-07 11:00:29 +01:00
|
|
|
*/
|
|
|
|
|
typedef struct {
|
2020-10-31 08:40:18 +01:00
|
|
|
uint8_t tms_pin; /*! TMS pin value */
|
|
|
|
|
uint8_t tck_pin; /*! TCK pin value */
|
|
|
|
|
uint8_t tdi_pin; /*! TDI pin value */
|
|
|
|
|
uint8_t tdo_pin; /*! TDO pin value */
|
2020-03-07 11:00:29 +01:00
|
|
|
} jtag_pins_conf_t;
|
|
|
|
|
|
2020-10-30 08:23:49 +01:00
|
|
|
typedef struct {
|
2020-10-31 08:40:18 +01:00
|
|
|
uint16_t cs_pin; /*! CS pin value */
|
|
|
|
|
uint16_t sck_pin; /*! SCK pin value */
|
|
|
|
|
uint16_t miso_pin; /*! MISO pin value */
|
|
|
|
|
uint16_t mosi_pin; /*! MOSI pin value */
|
|
|
|
|
uint16_t holdn_pin; /*! HOLDN pin value */
|
|
|
|
|
uint16_t wpn_pin; /*! WPN pin value */
|
2020-10-30 08:23:49 +01:00
|
|
|
} spi_pins_conf_t;
|
|
|
|
|
|
2020-10-31 08:40:18 +01:00
|
|
|
enum {
|
|
|
|
|
COMM_JTAG = (1 << 0),
|
2021-06-20 10:25:49 +02:00
|
|
|
COMM_SPI = (1 << 1),
|
|
|
|
|
COMM_DFU = (1 << 2),
|
2020-10-31 08:40:18 +01:00
|
|
|
};
|
|
|
|
|
|
2020-03-07 11:00:29 +01:00
|
|
|
/*!
|
|
|
|
|
* \brief a board has a target cable and optionnally a pin configuration
|
|
|
|
|
* (bitbang mode)
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
2020-10-31 08:40:18 +01:00
|
|
|
std::string manufacturer;
|
2020-03-07 11:00:29 +01:00
|
|
|
std::string cable_name; /*! provide name of one entry in cable_list */
|
2021-04-19 21:17:08 +02:00
|
|
|
std::string fpga_part; /*! provide full fpga model name with package */
|
2020-10-31 10:43:45 +01:00
|
|
|
uint16_t reset_pin; /*! reset pin value */
|
|
|
|
|
uint16_t done_pin; /*! done pin value */
|
|
|
|
|
uint16_t mode; /*! communication type (JTAG or SPI) */
|
2020-10-31 08:40:18 +01:00
|
|
|
jtag_pins_conf_t jtag_pins_config; /*! for bitbang, provide struct with pins value */
|
|
|
|
|
spi_pins_conf_t spi_pins_config; /*! for SPI, provide struct with pins value */
|
2021-04-19 21:17:08 +02:00
|
|
|
} target_board_t;
|
2020-03-07 11:00:29 +01:00
|
|
|
|
2021-04-19 21:17:08 +02:00
|
|
|
#define JTAG_BOARD(_name, _fpga_part, _cable, _rst, _done) \
|
|
|
|
|
{_name, {"", _cable, _fpga_part, _rst, _done, COMM_JTAG, {}, {}}}
|
|
|
|
|
#define JTAG_BITBANG_BOARD(_name, _fpga_part, _cable, _rst, _done, _tms, _tck, _tdi, _tdo) \
|
|
|
|
|
{_name, {"", _cable, _fpga_part, _rst, _done, COMM_JTAG, { _tms, _tck, _tdi, _tdo }, {}}}
|
2020-10-31 08:40:18 +01:00
|
|
|
#define SPI_BOARD(_name, _manufacturer, _cable, _rst, _done, _cs, _sck, _si, _so, _holdn, _wpn) \
|
2021-04-19 21:17:08 +02:00
|
|
|
{_name, {_manufacturer, _cable, "", _rst, _done, COMM_SPI, {}, \
|
2020-10-31 08:40:18 +01:00
|
|
|
{_cs, _sck, _so, _si, _holdn, _wpn}}}
|
2021-06-20 10:25:49 +02:00
|
|
|
#define DFU_BOARD(_name, _fpga_part, _cable) \
|
|
|
|
|
{_name, {"", _cable, _fpga_part, 0, 0, COMM_DFU, {}, {}}}
|
2020-10-31 08:04:43 +01:00
|
|
|
|
2021-04-19 21:17:08 +02:00
|
|
|
static std::map <std::string, target_board_t> board_list = {
|
|
|
|
|
JTAG_BOARD("acornCle215", "xc7a200tsbg484", "", 0, 0),
|
|
|
|
|
JTAG_BOARD("alchitry_au", "xc7a35tftg256", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("arty", "xc7a35tcsg324", "digilent", 0, 0),
|
2021-04-20 21:28:14 +02:00
|
|
|
JTAG_BOARD("basys3", "xc7a35tcpg236", "digilent", 0, 0),
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("nexysVideo", "xc7a200tsbg484", "digilent_b", 0, 0),
|
|
|
|
|
JTAG_BOARD("kc705", "", "digilent", 0, 0),
|
|
|
|
|
JTAG_BOARD("colorlight", "", "", 0, 0),
|
2021-06-19 17:30:47 +02:00
|
|
|
JTAG_BOARD("colorlight-i5", "", "cmsisdap", 0, 0),
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("crosslinknx_evn", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("cyc1000", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("de0", "", "usb-blaster",0, 0),
|
|
|
|
|
JTAG_BOARD("de0nano", "", "usb-blaster",0, 0),
|
2021-05-15 19:32:49 +02:00
|
|
|
JTAG_BOARD("de0nanoSoc", "", "usb-blasterII",0, 0),
|
2021-06-19 15:33:26 +02:00
|
|
|
JTAG_BOARD("de10nano", "", "usb-blasterII",0, 0),
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("ecp5_evn", "", "ft2232", 0, 0),
|
|
|
|
|
SPI_BOARD("fireant", "efinix", "ft232",
|
2020-10-31 10:44:44 +01:00
|
|
|
DBUS4, DBUS5, DBUS3, DBUS0, DBUS1, DBUS2, DBUS6, 0),
|
2020-10-31 15:02:54 +01:00
|
|
|
/* most ice40 boards uses the same pinout */
|
2021-04-19 21:17:08 +02:00
|
|
|
SPI_BOARD("ice40_generic", "lattice", "ft2232",
|
2020-10-31 15:02:54 +01:00
|
|
|
DBUS7, DBUS6,
|
|
|
|
|
DBUS4, DBUS0, DBUS1, DBUS2,
|
|
|
|
|
0, 0),
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("machXO2EVN", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("machXO3SK", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("machXO3EVN", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("licheeTang", "", "anlogicCable", 0, 0),
|
2021-01-25 18:52:54 +01:00
|
|
|
/* left for backward compatibility, use tec0117 instead */
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("littleBee", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("spartanEdgeAccelBoard", "", "",0, 0),
|
|
|
|
|
JTAG_BOARD("pipistrello", "", "ft2232", 0, 0),
|
2021-06-13 18:55:56 +02:00
|
|
|
JTAG_BOARD("minispartan6", "", "ft2232", 0, 0),
|
2021-06-20 10:25:49 +02:00
|
|
|
DFU_BOARD("orangeCrab", "", "dfu" ),
|
2021-04-19 21:17:08 +02:00
|
|
|
JTAG_BOARD("qmtechCycloneV", "", "", 0, 0),
|
|
|
|
|
JTAG_BOARD("runber", "", "ft232", 0, 0),
|
|
|
|
|
JTAG_BOARD("tangnano", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BOARD("tec0117", "", "ft2232", 0, 0),
|
|
|
|
|
JTAG_BITBANG_BOARD("ulx2s", "", "ft232RL", 0, 0, FT232RL_RI, FT232RL_DSR, FT232RL_CTS, FT232RL_DCD),
|
|
|
|
|
JTAG_BITBANG_BOARD("ulx3s", "", "ft231X", 0, 0, FT232RL_DCD, FT232RL_DSR, FT232RL_RI, FT232RL_CTS),
|
|
|
|
|
JTAG_BOARD("ecpix5", "", "ecpix5-debug", 0, 0),
|
|
|
|
|
JTAG_BOARD("xtrx", "xc7a50tcpg236", "" , 0, 0),
|
|
|
|
|
SPI_BOARD("xyloni_spi", "efinix", "efinix_spi",
|
2021-01-21 07:11:10 +01:00
|
|
|
DBUS4 | DBUS7, DBUS5, DBUS3, DBUS0, DBUS1, DBUS2, DBUS6, 0),
|
2021-05-15 19:31:39 +02:00
|
|
|
JTAG_BOARD("zedboard", "xc7z020-clg484", "digilent_hs2", 0, 0),
|
2019-09-26 18:29:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|