OpenOCD
ft2232.c File Reference

JTAG adapters based on the FT2232 full and high speed USB parts are popular low cost JTAG debug solutions. More...

Include dependency graph for ft2232.c:

Go to the source code of this file.

Data Structures

struct  ft2232_layout
 

Macros

#define FT2232_BUFFER_READ_QUEUE_SIZE   (64*4)
 
#define FT2232_BUFFER_SIZE   131072
 
#define FTDI_2232C_MAX_TCK   6000
 
#define FTDI_x232H_MAX_TCK   30000
 
#define ICDI_DBG_ENn   (1 << 6) /* ADBUS 6 */
 
#define ICDI_JTAG_EN   (1 << 7) /* ADBUS 7 (a.k.a. DBGMOD) */
 
#define ICDI_SRST   (1 << 5) /* ADBUS 5 */
 
#define ICDI_SWO_EN   (1 << 4) /* BDBUS 4 */
 
#define ICDI_TX_SWO   (1 << 1) /* BDBUS 1 */
 
#define ICDI_VCP_RX   (1 << 0) /* BDBUS 0 (to stellaris UART) */
 
#define LIBFTDI_READ_RETRY_COUNT   2000
 
#define MAX_USB_IDS   8
 
#define RTCK_SPEED   -1
 
#define SIGNALYZER_CHAN_A   1
 
#define SIGNALYZER_CHAN_B   2
 
#define SIGNALYZER_CHAN_C   4
 
#define SIGNALYZER_COMMAND_ADC   0x54
 
#define SIGNALYZER_COMMAND_ADDR   128
 
#define SIGNALYZER_COMMAND_GPIO_MODE   0x56
 
#define SIGNALYZER_COMMAND_GPIO_PORT   0x57
 
#define SIGNALYZER_COMMAND_GPIO_STATE   0x55
 
#define SIGNALYZER_COMMAND_I2C   0x58
 
#define SIGNALYZER_COMMAND_LED_SET   0x53
 
#define SIGNALYZER_COMMAND_POWERCONTROL_GET   0x50
 
#define SIGNALYZER_COMMAND_POWERCONTROL_SET   0x51
 
#define SIGNALYZER_COMMAND_PWM_SET   0x52
 
#define SIGNALYZER_COMMAND_RESET   0x42
 
#define SIGNALYZER_COMMAND_VERSION   0x41
 
#define SIGNALYZER_DATA_BUFFER_ADDR   129
 
#define SIGNALYZER_LED_GREEN   1
 
#define SIGNALYZER_LED_RED   2
 
#define SIGNALYZER_MODULE_TYPE_EM_ARM_JTAG   0x0302
 
#define SIGNALYZER_MODULE_TYPE_EM_ARM_JTAG_P   0x0304
 
#define SIGNALYZER_MODULE_TYPE_EM_JTAG   0x0303
 
#define SIGNALYZER_MODULE_TYPE_EM_JTAG_P   0x0305
 
#define SIGNALYZER_MODULE_TYPE_EM_LT16_A   0x0301
 
#define XDS100_LOOPBACK   (1<<6)
 
#define XDS100_nEMU0   (1<<6)
 
#define XDS100_nEMU1   (1<<4)
 
#define XDS100_nEMU_EN   (1<<5)
 
#define XDS100_PWR_RST   (1<<3)
 

Functions

static int axm0432_jtag_init (void)
 
static void axm0432_jtag_reset (int trst, int srst)
 
static uint8_t buffer_read (void)
 Function buffer_read returns a byte from the byte buffer. More...
 
static void buffer_write (uint8_t val)
 Function buffer_write writes a byte into the byte buffer, "ft2232_buffer", which must be sent later. More...
 
static void clock_tms (uint8_t mpsse_cmd, int tms_bits, int tms_count, bool tdi_bit)
 Clocks out bit_count bits on the TMS line, starting with the least significant bit of tms_bits and progressing to more significant bits. More...
 
 COMMAND_HANDLER (ft2232_handle_device_desc_command)
 
 COMMAND_HANDLER (ft2232_handle_serial_command)
 
 COMMAND_HANDLER (ft2232_handle_layout_command)
 
 COMMAND_HANDLER (ft2232_handle_vid_pid_command)
 
 COMMAND_HANDLER (ft2232_handle_latency_command)
 
 COMMAND_HANDLER (ft2232_handle_channel_command)
 
static int comstick_init (void)
 
