OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | drvs_map |
struct | ublast_info |
Macros | |
#define | BUF_LEN 4096 |
#define | CMD_COPY_TDO_BUFFER 0x5F |
#define | LED (1 << 5) |
#define | MAX_PACKET_SIZE 64 |
#define | NCE (1 << 2) |
#define | NCS (1 << 3) |
#define | READ (1 << 6) |
#define | READ_TDO (1 << 0) |
#define | SHMODE (1 << 7) |
#define | TCK (1 << 0) |
#define | TDI (1 << 4) |
#define | TMS (1 << 1) |
Enumerations | |
enum | gpio_steer { FIXED_0 = 0 , FIXED_1 , SRST , TRST } |
Functions | |
COMMAND_HANDLER (ublast_firmware_command) | |
COMMAND_HANDLER (ublast_handle_lowlevel_drv_command) | |
COMMAND_HANDLER (ublast_handle_pin_command) | |
COMMAND_HANDLER (ublast_handle_vid_pid_command) | |
static char * | hexdump (uint8_t *buf, unsigned int size) |
static int | nb_buf_remaining (void) |
static int | ublast_buf_read (uint8_t *buf, unsigned int size, uint32_t *bytes_read) |
static int | ublast_buf_write (uint8_t *buf, int size, uint32_t *bytes_written) |
static uint8_t | ublast_build_out (enum scan_type type) |
ublast_build_out - build bitbang mode output byte More... | |
static void | ublast_clock_tdi (int tdi, enum scan_type type) |
ublast_clock_tdi - Output a TDI with bitbang mode More... | |
static void | ublast_clock_tdi_flip_tms (int tdi, enum scan_type type) |
ublast_clock_tdi_flip_tms - Output a TDI with bitbang mode, change JTAG state More... | |
static void | ublast_clock_tms (int tms) |
ublast_clock_tms - clock a TMS transition More... | |
static bool | ublast_compute_pin (enum gpio_steer steer) |
ublast_compute_pin - compute if gpio should be asserted More... | |
static int | ublast_execute_queue (struct jtag_command *cmd_queue) |
static void | ublast_flush_buffer (void) |
static void | ublast_idle_clock (void) |
ublast_idle_clock - put back TCK to low level More... | |
static int | ublast_init (void) |
ublast_init - Initialize the Altera device More... | |
static void | ublast_initial_wipeout (void) |
static void | ublast_path_move (struct pathmove_command *cmd) |
ublast_path_move - write a TMS sequence transition to JTAG More... | |
static void | ublast_queue_byte (uint8_t abyte) |
ublast_queue_byte - queue one 'bitbang mode' byte for USB Blaster More... | |
static void | ublast_queue_bytes (uint8_t *bytes, int nb_bytes) |
ublast_queue_bytes - queue bytes for the USB Blaster More... | |
static void | ublast_queue_tdi (uint8_t *bits, int nb_bits, enum scan_type scan) |
ublast_queue_tdi - short description More... | |
static int | ublast_quit (void) |
ublast_quit - Release the Altera device More... | |
static int | ublast_read_bitbang_tdos (uint8_t *buf, int nb_bits) |
ublast_read_bitbang_tdos - read TDO of bitbang writes More... | |
static int | ublast_read_byteshifted_tdos (uint8_t *buf, int nb_bytes) |
ublast_read_byteshifted_tdos - read TDO of byteshift writes More... | |
static void | ublast_reset (int trst, int srst) |
ublast_reset - reset the JTAG device is possible More... | |
static void | ublast_runtest (unsigned int num_cycles, tap_state_t state) |
static int | ublast_scan (struct scan_command *cmd) |
ublast_scan - launches a DR-scan or IR-scan More... | |
static void | ublast_stableclocks (unsigned int num_cycles) |
static void | ublast_state_move (tap_state_t state, int skip) |
ublast_state_move - move JTAG state to the target state More... | |
static void | ublast_tms (struct tms_command *cmd) |
ublast_tms - write a tms command More... | |
static void | ublast_tms_seq (const uint8_t *bits, int nb_bits, int skip) |
ublast_tms_seq - write a TMS sequence transition to JTAG More... | |
static void | ublast_usleep (int us) |
Variables | |
static struct ublast_info | info |
static struct drvs_map | lowlevel_drivers_map [] |
static const struct command_registration | ublast_command_handlers [] |
static const struct command_registration | ublast_subcommand_handlers [] |
struct adapter_driver | usb_blaster_adapter_driver |
static struct jtag_interface | usb_blaster_interface |
#define BUF_LEN 4096 |
Definition at line 87 of file usb_blaster.c.
#define CMD_COPY_TDO_BUFFER 0x5F |
Definition at line 90 of file usb_blaster.c.
#define LED (1 << 5) |
Definition at line 238 of file usb_blaster.c.
#define MAX_PACKET_SIZE 64 |
Definition at line 80 of file usb_blaster.c.
#define NCE (1 << 2) |
Definition at line 235 of file usb_blaster.c.
#define NCS (1 << 3) |
Definition at line 236 of file usb_blaster.c.
#define READ (1 << 6) |
Definition at line 239 of file usb_blaster.c.
#define READ_TDO (1 << 0) |
Definition at line 241 of file usb_blaster.c.
#define SHMODE (1 << 7) |
Definition at line 240 of file usb_blaster.c.
#define TCK (1 << 0) |
Definition at line 233 of file usb_blaster.c.
#define TDI (1 << 4) |
Definition at line 237 of file usb_blaster.c.
#define TMS (1 << 1) |
Definition at line 234 of file usb_blaster.c.
enum gpio_steer |
Enumerator | |
---|---|
FIXED_0 | |
FIXED_1 | |
SRST | |
TRST |
Definition at line 92 of file usb_blaster.c.
COMMAND_HANDLER | ( | ublast_firmware_command | ) |
Definition at line 997 of file usb_blaster.c.
COMMAND_HANDLER | ( | ublast_handle_lowlevel_drv_command | ) |
Definition at line 987 of file usb_blaster.c.
References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, info, and ublast_info::lowlevel_name.
COMMAND_HANDLER | ( | ublast_handle_pin_command | ) |
Definition at line 921 of file usb_blaster.c.
References CMD_ARGC, CMD_ARGV, CMD_NAME, ublast_info::drv, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, FIXED_0, FIXED_1, info, LOG_ERROR, LOG_INFO, NULL, ublast_info::pin6, ublast_info::pin8, SCAN_OUT, SRST, TRST, ublast_build_out(), ublast_flush_buffer(), and ublast_queue_byte().
COMMAND_HANDLER | ( | ublast_handle_vid_pid_command | ) |
Definition at line 896 of file usb_blaster.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, ERROR_OK, info, LOG_WARNING, ublast_info::ublast_pid, ublast_info::ublast_pid_uninit, ublast_info::ublast_vid, and ublast_info::ublast_vid_uninit.
|
static |
Definition at line 151 of file usb_blaster.c.
References size.
Referenced by ublast_buf_read(), ublast_buf_write(), and ublast_scan().
|
static |
Definition at line 183 of file usb_blaster.c.
References BUF_LEN, ublast_info::bufidx, and info.
Referenced by ublast_queue_byte(), and ublast_queue_bytes().
|
static |
Definition at line 161 of file usb_blaster.c.
References ublast_info::drv, hexdump(), info, LOG_DEBUG_IO, ublast_lowlevel::read, and size.
Referenced by ublast_read_bitbang_tdos(), and ublast_read_byteshifted_tdos().
|
static |
Definition at line 172 of file usb_blaster.c.
References ublast_info::drv, hexdump(), info, LOG_DEBUG_IO, size, and ublast_lowlevel::write.
Referenced by ublast_flush_buffer(), ublast_initial_wipeout(), and ublast_quit().
|
static |
ublast_build_out - build bitbang mode output byte
type | says if reading back TDO is required |
Returns the compute bitbang mode byte
Definition at line 289 of file usb_blaster.c.
References info, LED, NCE, NCS, ublast_info::pin6, ublast_info::pin8, READ, SCAN_IN, SCAN_IO, ublast_info::tdi, TDI, ublast_info::tms, TMS, type, and ublast_compute_pin().
Referenced by COMMAND_HANDLER(), ublast_clock_tdi(), ublast_clock_tdi_flip_tms(), ublast_clock_tms(), ublast_idle_clock(), ublast_initial_wipeout(), and ublast_reset().
|
static |
ublast_clock_tdi - Output a TDI with bitbang mode
tdi | the TDI bit to be shifted out |
type | scan type (ie. does a readback of TDO is required) |
Output a TDI bit and assert clock to push it into the JTAG device :
If a TDO is to be read back, the required read is requested (bitbang mode), and the USB Blaster will send back a byte with bit0 representing the TDO.
Definition at line 363 of file usb_blaster.c.
References info, LOG_DEBUG_IO, SCAN_OUT, TCK, ublast_info::tdi, type, ublast_build_out(), and ublast_queue_byte().
Referenced by ublast_queue_tdi().
|
static |
ublast_clock_tdi_flip_tms - Output a TDI with bitbang mode, change JTAG state
tdi | the TDI bit to be shifted out |
type | scan type (ie. does a readback of TDO is required) |
This function is the same as ublast_clock_tdi(), but it changes also the TMS while output the TDI. This should be the last TDI output of a TDI sequence, which will change state from :
Definition at line 388 of file usb_blaster.c.
References info, LOG_DEBUG_IO, SCAN_OUT, TCK, ublast_info::tdi, ublast_info::tms, type, ublast_build_out(), and ublast_queue_byte().
Referenced by ublast_queue_tdi().
|
static |
ublast_clock_tms - clock a TMS transition
tms | the TMS to be sent |
Triggers a TMS transition (ie. one JTAG TAP state move).
Definition at line 325 of file usb_blaster.c.
References info, LOG_DEBUG_IO, SCAN_OUT, TCK, ublast_info::tdi, ublast_info::tms, ublast_build_out(), and ublast_queue_byte().
Referenced by ublast_path_move(), and ublast_tms_seq().
|
static |
ublast_compute_pin - compute if gpio should be asserted
steer | control (ie. TRST driven, SRST driven, of fixed) |
Returns pin value (1 means driven high, 0 mean driven low)
Definition at line 267 of file usb_blaster.c.
References FIXED_0, FIXED_1, info, SRST, ublast_info::srst_asserted, TRST, and ublast_info::trst_asserted.
Referenced by ublast_build_out().
|
static |
Definition at line 766 of file usb_blaster.c.
References cmd, ERROR_FAIL, ERROR_OK, JTAG_PATHMOVE, JTAG_RESET, JTAG_RUNTEST, JTAG_SCAN, JTAG_SLEEP, JTAG_STABLECLOCKS, JTAG_TLR_RESET, JTAG_TMS, LOG_ERROR, ublast_flush_buffer(), ublast_initial_wipeout(), ublast_path_move(), ublast_reset(), ublast_runtest(), ublast_scan(), ublast_stableclocks(), ublast_state_move(), ublast_tms(), and ublast_usleep().
|
static |
Definition at line 188 of file usb_blaster.c.
References ublast_info::buf, ublast_info::bufidx, ERROR_OK, info, and ublast_buf_write().
Referenced by COMMAND_HANDLER(), ublast_execute_queue(), ublast_queue_byte(), ublast_queue_bytes(), ublast_read_bitbang_tdos(), ublast_read_byteshifted_tdos(), and ublast_reset().
|
static |
ublast_idle_clock - put back TCK to low level
See ublast_queue_tdi() comment for the usage of this function.
Definition at line 342 of file usb_blaster.c.
References LOG_DEBUG_IO, SCAN_OUT, ublast_build_out(), and ublast_queue_byte().
Referenced by ublast_path_move(), ublast_queue_tdi(), and ublast_tms_seq().
|
static |
ublast_init - Initialize the Altera device
Initialize the device :
Returns ERROR_OK if USB device found, error if not.
Definition at line 826 of file usb_blaster.c.
References ublast_info::drv, drvs_map::drv_register, ERROR_JTAG_DEVICE_ERROR, ublast_lowlevel::firmware_path, ublast_info::firmware_path, ublast_lowlevel::flags, ublast_info::flags, info, LOG_ERROR, LOG_INFO, lowlevel_drivers_map, ublast_info::lowlevel_name, drvs_map::name, name, ublast_lowlevel::open, TAP_RESET, tap_set_state, ublast_lowlevel::ublast_pid, ublast_info::ublast_pid, ublast_lowlevel::ublast_pid_uninit, ublast_info::ublast_pid_uninit, ublast_lowlevel::ublast_vid, ublast_info::ublast_vid, ublast_lowlevel::ublast_vid_uninit, and ublast_info::ublast_vid_uninit.
|
static |
Definition at line 742 of file usb_blaster.c.
References ublast_info::buf, BUF_LEN, info, SCAN_OUT, TAP_RESET, tap_set_state, TCK, ublast_buf_write(), ublast_build_out(), and ublast_tms_seq().
Referenced by ublast_execute_queue().
|
static |
ublast_path_move - write a TMS sequence transition to JTAG
cmd | path transition |
Write a series of TMS transitions, where each transition consists in :
Definition at line 475 of file usb_blaster.c.
References cmd, LOG_DEBUG_IO, tap_get_state(), tap_set_state, tap_state_transition(), ublast_clock_tms(), and ublast_idle_clock().
Referenced by ublast_execute_queue().
|
static |
ublast_queue_byte - queue one 'bitbang mode' byte for USB Blaster
abyte | the byte to queue |
Queues one byte in 'bitbang mode' to the USB Blaster. The byte is not actually sent, but stored in a buffer. The write is performed once the buffer is filled, or if an explicit ublast_flush_buffer() is called.
Definition at line 251 of file usb_blaster.c.
References ublast_info::buf, ublast_info::bufidx, info, LOG_DEBUG_IO, nb_buf_remaining(), and ublast_flush_buffer().
Referenced by COMMAND_HANDLER(), ublast_clock_tdi(), ublast_clock_tdi_flip_tms(), ublast_clock_tms(), ublast_idle_clock(), ublast_queue_tdi(), and ublast_reset().
|
static |
ublast_queue_bytes - queue bytes for the USB Blaster
bytes | byte array |
nb_bytes | number of bytes |
Queues bytes to be sent to the USB Blaster. The bytes are not actually sent, but stored in a buffer. The write is performed once the buffer is filled, or if an explicit ublast_flush_buffer() is called.
Definition at line 415 of file usb_blaster.c.
References ublast_info::buf, BUF_LEN, ublast_info::bufidx, info, LOG_DEBUG_IO, LOG_ERROR, nb_buf_remaining(), and ublast_flush_buffer().
Referenced by ublast_queue_tdi().
|
static |
ublast_queue_tdi - short description
bits | bits to be queued on TDI (or NULL if 0 are to be queued) |
nb_bits | number of bits |
scan | scan type (ie. if TDO read back is required or not) |
Outputs a series of TDI bits on TDI. As a side effect, the last TDI bit is sent along a TMS=1, and triggers a JTAG TAP state shift if input bits were non NULL.
In order to not saturate the USB Blaster queues, this method reads back TDO if the scan type requests it, and stores them back in bits.
As a side note, the state of TCK when entering this function must be low. This is because byteshift mode outputs TDI on rising TCK and reads TDO on falling TCK if and only if TCK is low before queuing byteshift mode bytes. If TCK was high, the USB blaster will queue TDI on falling edge, and read TDO on rising edge !!!
Definition at line 599 of file usb_blaster.c.
References bits, BUF_LEN, ublast_info::bufidx, CMD_COPY_TDO_BUFFER, COPY_TDO_BUFFER, DIV_ROUND_UP, ublast_info::flags, info, MAX_PACKET_SIZE, MIN, READ, scan, SCAN_IN, SCAN_IO, SHMODE, ublast_clock_tdi(), ublast_clock_tdi_flip_tms(), ublast_idle_clock(), ublast_queue_byte(), ublast_queue_bytes(), ublast_read_bitbang_tdos(), and ublast_read_byteshifted_tdos().
Referenced by ublast_runtest(), ublast_scan(), and ublast_stableclocks().
|
static |
ublast_quit - Release the Altera device
Releases the device :
Returns always ERROR_OK
Definition at line 887 of file usb_blaster.c.
References ublast_lowlevel::close, ublast_info::drv, info, and ublast_buf_write().
|
static |
ublast_read_bitbang_tdos - read TDO of bitbang writes
buf | the buffer to store the bits |
nb_bits | the number of bits |
Reads back from USB Blaster TDO bits, triggered by a 'bitbang write', ie. one bit per received byte from USB interface, and store them in buffer, where :
Returns ERROR_OK if OK, ERROR_xxx if a read error occurred
Definition at line 556 of file usb_blaster.c.
References ERROR_OK, LOG_DEBUG_IO, READ_TDO, ublast_buf_read(), and ublast_flush_buffer().
Referenced by ublast_queue_tdi().
|
static |
ublast_read_byteshifted_tdos - read TDO of byteshift writes
buf | the buffer to store the bits |
nb_bytes | the number of bytes |
Reads back from USB Blaster TDO bits, triggered by a 'byteshift write', ie. eight bits per received byte from USB interface, and store them in buffer.
As the USB blaster stores the TDO bits in LSB (ie. first bit in (byte0, bit0), second bit in (byte0, bit1), ...), which is what we want to return, simply read bytes from USB interface and store them.
Returns ERROR_OK if OK, ERROR_xxx if a read error occurred
Definition at line 526 of file usb_blaster.c.
References ERROR_OK, LOG_DEBUG_IO, ublast_buf_read(), and ublast_flush_buffer().
Referenced by ublast_queue_tdi().
|
static |
ublast_reset - reset the JTAG device is possible
trst | 1 if TRST is to be asserted |
srst | 1 if SRST is to be asserted |
Definition at line 308 of file usb_blaster.c.
References info, SCAN_OUT, ublast_info::srst_asserted, ublast_info::trst_asserted, ublast_build_out(), ublast_flush_buffer(), and ublast_queue_byte().
Referenced by ublast_execute_queue().
|
static |
Definition at line 676 of file usb_blaster.c.
References LOG_DEBUG_IO, NULL, SCAN_OUT, state, TAP_IDLE, ublast_queue_tdi(), and ublast_state_move().
Referenced by ublast_execute_queue().
|
static |
ublast_scan - launches a DR-scan or IR-scan
cmd | the command to launch |
Launch a JTAG IR-scan or DR-scan
Returns ERROR_OK if OK, ERROR_xxx if a read/write error occurred.
Definition at line 699 of file usb_blaster.c.
References cmd, DIV_ROUND_UP, ERROR_OK, hexdump(), jtag_build_buffer(), jtag_read_buffer(), jtag_scan_type(), LOG_DEBUG_IO, NULL, TAP_DRSHIFT, TAP_IRSHIFT, type, ublast_queue_tdi(), and ublast_state_move().
Referenced by ublast_execute_queue().
|
static |
Definition at line 685 of file usb_blaster.c.
References LOG_DEBUG_IO, NULL, SCAN_OUT, and ublast_queue_tdi().
Referenced by ublast_execute_queue().
|
static |
ublast_state_move - move JTAG state to the target state
state | the target state |
skip | number of bits to skip at the beginning of the path |
Input the correct TMS sequence to the JTAG TAP so that we end up in the target state. This assumes the current state (tap_get_state()) is correct.
Definition at line 497 of file usb_blaster.c.
References LOG_DEBUG_IO, state, tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), tap_set_state, tap_state_name(), and ublast_tms_seq().
Referenced by ublast_execute_queue(), ublast_runtest(), and ublast_scan().
|
static |
ublast_tms - write a tms command
cmd | tms command |
Definition at line 459 of file usb_blaster.c.
References cmd, LOG_DEBUG_IO, and ublast_tms_seq().
Referenced by ublast_execute_queue().
|
static |
ublast_tms_seq - write a TMS sequence transition to JTAG
bits | TMS bits to be written (bit0, bit1 .. bitN) |
nb_bits | number of TMS bits (between 1 and 8) |
skip | number of TMS bits to skip at the beginning of the series |
Write a series of TMS transitions, where each transition consists in :
Definition at line 445 of file usb_blaster.c.
References bits, LOG_DEBUG_IO, ublast_clock_tms(), and ublast_idle_clock().
Referenced by ublast_initial_wipeout(), ublast_state_move(), and ublast_tms().
|
static |
Definition at line 736 of file usb_blaster.c.
References jtag_sleep(), and LOG_DEBUG_IO.
Referenced by ublast_execute_queue().
|
static |
Definition at line 1 of file usb_blaster.c.
Referenced by COMMAND_HANDLER(), nb_buf_remaining(), ublast_buf_read(), ublast_buf_write(), ublast_build_out(), ublast_clock_tdi(), ublast_clock_tdi_flip_tms(), ublast_clock_tms(), ublast_compute_pin(), ublast_flush_buffer(), ublast_init(), ublast_initial_wipeout(), ublast_queue_byte(), ublast_queue_bytes(), ublast_queue_tdi(), ublast_quit(), and ublast_reset().
|
static |
Definition at line 1 of file usb_blaster.c.
Referenced by ublast_init().
|
static |
Definition at line 997 of file usb_blaster.c.
|
static |
Definition at line 997 of file usb_blaster.c.
struct adapter_driver usb_blaster_adapter_driver |
Definition at line 997 of file usb_blaster.c.
|
static |
Definition at line 997 of file usb_blaster.c.