OpenOCD
|
Go to the source code of this file.
Macros | |
#define | FT232R_BIT_COUNT 8 |
FT232R GPIO bit number to RS232 name. More... | |
#define | FT232R_BUF_SIZE_EXTRA 4096 |
#define | IN_EP 0x02 |
#define | OUT_EP 0x81 |
#define | SIO_ERASE_EEPROM 0x92 |
#define | SIO_GET_LATENCY_TIMER 10 |
#define | SIO_MODEM_CTRL 1 /* Set the modem control register */ |
#define | SIO_POLL_MODEM_STATUS 5 |
#define | SIO_READ_EEPROM 0x90 |
#define | SIO_READ_PINS 12 |
#define | SIO_RESET 0 /* Reset the port */ |
#define | SIO_SET_BAUD_RATE 3 /* Set baud rate */ |
#define | SIO_SET_BITMODE 11 |
#define | SIO_SET_DATA 4 /* Set the data characteristics of the port */ |
#define | SIO_SET_ERROR_CHAR 7 |
#define | SIO_SET_EVENT_CHAR 6 |
#define | SIO_SET_FLOW_CTRL 2 /* Set flow control register */ |
#define | SIO_SET_LATENCY_TIMER 9 |
#define | SIO_WRITE_EEPROM 0x91 |
Functions | |
COMMAND_HANDLER (ft232r_handle_jtag_nums_command) | |
COMMAND_HANDLER (ft232r_handle_restore_serial_command) | |
COMMAND_HANDLER (ft232r_handle_srst_num_command) | |
COMMAND_HANDLER (ft232r_handle_tck_num_command) | |
COMMAND_HANDLER (ft232r_handle_tdi_num_command) | |
COMMAND_HANDLER (ft232r_handle_tdo_num_command) | |
COMMAND_HANDLER (ft232r_handle_tms_num_command) | |
COMMAND_HANDLER (ft232r_handle_trst_num_command) | |
COMMAND_HANDLER (ft232r_handle_vid_pid_command) | |
static int | ft232r_bit_name_to_number (const char *name) |
static char * | ft232r_bit_number_to_name (int bit) |
static void | ft232r_increase_buf_size (size_t new_buf_size) |
static int | ft232r_init (void) |
static int | ft232r_khz (int khz, int *divisor) |
static int | ft232r_quit (void) |
static void | ft232r_reset (int trst, int srst) |
Control /TRST and /SYSRST pins. More... | |
static int | ft232r_send_recv (void) |
Perform sync bitbang output/input transaction. More... | |
static int | ft232r_speed (int divisor) |
static int | ft232r_speed_div (int divisor, int *khz) |
static void | ft232r_write (int tck, int tms, int tdi) |
Add one TCK/TMS/TDI sample to send buffer. More... | |
static void | syncbb_end_state (tap_state_t state) |
static int | syncbb_execute_queue (struct jtag_command *cmd_queue) |
static int | syncbb_execute_tms (struct jtag_command *cmd) |
Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine. More... | |
static void | syncbb_path_move (struct pathmove_command *cmd) |
static void | syncbb_runtest (unsigned int num_cycles) |
static void | syncbb_scan (bool ir_scan, enum scan_type type, uint8_t *buffer, int scan_size) |
static void | syncbb_stableclocks (unsigned int num_cycles) |
Function syncbb_stableclocks issues a number of clock cycles while staying in a stable state. More... | |
static void | syncbb_state_move (int skip) |
Variables | |
static struct libusb_device_handle * | adapter |
struct adapter_driver | ft232r_adapter_driver |
static char * | ft232r_bit_name_array [FT232R_BIT_COUNT] |
static size_t | ft232r_buf_size = FT232R_BUF_SIZE_EXTRA |
static const struct command_registration | ft232r_command_handlers [] |
static struct jtag_interface | ft232r_interface |
static uint8_t * | ft232r_output |
static size_t | ft232r_output_len |
static uint16_t | ft232r_pid = 0x6001 |
static uint16_t | ft232r_restore_bitmode = 0xFFFF |
0xFFFF disables restore by default, after exit serial port will not work. More... | |
static const struct command_registration | ft232r_subcommand_handlers [] |
static uint16_t | ft232r_vid = 0x0403 |
static int | nsysrst_gpio = 6 |
static int | ntrst_gpio = 4 |
static int | tck_gpio |
static int | tdi_gpio = 1 |
static int | tdo_gpio = 2 |
static int | tms_gpio = 3 |
#define FT232R_BIT_COUNT 8 |
#define SIO_MODEM_CTRL 1 /* Set the modem control register */ |
#define SIO_SET_DATA 4 /* Set the data characteristics of the port */ |
COMMAND_HANDLER | ( | ft232r_handle_jtag_nums_command | ) |
Definition at line 404 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), tck_gpio, tdi_gpio, tdo_gpio, and tms_gpio.
COMMAND_HANDLER | ( | ft232r_handle_restore_serial_command | ) |
Definition at line 529 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and ft232r_restore_bitmode.
COMMAND_HANDLER | ( | ft232r_handle_srst_num_command | ) |
Definition at line 513 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and nsysrst_gpio.
COMMAND_HANDLER | ( | ft232r_handle_tck_num_command | ) |
Definition at line 433 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and tck_gpio.
COMMAND_HANDLER | ( | ft232r_handle_tdi_num_command | ) |
Definition at line 481 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and tdi_gpio.
COMMAND_HANDLER | ( | ft232r_handle_tdo_num_command | ) |
Definition at line 465 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and tdo_gpio.
COMMAND_HANDLER | ( | ft232r_handle_tms_num_command | ) |
Definition at line 449 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and tms_gpio.
COMMAND_HANDLER | ( | ft232r_handle_trst_num_command | ) |
Definition at line 497 of file ft232r.c.
References CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, ft232r_bit_name_to_number(), ft232r_bit_number_to_name(), and ntrst_gpio.
COMMAND_HANDLER | ( | ft232r_handle_vid_pid_command | ) |
Definition at line 388 of file ft232r.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, ERROR_OK, ft232r_pid, ft232r_vid, and LOG_WARNING.
|
static |
Definition at line 374 of file ft232r.c.
References FT232R_BIT_COUNT, ft232r_bit_name_array, and name.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 367 of file ft232r.c.
References bit(), FT232R_BIT_COUNT, and ft232r_bit_name_array.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 162 of file ft232r.c.
References ft232r_buf_size, FT232R_BUF_SIZE_EXTRA, and ft232r_output.
Referenced by ft232r_reset(), and ft232r_write().
|
static |
Definition at line 245 of file ft232r.c.
References adapter, adapter_get_required_serial(), ERROR_JTAG_INIT_FAILED, ERROR_OK, ft232r_buf_size, ft232r_output, ft232r_pid, ft232r_restore_bitmode, ft232r_vid, jtag_libusb_control_transfer(), jtag_libusb_open(), LOG_ERROR, nsysrst_gpio, ntrst_gpio, NULL, SIO_RESET, SIO_SET_BAUD_RATE, SIO_SET_BITMODE, SIO_SET_LATENCY_TIMER, tck_gpio, tdi_gpio, and tms_gpio.
|
static |
Definition at line 347 of file ft232r.c.
References ERROR_FAIL, ERROR_OK, and LOG_DEBUG.
|
static |
Definition at line 311 of file ft232r.c.
References adapter, ERROR_OK, ft232r_buf_size, FT232R_BUF_SIZE_EXTRA, ft232r_output, ft232r_restore_bitmode, jtag_libusb_close(), jtag_libusb_control_transfer(), LOG_ERROR, NULL, and SIO_SET_BITMODE.
|
static |
Control /TRST and /SYSRST pins.
Perform immediate bitbang transaction.
Definition at line 202 of file ft232r.c.
References ft232r_buf_size, ft232r_increase_buf_size(), ft232r_output, ft232r_output_len, ft232r_send_recv(), LOG_DEBUG, LOG_ERROR, nsysrst_gpio, and ntrst_gpio.
|
static |
Perform sync bitbang output/input transaction.
Before call, an array ft232r_output[] should be filled with data to send. Counter ft232r_output_len contains the number of bytes to send. On return, received data is put back to array ft232r_output[].
Definition at line 101 of file ft232r.c.
References adapter, ERROR_JTAG_DEVICE_ERROR, ERROR_OK, ft232r_output, ft232r_output_len, IN_EP, jtag_libusb_bulk_read(), jtag_libusb_bulk_write(), LOG_ERROR, and OUT_EP.
Referenced by ft232r_reset(), and syncbb_scan().
|
static |
Definition at line 229 of file ft232r.c.
References adapter, ERROR_JTAG_DEVICE_ERROR, ERROR_OK, jtag_libusb_control_transfer(), LOG_DEBUG, LOG_ERROR, NULL, and SIO_SET_BAUD_RATE.
|
static |
|
static |
Add one TCK/TMS/TDI sample to send buffer.
Definition at line 178 of file ft232r.c.
References ft232r_buf_size, ft232r_increase_buf_size(), ft232r_output, ft232r_output_len, LOG_ERROR, nsysrst_gpio, ntrst_gpio, tck_gpio, tdi_gpio, and tms_gpio.
Referenced by syncbb_execute_tms(), syncbb_path_move(), syncbb_runtest(), syncbb_scan(), syncbb_stableclocks(), and syncbb_state_move().
|
static |
Definition at line 625 of file ft232r.c.
References LOG_ERROR, state, tap_is_state_stable(), and tap_set_end_state().
Referenced by syncbb_runtest(), and syncbb_scan().
|
static |
|
static |
Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine.
Definition at line 655 of file ft232r.c.
References bits, cmd, ERROR_OK, ft232r_write(), and LOG_DEBUG_IO.
|
static |
Definition at line 673 of file ft232r.c.
References cmd, ft232r_write(), LOG_ERROR, tap_get_state(), tap_set_end_state(), tap_set_state, tap_state_name(), and tap_state_transition().
|
static |
Definition at line 705 of file ft232r.c.
References ft232r_write(), syncbb_end_state(), syncbb_state_move(), tap_get_end_state(), tap_get_state(), and TAP_IDLE.
|
static |
Definition at line 748 of file ft232r.c.
References buffer, ft232r_output, ft232r_output_len, ft232r_send_recv(), ft232r_write(), SCAN_IN, SCAN_OUT, syncbb_end_state(), syncbb_state_move(), TAP_DRSHIFT, tap_get_end_state(), tap_get_state(), TAP_IRSHIFT, tdo_gpio, and type.
|
static |
Function syncbb_stableclocks issues a number of clock cycles while staying in a stable state.
Because the TMS value required to stay in the RESET state is a 1, whereas the TMS value required to stay in any of the other stable states is a 0, this function checks the current stable state to decide on the value of TMS to use.
Definition at line 737 of file ft232r.c.
References ft232r_write(), tap_get_state(), and TAP_RESET.
|
static |
Definition at line 635 of file ft232r.c.
References ft232r_write(), tap_get_end_state(), tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), and tap_set_state.
Referenced by syncbb_runtest(), and syncbb_scan().
|
static |
Definition at line 63 of file ft232r.c.
Referenced by adapter_debug_entry(), adapter_halt(), adapter_load_core_reg_u32(), adapter_poll(), adapter_read_memory(), adapter_resume(), adapter_step(), adapter_store_core_reg_u32(), adapter_write_memory(), ft232r_init(), ft232r_quit(), ft232r_send_recv(), ft232r_speed(), hl_assert_reset(), hl_layout_init(), and hl_layout_open().
struct adapter_driver ft232r_adapter_driver |
|
static |
Definition at line 72 of file ft232r.c.
Referenced by ft232r_bit_name_to_number(), and ft232r_bit_number_to_name().
|
static |
Definition at line 89 of file ft232r.c.
Referenced by ft232r_increase_buf_size(), ft232r_init(), ft232r_quit(), ft232r_reset(), and ft232r_write().
|
static |
|
static |
|
static |
Definition at line 65 of file ft232r.c.
Referenced by ft232r_increase_buf_size(), ft232r_init(), ft232r_quit(), ft232r_reset(), ft232r_send_recv(), ft232r_write(), and syncbb_scan().
|
static |
Definition at line 66 of file ft232r.c.
Referenced by ft232r_reset(), ft232r_send_recv(), ft232r_write(), and syncbb_scan().
|
static |
Definition at line 62 of file ft232r.c.
Referenced by COMMAND_HANDLER(), and ft232r_init().
|
static |
0xFFFF disables restore by default, after exit serial port will not work.
0x15 sets TXD RTS DTR as outputs, after exit serial port will continue to work.
Definition at line 93 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), and ft232r_quit().
|
static |
|
static |
Definition at line 61 of file ft232r.c.
Referenced by COMMAND_HANDLER(), and ft232r_init().
|
static |
Definition at line 88 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), ft232r_reset(), and ft232r_write().
|
static |
Definition at line 87 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), ft232r_reset(), and ft232r_write().
|
static |
Definition at line 83 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), and ft232r_write().
|
static |
Definition at line 84 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), and ft232r_write().
|
static |
Definition at line 85 of file ft232r.c.
Referenced by COMMAND_HANDLER(), and syncbb_scan().
|
static |
Definition at line 86 of file ft232r.c.
Referenced by COMMAND_HANDLER(), ft232r_init(), and ft232r_write().