static void comstick_reset (int trst, int srst)
 
static int cortino_jtag_init (void)
 
static int digilent_hs1_init (void)
 
static void digilent_hs1_reset (int trst, int srst)
 
static void flossjtag_blink (void)
 
static int flossjtag_init (void)
 
static int flyswatter1_init (void)
 
static void flyswatter1_jtag_blink (void)
 
static void flyswatter1_reset (int trst, int srst)
 
static int flyswatter2_init (void)
 
static void flyswatter2_jtag_blink (void)
 
static void flyswatter2_reset (int trst, int srst)
 
static int flyswatter_init (int rev)
 
static void flyswatter_jtag_blink (unsigned char led)
 
static void flyswatter_reset (int trst, int srst)
 
static void ft2232_add_pathmove (tap_state_t *path, int num_states)
 Function ft2232_add_pathmove moves the TAP controller from the current state to a new state through the given path, where path is an array of tap_state_t's. More...
 
static void ft2232_add_scan (bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size)
 
static void ft2232_debug_dump_buffer (void)
 
static bool ft2232_device_is_highspeed (void)
 
static void ft2232_end_state (tap_state_t state)
 
static int ft2232_execute_command (struct jtag_command *cmd)
 
static int ft2232_execute_pathmove (struct jtag_command *cmd)
 
static int ft2232_execute_queue (void)
 
static int ft2232_execute_reset (struct jtag_command *cmd)
 
static int ft2232_execute_runtest (struct jtag_command *cmd)
 
static int ft2232_execute_scan (struct jtag_command *cmd)
 
static int ft2232_execute_sleep (struct jtag_command *cmd)
 
static int ft2232_execute_stableclocks (struct jtag_command *cmd)
 
static int ft2232_execute_statemove (struct jtag_command *cmd)
 
static int ft2232_execute_tms (struct jtag_command *cmd)
 Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine. More...
 
static int ft2232_init (void)
 
static int ft2232_khz (int khz, int *jtag_speed)
 
static int ft2232_large_scan (struct scan_command *cmd, enum scan_type type, uint8_t *buffer, int scan_size)
 
static int ft2232_predict_scan_in (int scan_size, enum scan_type type)
 
static int ft2232_predict_scan_out (int scan_size, enum scan_type type)
 
static int ft2232_quit (void)
 
static int ft2232_read (uint8_t *buf, uint32_t size, uint32_t *bytes_read)
 
static void ft2232_read_scan (enum scan_type type, uint8_t *buffer, int scan_size)
 
static int ft2232_send_and_recv (struct jtag_command *first, struct jtag_command *last)
 
static int ft2232_set_data_bits_high_byte (uint8_t value, uint8_t direction)
 
static int ft2232_set_data_bits_low_byte (uint8_t value, uint8_t direction)
 
static int ft2232_speed (int speed)
 
static int ft2232_speed_div (int speed, int *khz)
 
static int ft2232_stableclocks (int num_cycles, struct jtag_command *cmd)
 Send out num_cycles on the TCK line while the TAP(s) are in a stable state. More...
 
static int ft2232_write (uint8_t *buf, int size, uint32_t *bytes_written)
 
static void ftx232_dbus_init (void)
 Updates defaults for DBUS signals: the four JTAG signals (TCK, TDI, TDO, TMS) and * the four GPIOL signals. More...
 
static int ftx232_dbus_write (void)
 Initializes DBUS signals: the four JTAG signals (TCK, TDI, TDO, TMS), the four GPIOL signals. More...
 
static int ftx232h_adaptive_clocking (bool enable)
 
static int ftx232h_clk_divide_by_5 (bool enable)
 Enable/disable the clk divide by 5 of the 60MHz master clock. More...
 
static void ftx23_reset (int trst, int srst)
 
static int get_tms_buffer_requirements (int bit_count)
 Function get_tms_buffer_requirements returns what clock_tms() will consume if called with same bit_count. More...
 
static int icdi_jtag_init (void)
 
static int icebear_jtag_init (void)
 
static void icebear_jtag_reset (int trst, int srst)
 
static int jtagkey_init (void)
 
static void jtagkey_reset (int trst, int srst)
 
static void ktlink_blink (void)
 
static int ktlink_init (void)
 
static void ktlink_reset (int trst, int srst)
 
static void lisa_l_blink (void)
 
static int lisa_l_init (void)
 
static int lm3s811_jtag_init (void)
 
