diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index c6b16930..6ba702a7 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,9 @@ +2011-02-06 Mike Frysinger + + * src/tap/cable_list.h: Add usbjtagrs232. + * src/tap/cable/generic_usbconn_list.h: Add usbjtagrs232. + * src/tap/cable/ft2232.c: Add usbjtagrs232 support by Orasanu Lucian. + 2010-12-19 Mike Frysinger * data/xilinx/xc6slx45/STEPPINGS: Add stepping 2 from Sébastien Bourdeauducq. diff --git a/urjtag/THANKS b/urjtag/THANKS index 9310d30e..0b71dd1f 100644 --- a/urjtag/THANKS +++ b/urjtag/THANKS @@ -56,6 +56,7 @@ Arnim Läuger Bradley D. LaRonde Michael Lauer Guennadi Liakhovetski +Orasanu Lucian Anselmo Luginbühl Lesly A. M Raphael Mack diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index b7d7eece..8d675048 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -148,6 +148,16 @@ #define BITMASK_TURTELIZER2_nTX1LED (1 << BIT_TURTELIZER2_nTX1LED) #define BITMASK_TURTELIZER2_nRX1LED (1 << BIT_TURTELIZER2_nRX1LED) +/* bit and bitmask definitions for USB<=>JTAG&RS232 */ +#define BIT_USBJTAGRS232_nTRST_nOE 2 +#define BIT_USBJTAGRS232_nTRST 0 +#define BIT_USBJTAGRS232_nSRST_nOE 3 +#define BIT_USBJTAGRS232_nSRST 1 +#define BITMASK_USBJTAGRS232_nTRST_nOE (1 << BIT_USBJTAGRS232_nTRST_nOE) +#define BITMASK_USBJTAGRS232_nTRST (1 << BIT_USBJTAGRS232_nTRST) +#define BITMASK_USBJTAGRS232_nSRST_nOE (1 << BIT_USBJTAGRS232_nSRST_nOE) +#define BITMASK_USBJTAGRS232_nSRST (1 << BIT_USBJTAGRS232_nSRST) + /* bit and bitmask definitions for USB to JTAG Interface */ #define BIT_USBTOJTAGIF_nTRST 4 #define BIT_USBTOJTAGIF_RST 6 @@ -446,7 +456,7 @@ ft2232_armusbocd_init_common (urj_cable_t *cable, int is_ft2232h) else ft2232_set_frequency (cable, FT2232_MAX_TCK_FREQ); - params->bit_trst = BIT_ARMUSBOCD_nTRST + 8; /* member of HIGH byte */ + params->bit_trst = BIT_ARMUSBOCD_nTRST + 8; /* member of HIGH byte */ params->bit_reset = BIT_ARMUSBOCD_nTSRST + 8; /* member of HIGH byte */ params->last_tdo_valid = 0; @@ -631,6 +641,59 @@ ft2232_turtelizer2_init (urj_cable_t *cable) } +static int +ft2232_usbjtagrs232_init (urj_cable_t *cable) +{ + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; + + if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) + return URJ_STATUS_FAIL; + + /* static low byte value and direction */ + params->low_byte_value = 0; + params->low_byte_dir = 0; + + /* Set Data Bits Low Byte + TCK = 0, TMS = 1, TDI = 0 */ + urj_tap_cable_cx_cmd_queue (cmd_root, 0); + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW); + urj_tap_cable_cx_cmd_push (cmd_root, + params->low_byte_value | BITMASK_TMS); + urj_tap_cable_cx_cmd_push (cmd_root, + params->low_byte_dir | BITMASK_TCK + | BITMASK_TDI | BITMASK_TMS); + + /* Set Data Bits High Byte + default: + TRST = 1 + TRST buffer enable = 0 + SRST = 1 + SRST buffer enable = 0 */ + params->high_byte_value = BITMASK_USBJTAGRS232_nTRST + | BITMASK_USBJTAGRS232_nSRST; + params->high_byte_dir = BITMASK_USBJTAGRS232_nTRST + | BITMASK_USBJTAGRS232_nTRST_nOE + | BITMASK_USBJTAGRS232_nSRST | BITMASK_USBJTAGRS232_nSRST_nOE; + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH); + urj_tap_cable_cx_cmd_push (cmd_root, params->high_byte_value); + urj_tap_cable_cx_cmd_push (cmd_root, 0); + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH); + urj_tap_cable_cx_cmd_push (cmd_root, params->high_byte_value); + urj_tap_cable_cx_cmd_push (cmd_root, params->high_byte_dir); + + ft2232_set_frequency (cable, FT2232_MAX_TCK_FREQ); + + params->bit_trst = BIT_USBJTAGRS232_nTRST + 8; /* member of HIGH byte */ + params->bit_reset = BIT_USBJTAGRS232_nSRST + 8; /* member of HIGH byte */ + + params->last_tdo_valid = 0; + params->signals = URJ_POD_CS_TRST | URJ_POD_CS_RESET; + + return URJ_STATUS_OK; +} + + static int ft2232_usbtojtagif_init (urj_cable_t *cable) { @@ -1120,6 +1183,49 @@ ft2232_turtelizer2_done (urj_cable_t *cable) } +static void +ft2232_usbjtagrs232_done (urj_cable_t *cable) +{ + params_t *params = cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = ¶ms->cmd_root; + + /* Set Data Bits Low Byte + set all to input */ + urj_tap_cable_cx_cmd_queue (cmd_root, 0); + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW); + urj_tap_cable_cx_cmd_push (cmd_root, 0); + urj_tap_cable_cx_cmd_push (cmd_root, 0); + + /* Set Data Bits High Byte + disable output drivers */ + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH); + urj_tap_cable_cx_cmd_push (cmd_root, + BITMASK_USBJTAGRS232_nTRST + | BITMASK_USBJTAGRS232_nTRST_nOE + | BITMASK_USBJTAGRS232_nSRST | + BITMASK_USBJTAGRS232_nSRST_nOE); + urj_tap_cable_cx_cmd_push (cmd_root, + BITMASK_USBJTAGRS232_nTRST | + BITMASK_USBJTAGRS232_nTRST_nOE | + BITMASK_USBJTAGRS232_nSRST | + BITMASK_USBJTAGRS232_nSRST_nOE); + + /* Set Data Bits High Byte + set all to input */ + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH); + urj_tap_cable_cx_cmd_push (cmd_root, + BITMASK_USBJTAGRS232_nTRST + | BITMASK_USBJTAGRS232_nTRST_nOE + | BITMASK_USBJTAGRS232_nSRST | + BITMASK_USBJTAGRS232_nSRST_nOE); + urj_tap_cable_cx_cmd_push (cmd_root, 0); + urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, + URJ_TAP_CABLE_COMPLETELY); + + urj_tap_cable_generic_usbconn_done (cable); +} + + static void ft2232_usbtojtagif_done (urj_cable_t *cable) { @@ -2173,6 +2279,26 @@ const urj_cable_driver_t urj_tap_cable_ft2232_turtelizer2_driver = { }; URJ_DECLARE_FTDX_CABLE(0x0403, 0xBDC8, "-mpsse", "Turtelizer2", turtelizer2) +const urj_cable_driver_t urj_tap_cable_ft2232_usbjtagrs232_driver = { + "USB<=>JTAG&RS232", + N_("USB<=>JTAG&RS232 (FT2232) Cable (EXPERIMENTAL)"), + URJ_CABLE_DEVICE_USB, + { .usb = ft2232_connect, }, + urj_tap_cable_generic_disconnect, + ft2232_cable_free, + ft2232_usbjtagrs232_init, + ft2232_usbjtagrs232_done, + ft2232_set_frequency, + ft2232_clock, + ft2232_get_tdo, + ft2232_transfer, + ft2232_set_signal, + urj_tap_cable_generic_get_signal, + ft2232_flush, + ftdx_usbcable_help +}; +URJ_DECLARE_FTDX_CABLE(0x1457, 0x5118, "-mpsse", "USB<=>JTAG&RS232", usbjtagrs232) + const urj_cable_driver_t urj_tap_cable_ft2232_usbtojtagif_driver = { "USB-to-JTAG-IF", N_("USB to JTAG Interface (FT2232) Cable (EXPERIMENTAL)"), diff --git a/urjtag/src/tap/cable/generic_usbconn_list.h b/urjtag/src/tap/cable/generic_usbconn_list.h index 1ff89e6d..e6304157 100644 --- a/urjtag/src/tap/cable/generic_usbconn_list.h +++ b/urjtag/src/tap/cable/generic_usbconn_list.h @@ -56,6 +56,7 @@ _URJ_USB_FTDX(milkymist) _URJ_USB_FTDX(oocdlinks) _URJ_USB_FTDX(signalyzer) _URJ_USB_FTDX(turtelizer2) +_URJ_USB_FTDX(usbjtagrs232) _URJ_USB_FTDX(usbscarab2) _URJ_USB_FTDX(usbtojtagif) #endif diff --git a/urjtag/src/tap/cable_list.h b/urjtag/src/tap/cable_list.h index 5675215e..1febdb6e 100644 --- a/urjtag/src/tap/cable_list.h +++ b/urjtag/src/tap/cable_list.h @@ -57,6 +57,7 @@ _URJ_CABLE(ft2232_milkymist) _URJ_CABLE(ft2232_oocdlinks) _URJ_CABLE(ft2232_signalyzer) _URJ_CABLE(ft2232_turtelizer2) +_URJ_CABLE(ft2232_usbjtagrs232) _URJ_CABLE(ft2232_usbscarab2) _URJ_CABLE(ft2232_usbtojtagif) #endif