OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | mpsse_ctx |
struct | transfer_result |
Macros | |
#define | BITMODE_MPSSE 0x02 |
#define | DEBUG_PRINT_BUF(buf, len) |
#define | FTDI_DEVICE_IN_REQTYPE (0x80 | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE) |
#define | FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE) |
#define | LIBUSB_CALL |
#define | SIO_GET_LATENCY_TIMER_REQUEST 0x0A |
#define | SIO_RESET_PURGE_RX 1 |
#define | SIO_RESET_PURGE_TX 2 |
#define | SIO_RESET_REQUEST 0x00 |
#define | SIO_RESET_SIO 0 |
#define | SIO_SET_BITMODE_REQUEST 0x0B |
#define | SIO_SET_LATENCY_TIMER_REQUEST 0x09 |
Functions | |
static unsigned int | buffer_add_read (struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int bit_count, unsigned int offset) |
static unsigned int | buffer_read_space (struct mpsse_ctx *ctx) |
static unsigned int | buffer_write (struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, unsigned int bit_count) |
static void | buffer_write_byte (struct mpsse_ctx *ctx, uint8_t data) |
static unsigned int | buffer_write_space (struct mpsse_ctx *ctx) |
static bool | device_location_equal (struct libusb_device *device, const char *location) |
void | mpsse_clock_data (struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in, unsigned int in_offset, unsigned int length, uint8_t mode) |
void | mpsse_clock_data_in (struct mpsse_ctx *ctx, uint8_t *in, unsigned int in_offset, unsigned int length, uint8_t mode) |
void | mpsse_clock_data_out (struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, unsigned int length, uint8_t mode) |
void | mpsse_clock_tms_cs (struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, uint8_t *in, unsigned int in_offset, unsigned int length, bool tdi, uint8_t mode) |
void | mpsse_clock_tms_cs_out (struct mpsse_ctx *ctx, const uint8_t *out, unsigned int out_offset, unsigned int length, bool tdi, uint8_t mode) |
void | mpsse_close (struct mpsse_ctx *ctx) |
int | mpsse_divide_by_5_config (struct mpsse_ctx *ctx, bool enable) |
int | mpsse_flush (struct mpsse_ctx *ctx) |
bool | mpsse_is_high_speed (struct mpsse_ctx *ctx) |
void | mpsse_loopback_config (struct mpsse_ctx *ctx, bool enable) |
struct mpsse_ctx * | mpsse_open (const uint16_t vids[], const uint16_t pids[], const char *description, const char *serial, const char *location, int channel) |
void | mpsse_purge (struct mpsse_ctx *ctx) |
void | mpsse_read_data_bits_high_byte (struct mpsse_ctx *ctx, uint8_t *data) |
void | mpsse_read_data_bits_low_byte (struct mpsse_ctx *ctx, uint8_t *data) |
int | mpsse_rtck_config (struct mpsse_ctx *ctx, bool enable) |
void | mpsse_set_data_bits_high_byte (struct mpsse_ctx *ctx, uint8_t data, uint8_t dir) |
void | mpsse_set_data_bits_low_byte (struct mpsse_ctx *ctx, uint8_t data, uint8_t dir) |
void | mpsse_set_divisor (struct mpsse_ctx *ctx, uint16_t divisor) |
int | mpsse_set_frequency (struct mpsse_ctx *ctx, int frequency) |
static bool | open_matching_device (struct mpsse_ctx *ctx, const uint16_t vids[], const uint16_t pids[], const char *product, const char *serial, const char *location) |
static LIBUSB_CALL void | read_cb (struct libusb_transfer *transfer) |
static void | single_byte_boolean_helper (struct mpsse_ctx *ctx, bool var, uint8_t val_if_true, uint8_t val_if_false) |
static bool | string_descriptor_equal (struct libusb_device_handle *device, uint8_t str_index, const char *string) |
static LIBUSB_CALL void | write_cb (struct libusb_transfer *transfer) |
#define DEBUG_PRINT_BUF | ( | buf, | |
len | |||
) |
#define FTDI_DEVICE_IN_REQTYPE (0x80 | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE) |
#define FTDI_DEVICE_OUT_REQTYPE (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE) |
|
static |
Definition at line 475 of file mpsse.c.
References bit_copy_queued(), DIV_ROUND_UP, LOG_DEBUG_IO, offset, mpsse_ctx::read_buffer, mpsse_ctx::read_count, mpsse_ctx::read_queue, and mpsse_ctx::read_size.
Referenced by mpsse_clock_data(), mpsse_clock_tms_cs(), mpsse_read_data_bits_high_byte(), and mpsse_read_data_bits_low_byte().
|
static |
Definition at line 453 of file mpsse.c.
References mpsse_ctx::read_count, and mpsse_ctx::read_size.
Referenced by mpsse_clock_data(), mpsse_clock_tms_cs(), mpsse_read_data_bits_high_byte(), and mpsse_read_data_bits_low_byte().
|
static |
Definition at line 465 of file mpsse.c.
References bit_copy(), DIV_ROUND_UP, LOG_DEBUG_IO, mpsse_ctx::write_buffer, mpsse_ctx::write_count, and mpsse_ctx::write_size.
Referenced by mpsse_clock_data().
|
static |
Definition at line 458 of file mpsse.c.
References LOG_DEBUG_IO, mpsse_ctx::write_buffer, mpsse_ctx::write_count, and mpsse_ctx::write_size.
Referenced by mpsse_clock_data(), mpsse_clock_tms_cs(), mpsse_flush(), mpsse_read_data_bits_high_byte(), mpsse_read_data_bits_low_byte(), mpsse_set_data_bits_high_byte(), mpsse_set_data_bits_low_byte(), mpsse_set_divisor(), and single_byte_boolean_helper().
|
static |
Definition at line 447 of file mpsse.c.
References mpsse_ctx::write_count, and mpsse_ctx::write_size.
Referenced by mpsse_clock_data(), mpsse_clock_tms_cs(), mpsse_read_data_bits_high_byte(), mpsse_read_data_bits_low_byte(), mpsse_set_data_bits_high_byte(), mpsse_set_data_bits_low_byte(), mpsse_set_divisor(), and single_byte_boolean_helper().
|
static |
void mpsse_clock_data | ( | struct mpsse_ctx * | ctx, |
const uint8_t * | out, | ||
unsigned int | out_offset, | ||
uint8_t * | in, | ||
unsigned int | in_offset, | ||
unsigned int | length, | ||
uint8_t | mode | ||
) |
Definition at line 498 of file mpsse.c.
References buffer_add_read(), buffer_read_space(), buffer_write(), buffer_write_byte(), buffer_write_space(), ERROR_OK, length, LOG_DEBUG_IO, mode, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_execute_scan(), mpsse_clock_data_in(), and mpsse_clock_data_out().
void mpsse_clock_data_in | ( | struct mpsse_ctx * | ctx, |
uint8_t * | in, | ||
unsigned int | in_offset, | ||
unsigned int | length, | ||
uint8_t | mode | ||
) |
Definition at line 492 of file mpsse.c.
References length, mode, mpsse_clock_data(), and NULL.
Referenced by ftdi_swd_queue_cmd().
void mpsse_clock_data_out | ( | struct mpsse_ctx * | ctx, |
const uint8_t * | out, | ||
unsigned int | out_offset, | ||
unsigned int | length, | ||
uint8_t | mode | ||
) |
Definition at line 486 of file mpsse.c.
References length, mode, mpsse_clock_data(), and NULL.
Referenced by ftdi_swd_queue_cmd(), and ftdi_swd_run_queue().
void mpsse_clock_tms_cs | ( | struct mpsse_ctx * | ctx, |
const uint8_t * | out, | ||
unsigned int | out_offset, | ||
uint8_t * | in, | ||
unsigned int | in_offset, | ||
unsigned int | length, | ||
bool | tdi, | ||
uint8_t | mode | ||
) |
Definition at line 575 of file mpsse.c.
References bit_copy(), buffer_add_read(), buffer_read_space(), buffer_write_byte(), buffer_write_space(), ERROR_OK, length, LOG_DEBUG_IO, mode, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_execute_scan(), and mpsse_clock_tms_cs_out().
void mpsse_clock_tms_cs_out | ( | struct mpsse_ctx * | ctx, |
const uint8_t * | out, | ||
unsigned int | out_offset, | ||
unsigned int | length, | ||
bool | tdi, | ||
uint8_t | mode | ||
) |
Definition at line 569 of file mpsse.c.
References length, mode, mpsse_clock_tms_cs(), and NULL.
Referenced by ftdi_execute_pathmove(), ftdi_execute_runtest(), ftdi_execute_scan(), ftdi_execute_stableclocks(), ftdi_execute_tms(), and move_to_state().
void mpsse_close | ( | struct mpsse_ctx * | ctx | ) |
Definition at line 405 of file mpsse.c.
References bit_copy_discard(), mpsse_ctx::read_buffer, mpsse_ctx::read_chunk, mpsse_ctx::read_queue, mpsse_ctx::usb_ctx, mpsse_ctx::usb_dev, and mpsse_ctx::write_buffer.
Referenced by ftdi_quit(), and mpsse_open().
int mpsse_divide_by_5_config | ( | struct mpsse_ctx * | ctx, |
bool | enable | ||
) |
Definition at line 729 of file mpsse.c.
References ERROR_FAIL, ERROR_OK, LOG_DEBUG, mpsse_is_high_speed(), and single_byte_boolean_helper().
Referenced by mpsse_set_frequency().
int mpsse_flush | ( | struct mpsse_ctx * | ctx | ) |
Definition at line 848 of file mpsse.c.
References bit_copy_discard(), bit_copy_execute(), buffer_write_byte(), transfer_result::ctx, transfer_result::done, ERROR_FAIL, ERROR_OK, mpsse_ctx::in_ep, keep_alive(), LOG_DEBUG_IO, LOG_ERROR, LOG_WARNING, mpsse_purge(), NULL, mpsse_ctx::out_ep, read_cb(), mpsse_ctx::read_chunk, mpsse_ctx::read_chunk_size, mpsse_ctx::read_count, mpsse_ctx::read_queue, mpsse_ctx::retval, start, timeval_ms(), transfer_result::transferred, timeval::tv_sec, timeval::tv_usec, mpsse_ctx::usb_ctx, mpsse_ctx::usb_dev, mpsse_ctx::usb_read_timeout, mpsse_ctx::usb_write_timeout, mpsse_ctx::write_buffer, write_cb(), and mpsse_ctx::write_count.
Referenced by COMMAND_HANDLER(), ftdi_execute_queue(), ftdi_execute_sleep(), ftdi_get_signal(), ftdi_initialize(), ftdi_reset(), ftdi_swd_run_queue(), mpsse_clock_data(), mpsse_clock_tms_cs(), mpsse_read_data_bits_high_byte(), mpsse_read_data_bits_low_byte(), mpsse_set_data_bits_high_byte(), mpsse_set_data_bits_low_byte(), mpsse_set_divisor(), and single_byte_boolean_helper().
bool mpsse_is_high_speed | ( | struct mpsse_ctx * | ctx | ) |
Definition at line 419 of file mpsse.c.
References mpsse_ctx::type, and TYPE_FT2232C.
Referenced by ftdi_khz(), mpsse_divide_by_5_config(), and mpsse_rtck_config().
void mpsse_loopback_config | ( | struct mpsse_ctx * | ctx, |
bool | enable | ||
) |
Definition at line 706 of file mpsse.c.
References LOG_DEBUG, and single_byte_boolean_helper().
Referenced by ftdi_initialize().
struct mpsse_ctx* mpsse_open | ( | const uint16_t | vids[], |
const uint16_t | pids[], | ||
const char * | description, | ||
const char * | serial, | ||
const char * | location, | ||
int | channel | ||
) |
Definition at line 330 of file mpsse.c.
References bit_copy_queue_init(), BITMODE_MPSSE, description, FTDI_DEVICE_OUT_REQTYPE, mpsse_ctx::index, mpsse_ctx::interface, LOG_ERROR, mpsse_close(), mpsse_purge(), NULL, open_matching_device(), mpsse_ctx::read_buffer, mpsse_ctx::read_chunk, mpsse_ctx::read_chunk_size, mpsse_ctx::read_queue, mpsse_ctx::read_size, serial, SIO_SET_BITMODE_REQUEST, SIO_SET_LATENCY_TIMER_REQUEST, mpsse_ctx::usb_ctx, mpsse_ctx::usb_dev, mpsse_ctx::usb_read_timeout, mpsse_ctx::usb_write_timeout, mpsse_ctx::write_buffer, and mpsse_ctx::write_size.
Referenced by ftdi_initialize().
void mpsse_purge | ( | struct mpsse_ctx * | ctx | ) |
Definition at line 424 of file mpsse.c.
References bit_copy_discard(), ERROR_OK, FTDI_DEVICE_OUT_REQTYPE, mpsse_ctx::index, LOG_DEBUG, LOG_ERROR, NULL, mpsse_ctx::read_count, mpsse_ctx::read_queue, mpsse_ctx::retval, SIO_RESET_PURGE_RX, SIO_RESET_PURGE_TX, SIO_RESET_REQUEST, mpsse_ctx::usb_dev, mpsse_ctx::usb_write_timeout, and mpsse_ctx::write_count.
Referenced by mpsse_flush(), and mpsse_open().
void mpsse_read_data_bits_high_byte | ( | struct mpsse_ctx * | ctx, |
uint8_t * | data | ||
) |
Definition at line 676 of file mpsse.c.
References buffer_add_read(), buffer_read_space(), buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_get_signal().
void mpsse_read_data_bits_low_byte | ( | struct mpsse_ctx * | ctx, |
uint8_t * | data | ||
) |
Definition at line 660 of file mpsse.c.
References buffer_add_read(), buffer_read_space(), buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_get_signal().
int mpsse_rtck_config | ( | struct mpsse_ctx * | ctx, |
bool | enable | ||
) |
Definition at line 740 of file mpsse.c.
References ERROR_FAIL, ERROR_OK, LOG_DEBUG, mpsse_is_high_speed(), and single_byte_boolean_helper().
Referenced by mpsse_set_frequency().
void mpsse_set_data_bits_high_byte | ( | struct mpsse_ctx * | ctx, |
uint8_t | data, | ||
uint8_t | dir | ||
) |
Definition at line 643 of file mpsse.c.
References buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_initialize(), and ftdi_set_signal().
void mpsse_set_data_bits_low_byte | ( | struct mpsse_ctx * | ctx, |
uint8_t | data, | ||
uint8_t | dir | ||
) |
Definition at line 626 of file mpsse.c.
References buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by ftdi_initialize(), ftdi_set_signal(), and ftdi_swd_swdio_en().
void mpsse_set_divisor | ( | struct mpsse_ctx * | ctx, |
uint16_t | divisor | ||
) |
Definition at line 712 of file mpsse.c.
References buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by mpsse_set_frequency().
int mpsse_set_frequency | ( | struct mpsse_ctx * | ctx, |
int | frequency | ||
) |
Definition at line 751 of file mpsse.c.
References ERROR_OK, LOG_DEBUG, mpsse_divide_by_5_config(), mpsse_rtck_config(), and mpsse_set_divisor().
Referenced by ftdi_initialize(), and ftdi_speed().
|
static |
Definition at line 152 of file mpsse.c.
References device, device_location_equal(), FTDI_DEVICE_OUT_REQTYPE, mpsse_ctx::in_ep, mpsse_ctx::index, mpsse_ctx::interface, jtag_libusb_match_ids(), LOG_ERROR, LOG_WARNING, mpsse_ctx::max_packet_size, NULL, mpsse_ctx::out_ep, serial, SIO_RESET_REQUEST, SIO_RESET_SIO, string_descriptor_equal(), mpsse_ctx::type, TYPE_FT2232C, TYPE_FT2232H, TYPE_FT2232HP, TYPE_FT2233HP, TYPE_FT232H, TYPE_FT232HP, TYPE_FT233HP, TYPE_FT4232H, TYPE_FT4232HA, TYPE_FT4232HP, TYPE_FT4233HP, mpsse_ctx::usb_ctx, mpsse_ctx::usb_dev, and mpsse_ctx::usb_write_timeout.
Referenced by mpsse_open().
|
static |
Definition at line 789 of file mpsse.c.
References transfer_result::ctx, DEBUG_PRINT_BUF, DIV_ROUND_UP, transfer_result::done, LOG_DEBUG_IO, mpsse_ctx::max_packet_size, mpsse_ctx::read_buffer, mpsse_ctx::read_chunk, mpsse_ctx::read_count, and transfer_result::transferred.
Referenced by mpsse_flush().
|
static |
Definition at line 692 of file mpsse.c.
References buffer_write_byte(), buffer_write_space(), ERROR_OK, LOG_DEBUG_IO, mpsse_flush(), and mpsse_ctx::retval.
Referenced by mpsse_divide_by_5_config(), mpsse_loopback_config(), and mpsse_rtck_config().
|
static |
Definition at line 79 of file mpsse.c.
References device, and LOG_ERROR.
Referenced by open_matching_device().
|
static |
Definition at line 827 of file mpsse.c.
References transfer_result::ctx, DEBUG_PRINT_BUF, transfer_result::done, LOG_DEBUG_IO, transfer_result::transferred, mpsse_ctx::write_buffer, and mpsse_ctx::write_count.
Referenced by mpsse_flush().