static int minimodule_init (void)
 
static void minimodule_reset (int trst, int srst)
 
static void move_to_state (tap_state_t goal_state)
 Function move_to_state moves the TAP controller from the current state to a goal_state through a path given by tap_get_tms_path(). More...
 
static void olimex_jtag_blink (void)
 
static int olimex_jtag_init (void)
 
static void olimex_jtag_reset (int trst, int srst)
 
static int redbee_init (void)
 
static void redbee_reset (int trst, int srst)
 
static int sheevaplug_init (void)
 
static void sheevaplug_reset (int trst, int srst)
 
static void signalyzer_h_blink (void)
 
static int signalyzer_h_ctrl_write (int address, unsigned short value)
 
static int signalyzer_h_init (void)
 
static int signalyzer_h_led_set (unsigned char channel, unsigned char led, int on_time_ms, int off_time_ms, unsigned char cycles)
 
static void signalyzer_h_reset (int trst, int srst)
 
static int signalyzer_init (void)
 
static int stm32stick_init (void)
 
static void stm32stick_reset (int trst, int srst)
 
static int turtle_init (void)
 
static void turtle_jtag_blink (void)
 
static void turtle_reset (int trst, int srst)
 
static int usbjtag_init (void)
 
static int xds100v2_init (void)
 
static void xds100v2_reset (int trst, int srst)
 

Variables

static struct jtag_commandfirst_unsent
 
static uint8_t * ft2232_buffer
 
static int ft2232_buffer_size
 
static int ft2232_channel = INTERFACE_ANY
 
static struct command_registration ft2232_command_handlers []
 
static char * ft2232_device_desc
 
static char * ft2232_device_desc_A
 
static int ft2232_expect_read
 
struct jtag_interface ft2232_interface
 
static uint8_t ft2232_latency = 2
 
static struct ft2232_layout ft2232_layouts []
 
static unsigned ft2232_max_tck = FTDI_2232C_MAX_TCK
 
static uint16_t ft2232_pid [MAX_USB_IDS+1] = { 0x6010, 0 }
 
static int ft2232_read_pointer
 
static char * ft2232_serial
 
static uint16_t ft2232_vid [MAX_USB_IDS+1] = { 0x0403, 0 }
 
static uint8_t high_direction
 default direction bitmask for CBUS GPIOH(0..4) More...
 
static uint8_t high_output
 default value bitmask for CBUS GPIOH(0..4) More...
 
static struct ft2232_layoutlayout
 the layout being used with this debug session More...
 
static uint8_t low_direction
 default direction bitmask for DBUS: TCK/TDI/TDO/TMS and GPIOL(0..4) More...
 
static uint8_t low_output
 default bitmask values driven on DBUS: TCK/TDI/TDO/TMS and GPIOL(0..4) More...
 
static uint8_t nSRST
 
static uint8_t nSRSTnOE
 
static uint8_t nTRST
 
static uint8_t nTRSTnOE
 
static int require_send
 
static unsigned int signalyzer_h_adapter_type
 
static unsigned char signalyzer_h_side
 

Detailed Description

JTAG adapters based on the FT2232 full and high speed USB parts are popular low cost JTAG debug solutions.

Many FT2232 based JTAG adapters are discrete, but development boards may integrate them as alternatives to more capable (and expensive) third party JTAG pods.

JTAG uses only one of the two communications channels ("MPSSE engines") on these devices. Adapters based on FT4232 parts have four ports/channels (A/B/C/D), instead of just two (A/B).

Especially on development boards integrating one of these chips (as opposed to discrete pods/dongles), the additional channels can be used for a variety of purposes, but OpenOCD only uses one channel at a time.

  • As a USB-to-serial adapter for the target's console UART ... which may be able to support ROM boot loaders that load initial firmware images to flash (or SRAM).
  • On systems which support ARM's SWD in addition to JTAG, or instead of it, that second port can be used for reading SWV/SWO trace data.
  • Additional JTAG links, e.g. to a CPLD or * FPGA.

FT2232 based JTAG adapters are "dumb" not "smart", because most JTAG request/response interactions involve round trips over the USB link. A "smart" JTAG adapter has intelligence close to the scan chain, so it can for example poll quickly for a status change (usually taking on the order of microseconds not milliseconds) before beginning a queued transaction which require the previous one to have completed.

There are dozens of adapters of this type, differing in details which this driver needs to understand. Those "layout" details are required as part of FT2232 driver configuration.

