diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 0faa66f7..0e15f4eb 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -188,6 +188,16 @@ #define BITMASK_FLYSWATTER_nOE1 (1 << BIT_FLYSWATTER_nOE1) #define BITMASK_FLYSWATTER_nOE2 (1 << BIT_FLYSWATTER_nOE2) +/* bit and bitmask definitions for HULUG board*/ +#define BIT_HULUG_nLED2 1 +#define BIT_HULUG_nLED3 3 +#define BIT_HULUG_nTRST 4 +#define BIT_HULUG_nSRST 6 +#define BITMASK_HULUG_nLED2 (1 << BIT_HULUG_nLED2) +#define BITMASK_HULUG_nLED3 (1 << BIT_HULUG_nLED3) +#define BITMASK_HULUG_nTRST (1 << BIT_HULUG_nTRST) +#define BITMASK_HULUG_nSRST (1 << BIT_HULUG_nSRST) + /* --- Bit and bitmask definitions for usbScarab2 --- */ /* usbScarabeus2 is a design of Krzysztof Kajstura ( http://www.kristech.eu ). */ /* UrJTAG support added by Tomek Cedro ( http://www.tomek.cedro.info ) */ @@ -838,6 +848,50 @@ ft2232_flyswatter_init (urj_cable_t *cable) return URJ_STATUS_OK; } +static int +ft2232_hulug_init (urj_cable_t *cable) +{ + params_t *params = (params_t *) cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + + if (urj_tap_usbconn_open (cable->link.usb) != URJ_STATUS_OK) + return URJ_STATUS_FAIL; + + /* static low byte value and direction: + nTRST = 1, nSRST = 1 (ADBUS5 inverted) */ + params->low_byte_value = BITMASK_HULUG_nTRST; + params->low_byte_dir = BITMASK_HULUG_nTRST | BITMASK_HULUG_nSRST; + + /* 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 */ + /* Turn LED3 on */ + params->high_byte_value = BITMASK_HULUG_nLED3; + params->high_byte_dir = BITMASK_HULUG_nLED2 | BITMASK_HULUG_nLED3; + 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_HULUG_nTRST; /* member of LOW byte */ + params->bit_reset = BIT_HULUG_nSRST; /* member of LOW byte */ + + params->last_tdo_valid = 0; + params->signals = URJ_POD_CS_TRST | URJ_POD_CS_RESET; + + + return URJ_STATUS_OK; +} + static int ft2232_usbscarab2_init (urj_cable_t *cable) { @@ -1338,6 +1392,33 @@ ft2232_flyswatter_done (urj_cable_t *cable) urj_tap_cable_generic_usbconn_done (cable); } +static void +ft2232_hulug_done (urj_cable_t *cable) +{ + params_t *params = (params_t *) cable->params; + urj_tap_cable_cx_cmd_root_t *cmd_root = &(params->cmd_root); + + /* Set Data Bits Low Byte + disable output drivers */ + urj_tap_cable_cx_cmd_queue (cmd_root, 0); + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW); + + /* Set Data Bits Low Byte + set all to input */ + urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW); + urj_tap_cable_cx_cmd_push (cmd_root, 0); + + /* 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_HULUG_nLED2); + 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_usbscarab2_done (urj_cable_t *cable) { @@ -2359,6 +2440,26 @@ const urj_cable_driver_t urj_tap_cable_ft2232_flyswatter_driver = { }; URJ_DECLARE_FTDX_CABLE(0x0403, 0x6010, "-mpsse", "Flyswatter", flyswatter) +const urj_cable_driver_t urj_tap_cable_ft2232_hulug_driver = { + "HULUG", + N_("HULUG (FT2232) Cable"), + URJ_CABLE_DEVICE_USB, + { .usb = ft2232_connect, }, + urj_tap_cable_generic_disconnect, + ft2232_cable_free, + ft2232_hulug_init, + ft2232_hulug_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(0x0403, 0x6010, "-mpsse", "HULUG", hulug) + const urj_cable_driver_t urj_tap_cable_ft2232_usbscarab2_driver = { "usbScarab2", N_("KrisTech usbScarabeus2 (FT2232) Cable"), diff --git a/urjtag/src/tap/cable/generic_usbconn_list.h b/urjtag/src/tap/cable/generic_usbconn_list.h index e6304157..1da24d9d 100644 --- a/urjtag/src/tap/cable/generic_usbconn_list.h +++ b/urjtag/src/tap/cable/generic_usbconn_list.h @@ -51,6 +51,7 @@ _URJ_USB_FTDX(armusbtiny_h) _URJ_USB_FTDX(flyswatter) _URJ_USB_FTDX(gnice) _URJ_USB_FTDX(gniceplus) +_URJ_USB_FTDX(hulug) _URJ_USB_FTDX(jtagkey) _URJ_USB_FTDX(milkymist) _URJ_USB_FTDX(oocdlinks) diff --git a/urjtag/src/tap/cable_list.h b/urjtag/src/tap/cable_list.h index 1febdb6e..0b09bb3e 100644 --- a/urjtag/src/tap/cable_list.h +++ b/urjtag/src/tap/cable_list.h @@ -50,6 +50,7 @@ _URJ_CABLE(ft2232) _URJ_CABLE(ft2232_armusbocd) _URJ_CABLE(ft2232_armusbtiny_h) _URJ_CABLE(ft2232_flyswatter) +_URJ_CABLE(ft2232_hulug) _URJ_CABLE(ft2232_gnice) _URJ_CABLE(ft2232_gniceplus) _URJ_CABLE(ft2232_jtagkey)