This code uses information contained in the MPSSE specification which was found here: http://www.ftdichip.com/Documents/AppNotes/AN2232C-01_MPSSE_Cmnd.pdf Hereafter this is called the "MPSSE Spec".

The datasheet for the ftdichip.com's FT2232D part is here: http://www.ftdichip.com/Documents/DataSheets/DS_FT2232D.pdf

Also note the issue with code 0x4b (clock data to TMS) noted in http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00292.html which can affect longer JTAG state paths.

Definition in file ft2232.c.

Macro Definition Documentation

#define FT2232_BUFFER_READ_QUEUE_SIZE   (64*4)

Definition at line 400 of file ft2232.c.

Referenced by ft2232_execute_queue().

#define FTDI_2232C_MAX_TCK   6000

Definition at line 119 of file ft2232.c.

Referenced by ftx232h_clk_divide_by_5().

#define FTDI_x232H_MAX_TCK   30000

Definition at line 117 of file ft2232.c.

Referenced by ftx232h_clk_divide_by_5().

#define ICDI_DBG_ENn   (1 << 6) /* ADBUS 6 */

Referenced by icdi_jtag_init().

#define ICDI_JTAG_EN   (1 << 7) /* ADBUS 7 (a.k.a. DBGMOD) */

Referenced by icdi_jtag_init().

#define ICDI_SRST   (1 << 5) /* ADBUS 5 */

Referenced by icdi_jtag_init().

#define ICDI_SWO_EN   (1 << 4) /* BDBUS 4 */
#define ICDI_TX_SWO   (1 << 1) /* BDBUS 1 */
#define ICDI_VCP_RX   (1 << 0) /* BDBUS 0 (to stellaris UART) */
#define LIBFTDI_READ_RETRY_COUNT   2000

Definition at line 132 of file ft2232.c.

Referenced by ft2232_read(), and ft2232_send_and_recv().

#define MAX_USB_IDS   8

Definition at line 161 of file ft2232.c.

Referenced by COMMAND_HANDLER().

#define RTCK_SPEED   -1

Definition at line 121 of file ft2232.c.

Referenced by ft2232_khz(), ft2232_speed(), and ft2232_speed_div().

#define SIGNALYZER_CHAN_A   1

Definition at line 3444 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_CHAN_B   2

Definition at line 3445 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_CHAN_C   4

Definition at line 3447 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_COMMAND_ADC   0x54

Definition at line 3438 of file ft2232.c.

#define SIGNALYZER_COMMAND_ADDR   128

Definition at line 3429 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_led_set().

#define SIGNALYZER_COMMAND_GPIO_MODE   0x56

Definition at line 3440 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_COMMAND_GPIO_PORT   0x57

Definition at line 3441 of file ft2232.c.

#define SIGNALYZER_COMMAND_GPIO_STATE   0x55

Definition at line 3439 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_COMMAND_I2C   0x58

Definition at line 3442 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_COMMAND_LED_SET   0x53

Definition at line 3437 of file ft2232.c.

Referenced by signalyzer_h_led_set().

#define SIGNALYZER_COMMAND_POWERCONTROL_GET   0x50

Definition at line 3434 of file ft2232.c.

#define SIGNALYZER_COMMAND_POWERCONTROL_SET   0x51

Definition at line 3435 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_COMMAND_PWM_SET   0x52

Definition at line 3436 of file ft2232.c.

#define SIGNALYZER_COMMAND_RESET   0x42

Definition at line 3433 of file ft2232.c.

#define SIGNALYZER_COMMAND_VERSION   0x41

Definition at line 3432 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_DATA_BUFFER_ADDR   129

Definition at line 3430 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_led_set().

#define SIGNALYZER_LED_GREEN   1

Definition at line 3449 of file ft2232.c.

Referenced by signalyzer_h_init().

#define SIGNALYZER_LED_RED   2

Definition at line 3450 of file ft2232.c.

Referenced by signalyzer_h_blink().

#define SIGNALYZER_MODULE_TYPE_EM_ARM_JTAG   0x0302

Definition at line 3453 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_reset().

#define SIGNALYZER_MODULE_TYPE_EM_ARM_JTAG_P   0x0304

Definition at line 3455 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_reset().

#define SIGNALYZER_MODULE_TYPE_EM_JTAG   0x0303

Definition at line 3454 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_reset().

#define SIGNALYZER_MODULE_TYPE_EM_JTAG_P   0x0305

Definition at line 3456 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_reset().

#define SIGNALYZER_MODULE_TYPE_EM_LT16_A   0x0301

Definition at line 3452 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_reset().

#define XDS100_LOOPBACK   (1<<6)

Definition at line 3027 of file ft2232.c.

Referenced by xds100v2_init().

#define XDS100_nEMU0   (1<<6)

Definition at line 3023 of file ft2232.c.

Referenced by xds100v2_init().

#define XDS100_nEMU1   (1<<4)

Definition at line 3026 of file ft2232.c.

Referenced by xds100v2_init().

#define XDS100_nEMU_EN   (1<<5)

Definition at line 3022 of file ft2232.c.

Referenced by xds100v2_init().

#define XDS100_PWR_RST   (1<<3)

Definition at line 3025 of file ft2232.c.

Referenced by xds100v2_init().

Function Documentation

static void axm0432_jtag_reset ( int  trst,
int  srst 
)
static
static uint8_t buffer_read ( void  )
inlinestatic

Function buffer_read returns a byte from the byte buffer.

Definition at line 426 of file ft2232.c.

References ft2232_buffer, ft2232_buffer_size, and ft2232_read_pointer.

Referenced by ft2232_read_scan().

static void clock_tms ( uint8_t  mpsse_cmd,
int  tms_bits,
int  tms_count,
bool  tdi_bit 
)
static

Clocks out bit_count bits on the TMS line, starting with the least significant bit of tms_bits and progressing to more significant bits.

Rigorous state transition logging is done here via tap_set_state().

Parameters
mpsse_cmdOne of the MPSSE TMS oriented commands such as 0x4b or 0x6b. See the MPSSE spec referenced above for their functionality. The MPSSE command "Clock Data to TMS/CS Pin (no Read)" is often used for this, 0x4b.
tms_bitsHolds the sequence of bits to send.
tms_countTells how many bits in the sequence.
tdi_bitA single bit to pass on to TDI before the first TCK cycle and held static for the duration of TMS clocking.

See the MPSSE spec referenced above.

Definition at line 450 of file ft2232.c.

References buffer_write(), DEBUG_JTAG_IO, tap_get_state(), tap_set_state(), and tap_state_transition().

Referenced by ft2232_add_scan(), ft2232_execute_statemove(), ft2232_large_scan(), and move_to_state().

COMMAND_HANDLER ( ft2232_handle_device_desc_command  )

Definition at line 3164 of file ft2232.c.

References CMD_ARGC, CMD_ARGV, ERROR_OK, ft2232_device_desc, ft2232_device_desc_A, and LOG_ERROR.

COMMAND_HANDLER ( ft2232_handle_serial_command  )

Definition at line 3194 of file ft2232.c.

References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and ft2232_serial.

COMMAND_HANDLER ( ft2232_handle_layout_command  )
COMMAND_HANDLER ( ft2232_handle_vid_pid_command  )
COMMAND_HANDLER ( ft2232_handle_latency_command  )

Definition at line 3259 of file ft2232.c.

References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and ft2232_latency.

COMMAND_HANDLER ( ft2232_handle_channel_command  )

Definition at line 3269 of file ft2232.c.

References CMD_ARGC, CMD_ARGV, ERROR_OK, ft2232_channel, and LOG_ERROR.

static void comstick_reset ( int  trst,
int  srst 
)
static

Definition at line 1532 of file ft2232.c.

References buffer_write(), high_direction, high_output, LOG_DEBUG, nSRST, and nTRST.

static int digilent_hs1_init ( void  )
static
static void digilent_hs1_reset ( int  trst,
int  srst 
)
static

Definition at line 4246 of file ft2232.c.

static void flossjtag_blink ( void  )
static

Definition at line 3132 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

static int flossjtag_init ( void  )
static
static int flyswatter1_init ( void  )
static

Definition at line 2778 of file ft2232.c.

References flyswatter_init().

static void flyswatter1_jtag_blink ( void  )
static

Definition at line 3086 of file ft2232.c.

References flyswatter_jtag_blink().

static void flyswatter1_reset ( int  trst,
int  srst 
)
static

Definition at line 1484 of file ft2232.c.

References flyswatter_reset().

static int flyswatter2_init ( void  )
static

Definition at line 2783 of file ft2232.c.

References flyswatter_init().

static void flyswatter2_jtag_blink ( void  )
static

Definition at line 3094 of file ft2232.c.

References flyswatter_jtag_blink().

static void flyswatter2_reset ( int  trst,
int  srst 
)
static

Definition at line 1489 of file ft2232.c.

References flyswatter_reset().

static void flyswatter_jtag_blink ( unsigned char  led)
static

Definition at line 3079 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

Referenced by flyswatter1_jtag_blink(), and flyswatter2_jtag_blink().

static void flyswatter_reset ( int  trst,
int  srst 
)
static

Definition at line 1461 of file ft2232.c.

References buffer_write(), LOG_DEBUG, low_direction, low_output, nSRST, and nTRST.

Referenced by flyswatter1_reset(), and flyswatter2_reset().

static void ft2232_add_pathmove ( tap_state_t path,
int  num_states 
)
static

Function ft2232_add_pathmove moves the TAP controller from the current state to a new state through the given path, where path is an array of tap_state_t's.

Parameters
pathis an array of tap_stat_t which gives the states to traverse through ending with the last state at path[num_states-1]
num_statesis the count of state steps to move through

Definition at line 927 of file ft2232.c.

References buf_set_u32(), buffer_write(), DEBUG_JTAG_IO, LOG_ERROR, tap_get_state(), tap_set_end_state(), tap_set_state(), tap_state_name(), and tap_state_transition().

Referenced by ft2232_execute_pathmove().

static void ft2232_add_scan ( bool  ir_scan,
enum scan_type  type,
uint8_t *  buffer,
int  scan_size 
)
static
static void ft2232_debug_dump_buffer ( void  )
static

Definition at line 778 of file ft2232.c.

References ft2232_buffer, ft2232_buffer_size, and LOG_DEBUG.

Referenced by ft2232_send_and_recv().

static bool ft2232_device_is_highspeed ( void  )
static

Definition at line 599 of file ft2232.c.

Referenced by ft2232_init(), ft2232_khz(), and ft2232_speed().

static void ft2232_end_state ( tap_state_t  state)
static
static int ft2232_execute_tms ( struct jtag_command cmd)
static

Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine.

Definition at line 1748 of file ft2232.c.

References tms_command::bits, bits, buffer_write(), jtag_command::cmd, count, DEBUG_JTAG_IO, DIV_ROUND_UP, ERROR_JTAG_QUEUE_FAILED, ERROR_OK, FT2232_BUFFER_SIZE, ft2232_buffer_size, ft2232_send_and_recv(), tms_command::num_bits, require_send, and jtag_command_container::tms.

Referenced by ft2232_execute_command().

static int ft2232_khz ( int  khz,
int *  jtag_speed 
)
static
static int ft2232_predict_scan_in ( int  scan_size,
enum scan_type  type 
)
static

Definition at line 1312 of file ft2232.c.

References DIV_ROUND_UP, and SCAN_OUT.

Referenced by ft2232_execute_scan().

static int ft2232_predict_scan_out ( int  scan_size,
enum scan_type  type 
)
static
static int ft2232_quit ( void  )
static

Definition at line 3147 of file ft2232.c.

References ERROR_OK, ft2232_buffer, and NULL.

static int ft2232_read ( uint8_t *  buf,
uint32_t  size,
uint32_t *  bytes_read 
)
static
static void ft2232_read_scan ( enum scan_type  type,
uint8_t *  buffer,
int  scan_size 
)
static

Definition at line 755 of file ft2232.c.

References buffer_read().

Referenced by ft2232_send_and_recv().

static int ft2232_speed ( int  speed)
static
static int ft2232_speed_div ( int  speed,
int *  khz 
)
static

Definition at line 694 of file ft2232.c.

References ERROR_OK, ft2232_max_tck, RTCK_SPEED, and speed.

static int ft2232_stableclocks ( int  num_cycles,
struct jtag_command cmd 
)
static

Send out num_cycles on the TCK line while the TAP(s) are in a stable state.

Calling code must ensure that current state is stable, that verification is not done in here.

Parameters
num_cyclesThe number of clocks cycles to send.
cmdThe command to send.
Returns
ERROR_OK on success, or ERROR_JTAG_QUEUE_FAILED on failure.

Definition at line 3281 of file ft2232.c.

References buffer_write(), jtag_command::cmd, ERROR_JTAG_QUEUE_FAILED, ERROR_OK, FT2232_BUFFER_SIZE, ft2232_buffer_size, ft2232_send_and_recv(), require_send, tap_get_state(), and TAP_RESET.

Referenced by ft2232_execute_stableclocks().

static int ft2232_write ( uint8_t *  buf,
int  size,
uint32_t *  bytes_written 
)
static
static void ftx232_dbus_init ( void  )
inlinestatic

Updates defaults for DBUS signals: the four JTAG signals (TCK, TDI, TDO, TMS) and * the four GPIOL signals.

Definition at line 2424 of file ft2232.c.

References low_direction, and low_output.

Referenced by flossjtag_init(), icdi_jtag_init(), lisa_l_init(), lm3s811_jtag_init(), signalyzer_init(), and usbjtag_init().

static int ftx232_dbus_write ( void  )
static

Initializes DBUS signals: the four JTAG signals (TCK, TDI, TDO, TMS), the four GPIOL signals.

Initialization covers value and direction, as customized for each layout.

Definition at line 2434 of file ft2232.c.

References ERROR_JTAG_INIT_FAILED, ERROR_OK, ft2232_set_data_bits_low_byte(), jtag_get_reset_config(), jtag_reset_config, LOG_ERROR, low_direction, low_output, nSRST, nSRSTnOE, nTRST, nTRSTnOE, RESET_SRST_PUSH_PULL, and RESET_TRST_OPEN_DRAIN.

Referenced by flossjtag_init(), icdi_jtag_init(), lisa_l_init(), lm3s811_jtag_init(), signalyzer_init(), and usbjtag_init().

static int ftx232h_adaptive_clocking ( bool  enable)
static

Definition at line 622 of file ft2232.c.

References ERROR_OK, ft2232_write(), LOG_DEBUG, and LOG_ERROR.

Referenced by ft2232_speed().

static int ftx232h_clk_divide_by_5 ( bool  enable)
static

Enable/disable the clk divide by 5 of the 60MHz master clock.

This result in a JTAG clock speed range of 91.553Hz-6MHz respective 457.763Hz-30MHz.

Definition at line 645 of file ft2232.c.

References ERROR_JTAG_INIT_FAILED, ERROR_OK, ft2232_max_tck, ft2232_write(), FTDI_2232C_MAX_TCK, FTDI_x232H_MAX_TCK, LOG_ERROR, and LOG_INFO.

Referenced by ft2232_init().

static void ftx23_reset ( int  trst,
int  srst 
)
static
static int get_tms_buffer_requirements ( int  bit_count)
inlinestatic

Function get_tms_buffer_requirements returns what clock_tms() will consume if called with same bit_count.

Definition at line 492 of file ft2232.c.

Referenced by ft2232_predict_scan_out().

static int icdi_jtag_init ( void  )
static
static void icebear_jtag_reset ( int  trst,
int  srst 
)
static
static void jtagkey_reset ( int  trst,
int  srst 
)
static
static void ktlink_blink ( void  )
static

Definition at line 4214 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

static void ktlink_reset ( int  trst,
int  srst 
)
static
static void lisa_l_blink ( void  )
static

Definition at line 3117 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

static int lm3s811_jtag_init ( void  )
static
static void minimodule_reset ( int  trst,
int  srst 
)
static

Definition at line 1494 of file ft2232.c.

References buffer_write(), LOG_DEBUG, low_direction, low_output, and nSRST.

static void move_to_state ( tap_state_t  goal_state)
static

Function move_to_state moves the TAP controller from the current state to a goal_state through a path given by tap_get_tms_path().

State transition logging is performed by delegation to clock_tms().

Parameters
goal_stateis the destination state for the move.

Definition at line 505 of file ft2232.c.

References clock_tms(), DEBUG_JTAG_IO, tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), and tap_state_name().

Referenced by ft2232_add_scan(), ft2232_execute_runtest(), ft2232_execute_statemove(), and ft2232_large_scan().

static void olimex_jtag_blink ( void  )
static

Definition at line 3067 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

static void olimex_jtag_reset ( int  trst,
int  srst 
)
static
static void redbee_reset ( int  trst,
int  srst 
)
static
static void sheevaplug_reset ( int  trst,
int  srst 
)
static

Definition at line 1583 of file ft2232.c.

References buffer_write(), high_direction, high_output, LOG_DEBUG, nSRSTnOE, and nTRST.

static void signalyzer_h_blink ( void  )
static

Definition at line 4118 of file ft2232.c.

References signalyzer_h_led_set(), and SIGNALYZER_LED_RED.

static int signalyzer_h_ctrl_write ( int  address,
unsigned short  value 
)
static

Definition at line 3459 of file ft2232.c.

Referenced by signalyzer_h_init(), and signalyzer_h_led_set().

static int signalyzer_h_led_set ( unsigned char  channel,
unsigned char  led,
int  on_time_ms,
int  off_time_ms,
unsigned char  cycles 
)
static
static int signalyzer_init ( void  )
static

Definition at line 2540 of file ft2232.c.

References ftx232_dbus_init(), ftx232_dbus_write(), nSRST, nSRSTnOE, nTRST, and nTRSTnOE.

static void stm32stick_reset ( int  trst,
int  srst 
)
static

Definition at line 1555 of file ft2232.c.

References buffer_write(), high_direction, high_output, LOG_DEBUG, low_direction, low_output, nSRST, and nTRST.

static void turtle_jtag_blink ( void  )
static

Definition at line 3102 of file ft2232.c.

References buffer_write(), high_direction, and high_output.

static void turtle_reset ( int  trst,
int  srst 
)
static

Definition at line 1512 of file ft2232.c.

References buffer_write(), LOG_DEBUG, LOG_ERROR, low_direction, low_output, and nSRST.

static int usbjtag_init ( void  )
static

Definition at line 2462 of file ft2232.c.

References ftx232_dbus_init(), ftx232_dbus_write(), nSRST, nSRSTnOE, nTRST, and nTRSTnOE.

static void xds100v2_reset ( int  trst,
int  srst 
)
static

Variable Documentation

struct jtag_command* first_unsent
static

Definition at line 381 of file ft2232.c.

uint8_t* ft2232_buffer
static
int ft2232_channel = INTERFACE_ANY
static

Definition at line 159 of file ft2232.c.

Referenced by COMMAND_HANDLER(), and ft2232_init().

struct command_registration ft2232_command_handlers[]
static

Definition at line 4251 of file ft2232.c.

char* ft2232_device_desc
static

Definition at line 155 of file ft2232.c.

Referenced by COMMAND_HANDLER(), and signalyzer_h_init().

char* ft2232_device_desc_A
static

Definition at line 154 of file ft2232.c.

Referenced by COMMAND_HANDLER().

int ft2232_expect_read
static

Definition at line 408 of file ft2232.c.

Referenced by ft2232_execute_queue(), ft2232_execute_scan(), and ft2232_send_and_recv().

struct jtag_interface ft2232_interface
Initial value:
= {
.name = "ft2232",
.supported = DEBUG_CAP_TMS_SEQ,
.transports = jtag_only,
.init = ft2232_init,
.quit = ft2232_quit,
.speed = ft2232_speed,
.speed_div = ft2232_speed_div,
.khz = ft2232_khz,
.execute_queue = ft2232_execute_queue,
}

Definition at line 4298 of file ft2232.c.

uint8_t ft2232_latency = 2
static

Definition at line 157 of file ft2232.c.

Referenced by COMMAND_HANDLER().

struct ft2232_layout ft2232_layouts[]
static

Definition at line 232 of file ft2232.c.

unsigned ft2232_max_tck = FTDI_2232C_MAX_TCK
static

Definition at line 158 of file ft2232.c.

Referenced by ft2232_khz(), ft2232_speed_div(), and ftx232h_clk_divide_by_5().

uint16_t ft2232_pid[MAX_USB_IDS+1] = { 0x6010, 0 }
static

Definition at line 164 of file ft2232.c.

Referenced by COMMAND_HANDLER(), and ft2232_init().

int ft2232_read_pointer
static

Definition at line 407 of file ft2232.c.

Referenced by buffer_read(), and ft2232_send_and_recv().

char* ft2232_serial
static

Definition at line 156 of file ft2232.c.

Referenced by COMMAND_HANDLER().

uint16_t ft2232_vid[MAX_USB_IDS+1] = { 0x0403, 0 }
static

Definition at line 163 of file ft2232.c.

Referenced by COMMAND_HANDLER(), and ft2232_init().

struct ft2232_layout* layout
static

the layout being used with this debug session

Definition at line 359 of file ft2232.c.

Referenced by lpc32xx_read_page_slc(), and lpc32xx_write_page_slc().

unsigned int signalyzer_h_adapter_type
static

Definition at line 3421 of file ft2232.c.

unsigned char signalyzer_h_side
static

Definition at line 3420 of file ft2232.c.