OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | ulink |
Describes one driver instance. More... | |
struct | ulink_cmd |
OpenULINK command (OpenULINK command queue element). More... | |
Macros | |
#define | CPU_RESET 0x01 |
Value to write into CPUCS to put EZ-USB into reset. More... | |
#define | CPU_START 0x00 |
Value to write into CPUCS to put EZ-USB out of reset. More... | |
#define | CPUCS_REG 0x7F92 |
Address of EZ-USB CPU Control & Status register. More... | |
#define | FIRMWARE_ADDR 0x0000 |
Base address of firmware in EZ-USB code space. More... | |
#define | REQUEST_FIRMWARE_LOAD 0xA0 |
USB Control EP0 bRequest: "Firmware Load". More... | |
#define | SECTION_BUFFERSIZE 8192 |
Maximum size of a single firmware section. More... | |
#define | SPLIT_SCAN_THRESHOLD 10 |
Tuning of OpenOCD SCAN commands split into multiple OpenULINK commands. More... | |
#define | ULINK_FIRMWARE_FILE PKGDATADIR "/OpenULINK/ulink_firmware.hex" |
Default location of OpenULINK firmware image. More... | |
#define | ULINK_PID 0x2710 |
USB Product ID of ULINK device in unconfigured state (no firmware loaded yet) or with OpenULINK firmware. More... | |
#define | ULINK_RENUMERATION_DELAY 1500000 |
Delay (in microseconds) to wait while EZ-USB performs ReNumeration. More... | |
#define | ULINK_VID 0xC251 |
USB Vendor ID of ULINK device in unconfigured state (no firmware loaded yet) or with OpenULINK firmware. More... | |
#define | USB_INTERFACE 0 |
USB interface number. More... | |
Enumerations | |
enum | ulink_delay_type { DELAY_CLOCK_TCK , DELAY_CLOCK_TMS , DELAY_SCAN_IN , DELAY_SCAN_OUT , DELAY_SCAN_IO } |
enum | ulink_payload_direction { PAYLOAD_DIRECTION_OUT , PAYLOAD_DIRECTION_IN } |
enum | ulink_type { ULINK_1 , ULINK_2 , ULINK_PRO , ULINK_ME } |
ULINK hardware type. More... | |
Functions | |
static int | __attribute__ ((unused)) |
Opens the ULINK device. More... | |
COMMAND_HANDLER (ulink_download_firmware_handler) | |
Set a custom path to ULINK firmware image and force downloading to ULINK. More... | |
static int | ulink_allocate_payload (struct ulink_cmd *ulink_cmd, int size, enum ulink_payload_direction direction) |
Allocate and initialize space in memory for OpenULINK command payload. More... | |
static int | ulink_append_clock_tck_cmd (struct ulink *device, uint16_t count) |
Generate a defined amount of TCK clock cycles. More... | |
static int | ulink_append_clock_tms_cmd (struct ulink *device, uint8_t count, uint8_t sequence) |
Perform TAP state transitions. More... | |
static int | ulink_append_configure_tck_cmd (struct ulink *device, int delay_scan_in, int delay_scan_out, int delay_scan_io, int delay_tck, int delay_tms) |
Set TCK delay counters. More... | |
static int | ulink_append_get_signals_cmd (struct ulink *device) |
Read JTAG signals. More... | |
static int | ulink_append_led_cmd (struct ulink *device, uint8_t led_state) |
Turn on/off ULINK LEDs. More... | |
static int | ulink_append_queue (struct ulink *device, struct ulink_cmd *ulink_cmd) |
Add a command to the OpenULINK command queue. More... | |
static int | ulink_append_scan_cmd (struct ulink *device, enum scan_type scan_type, int scan_size_bits, uint8_t *tdi, uint8_t *tdo_start, uint8_t *tdo, uint8_t tms_count_start, uint8_t tms_sequence_start, uint8_t tms_count_end, uint8_t tms_sequence_end, struct jtag_command *origin, bool postprocess) |
static int | ulink_append_scan_cmd (struct ulink *device, enum scan_type scan_type, int scan_size_bits, uint8_t *tdi, uint8_t *tdo_start, uint8_t *tdo, uint8_t tms_count_start, uint8_t tms_sequence_start, uint8_t tms_count_end, uint8_t tms_sequence_end, struct jtag_command *origin, bool postprocess) |
Perform JTAG scan. More... | |
static int | ulink_append_set_signals_cmd (struct ulink *device, uint8_t low, uint8_t high) |
Arbitrarily set JTAG output signals. More... | |
static int | ulink_append_sleep_cmd (struct ulink *device, uint32_t us) |
Sleep for a pre-defined number of microseconds. More... | |
static int | ulink_append_test_cmd (struct ulink *device) |
Test command. More... | |
static int | ulink_calculate_delay (enum ulink_delay_type type, long f, int *delay) |
Calculate delay values for a given TCK frequency. More... | |
static long | ulink_calculate_frequency (enum ulink_delay_type type, int delay) |
Calculate frequency for a given delay value. More... | |
static void | ulink_clear_queue (struct ulink *device) |
Clear the OpenULINK command queue. More... | |
static const char * | ulink_cmd_id_string (uint8_t id) |
Convert an OpenULINK command ID (id) to a human-readable string. More... | |
static int | ulink_cpu_reset (struct ulink *device, unsigned char reset_bit) |
Writes '0' or '1' to the CPUCS register, putting the EZ-USB CPU into reset or out of reset. More... | |
static int | ulink_execute_queue (void) |
Executes the JTAG Command Queue. More... | |
static int | ulink_execute_queued_commands (struct ulink *device, int timeout) |
Sends all queued OpenULINK commands to the ULINK for execution. More... | |
static int | ulink_get_queue_size (struct ulink *device, enum ulink_payload_direction direction) |
Get the current number of bytes in the queue, including command IDs. More... | |
static int | ulink_init (void) |
Initiates the firmware download to the ULINK adapter and prepares the USB handle. More... | |
static int | ulink_khz (int khz, int *jtag_speed) |
Set the TCK frequency of the ULINK adapter. More... | |
static int | ulink_load_firmware (struct ulink *device, const char *filename) |
Downloads a firmware image to the ULINK's EZ-USB microcontroller over the USB bus. More... | |
static int | ulink_load_firmware_and_renumerate (struct ulink **device, const char *filename, uint32_t delay) |
Puts the ULINK's EZ-USB microcontroller into reset state, downloads the firmware image, resumes the microcontroller and re-enumerates USB devices. More... | |
static int | ulink_post_process_queue (struct ulink *device) |
Perform post-processing of commands after OpenULINK queue has been executed. More... | |
static int | ulink_post_process_scan (struct ulink_cmd *ulink_cmd) |
Post-process JTAG_SCAN command. More... | |
static void | ulink_print_command (struct ulink_cmd *ulink_cmd) |
Print one OpenULINK command to stdout. More... | |
static void | ulink_print_queue (struct ulink *device) |
Print the OpenULINK command queue to stdout. More... | |
static void | ulink_print_signal_states (uint8_t input_signals, uint8_t output_signals) |
Print state of interesting signals via LOG_INFO(). More... | |
static int | ulink_queue_pathmove (struct ulink *device, struct jtag_command *cmd) |
Move to one TAP state or several states in succession. More... | |
static int | ulink_queue_reset (struct ulink *device, struct jtag_command *cmd) |
Execute a JTAG_RESET command. More... | |
static int | ulink_queue_runtest (struct ulink *device, struct jtag_command *cmd) |
Run Test. More... | |
static int | ulink_queue_scan (struct ulink *device, struct jtag_command *cmd) |
Perform a scan operation on a JTAG register. More... | |
static int | ulink_queue_sleep (struct ulink *device, struct jtag_command *cmd) |
Sleep for a specific amount of time. More... | |
static int | ulink_queue_stableclocks (struct ulink *device, struct jtag_command *cmd) |
Generate TCK cycles while remaining in a stable state. More... | |
static int | ulink_queue_statemove (struct ulink *device) |
Move from the current TAP state to the current TAP end state. More... | |
static int | ulink_queue_tlr_reset (struct ulink *device, struct jtag_command *cmd) |
Move the TAP into the Test Logic Reset state. More... | |
static int | ulink_quit (void) |
Closes the USB handle for the ULINK device. More... | |
static void | ulink_set_end_state (tap_state_t endstate) |
Sets the end state follower (see interface.h) if endstate is a stable state. More... | |
static int | ulink_speed (int speed) |
Set the TCK frequency of the ULINK adapter. More... | |
static int | ulink_speed_div (int speed, int *khz) |
Convert adapter-specific speed value to corresponding TCK frequency in kHz. More... | |
static int | ulink_usb_close (struct ulink **device) |
Releases the ULINK interface and closes the USB device handle. More... | |
static int | ulink_usb_open (struct ulink **device) |
static int | ulink_write_firmware_section (struct ulink *device, struct image *firmware_image, int section_index) |
Send one contiguous firmware section to the ULINK's EZ-USB microcontroller over the USB bus. More... | |
Variables | |
struct adapter_driver | ulink_adapter_driver |
static const struct command_registration | ulink_command_handlers [] |
static struct jtag_interface | ulink_interface |
static const struct command_registration | ulink_subcommand_handlers [] |
#define CPU_RESET 0x01 |
#define CPU_START 0x00 |
#define CPUCS_REG 0x7F92 |
#define FIRMWARE_ADDR 0x0000 |
#define REQUEST_FIRMWARE_LOAD 0xA0 |
#define SECTION_BUFFERSIZE 8192 |
#define SPLIT_SCAN_THRESHOLD 10 |
#define ULINK_FIRMWARE_FILE PKGDATADIR "/OpenULINK/ulink_firmware.hex" |
#define ULINK_PID 0x2710 |
#define ULINK_RENUMERATION_DELAY 1500000 |
#define ULINK_VID 0xC251 |
enum ulink_delay_type |
enum ulink_type |
ULINK hardware type.
|
static |
COMMAND_HANDLER | ( | ulink_download_firmware_handler | ) |
Set a custom path to ULINK firmware image and force downloading to ULINK.
Definition at line 2226 of file ulink.c.
References CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, LOG_INFO, ulink_load_firmware_and_renumerate(), and ULINK_RENUMERATION_DELAY.
|
static |
Allocate and initialize space in memory for OpenULINK command payload.
ulink_cmd | pointer to command whose payload should be allocated. |
size | the amount of memory to allocate (bytes). |
direction | which payload to allocate. |
Definition at line 513 of file ulink.c.
References direction, ERROR_FAIL, ERROR_OK, ulink_cmd::free_payload_in_start, LOG_ERROR, PAYLOAD_DIRECTION_IN, PAYLOAD_DIRECTION_OUT, ulink_cmd::payload_in, ulink_cmd::payload_in_size, ulink_cmd::payload_in_start, ulink_cmd::payload_out, ulink_cmd::payload_out_size, and size.
Referenced by ulink_append_clock_tck_cmd(), ulink_append_clock_tms_cmd(), ulink_append_configure_tck_cmd(), ulink_append_get_signals_cmd(), ulink_append_led_cmd(), ulink_append_scan_cmd(), ulink_append_set_signals_cmd(), ulink_append_sleep_cmd(), and ulink_append_test_cmd().
|
static |
Generate a defined amount of TCK clock cycles.
All other JTAG signals are left unchanged.
device | pointer to struct ulink identifying ULINK driver instance. |
count | the number of TCK clock cycles to generate. |
Definition at line 993 of file ulink.c.
References cmd, CMD_CLOCK_TCK, CMD_SLOW_CLOCK_TCK, count, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_queue_runtest(), and ulink_queue_stableclocks().
|
static |
Perform TAP state transitions.
device | pointer to struct ulink identifying ULINK driver instance. |
count | defines the number of TCK clock cycles generated (up to 8). |
sequence | defines the TMS pin levels for each state transition. The Least-Significant Bit is read first. |
Definition at line 956 of file ulink.c.
References cmd, CMD_CLOCK_TMS, CMD_SLOW_CLOCK_TMS, count, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_queue_pathmove(), ulink_queue_statemove(), and ulink_queue_tlr_reset().
|
static |
Set TCK delay counters.
device | pointer to struct ulink identifying ULINK driver instance. |
delay_scan_in | delay count top value in jtag_slow_scan_in() function. |
delay_scan_out | delay count top value in jtag_slow_scan_out() function. |
delay_scan_io | delay count top value in jtag_slow_scan_io() function. |
delay_tck | delay count top value in jtag_clock_tck() function. |
delay_tms | delay count top value in jtag_slow_clock_tms() function. |
Definition at line 1134 of file ulink.c.
References cmd, CMD_CONFIGURE_TCK_FREQ, delay_scan_in, delay_scan_io, delay_scan_out, delay_tck, delay_tms, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_khz().
|
static |
Read JTAG signals.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 1026 of file ulink.c.
References cmd, CMD_GET_SIGNALS, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_IN, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_init().
|
static |
Turn on/off ULINK LEDs.
device | pointer to struct ulink identifying ULINK driver instance. |
led_state | which LED(s) to turn on or off. The following bits influence the LEDS:
|
Definition at line 1196 of file ulink.c.
References cmd, CMD_SET_LEDS, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Add a command to the OpenULINK command queue.
device | pointer to struct ulink identifying ULINK driver instance. |
ulink_cmd | pointer to command that shall be appended to the OpenULINK command queue. |
Definition at line 636 of file ulink.c.
References device, ERROR_OK, LIBUSB_TIMEOUT_MS, PAYLOAD_DIRECTION_IN, PAYLOAD_DIRECTION_OUT, ulink_cmd::payload_in_size, ulink_cmd::payload_out_size, ulink_clear_queue(), ulink_execute_queued_commands(), ulink_get_queue_size(), and ulink_post_process_queue().
Referenced by ulink_append_clock_tck_cmd(), ulink_append_clock_tms_cmd(), ulink_append_configure_tck_cmd(), ulink_append_get_signals_cmd(), ulink_append_led_cmd(), ulink_append_scan_cmd(), ulink_append_set_signals_cmd(), ulink_append_sleep_cmd(), and ulink_append_test_cmd().
|
static |
Referenced by ulink_queue_scan().
|
static |
Perform JTAG scan.
Creates and appends a JTAG scan command to the OpenULINK command queue. A JTAG scan consists of three steps:
device | pointer to struct ulink identifying ULINK driver instance. |
scan_type | the type of the scan (IN, OUT, IO (bidirectional)). |
scan_size_bits | number of bits to shift into the JTAG chain. |
tdi | pointer to array containing TDI data. |
tdo_start | pointer to first element of array where TDO data shall be stored. See ulink_cmd for details. |
tdo | pointer to array where TDO data shall be stored |
tms_count_start | number of TMS state transitions to perform BEFORE shifting data into the JTAG chain. |
tms_sequence_start | sequence of TMS state transitions that will be performed BEFORE shifting data into the JTAG chain. |
tms_count_end | number of TMS state transitions to perform AFTER shifting data into the JTAG chain. |
tms_sequence_end | sequence of TMS state transitions that will be performed AFTER shifting data into the JTAG chain. |
origin | pointer to OpenOCD command that generated this scan command. |
postprocess | whether this command needs to be post-processed after execution. |
Definition at line 855 of file ulink.c.
References cmd, CMD_SCAN_IN, CMD_SCAN_IO, CMD_SCAN_OUT, CMD_SLOW_SCAN_IN, CMD_SLOW_SCAN_IO, CMD_SLOW_SCAN_OUT, device, DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, LOG_ERROR, PAYLOAD_DIRECTION_OUT, SCAN_IN, SCAN_IO, SCAN_OUT, ulink_allocate_payload(), and ulink_append_queue().
|
static |
Arbitrarily set JTAG output signals.
device | pointer to struct ulink identifying ULINK driver instance. |
low | defines which signals will be de-asserted. Each bit corresponds to a JTAG signal:
|
high | defines which signals will be asserted. |
Definition at line 1065 of file ulink.c.
References cmd, CMD_SET_SIGNALS, device, ERROR_FAIL, ERROR_OK, low, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_queue_reset(), and ulink_queue_stableclocks().
|
static |
Sleep for a pre-defined number of microseconds.
device | pointer to struct ulink identifying ULINK driver instance. |
us | the number microseconds to sleep. |
Definition at line 1098 of file ulink.c.
References cmd, CMD_SLEEP_US, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_queue_sleep().
|
static |
Test command.
Used to check if the ULINK device is ready to accept new commands.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 1226 of file ulink.c.
References cmd, CMD_TEST, device, ERROR_FAIL, ERROR_OK, PAYLOAD_DIRECTION_OUT, ulink_allocate_payload(), and ulink_append_queue().
Referenced by ulink_init().
|
static |
Calculate delay values for a given TCK frequency.
The OpenULINK firmware uses five different speed values for different commands. These speed values are calculated in these functions.
The five different commands which support variable TCK frequency are implemented twice in the firmware:
To set the ULINK to maximum frequency, it is only necessary to use the corresponding command IDs. To set the ULINK to a lower frequency, the delay loop top values have to be calculated first. Then, a CMD_CONFIGURE_TCK_FREQ command needs to be sent to the ULINK device.
The delay values are described by linear equations: t = k * x + d (t = period, k = constant, x = delay value, d = constant)
Thus, the delay can be calculated as in the following equation: x = (t - d) / k
The constants in these equations have been determined and validated by measuring the frequency resulting from different delay values.
type | for which command to calculate the delay value. |
f | TCK frequency for which to calculate the delay value in Hz. |
delay | where to store resulting delay value. |
Definition at line 1282 of file ulink.c.
References DELAY_CLOCK_TCK, DELAY_CLOCK_TMS, DELAY_SCAN_IN, DELAY_SCAN_IO, DELAY_SCAN_OUT, ERROR_FAIL, ERROR_OK, and type.
Referenced by ulink_khz().
|
static |
Calculate frequency for a given delay value.
Similar to the ulink_calculate_delay function, this function calculates the TCK frequency for a given delay value by using linear equations of the form: t = k * x + d (t = period, k = constant, x = delay value, d = constant)
type | for which command to calculate the delay value. |
delay | delay value for which to calculate the resulting TCK frequency. |
Definition at line 1342 of file ulink.c.
References DELAY_CLOCK_TCK, DELAY_CLOCK_TMS, DELAY_SCAN_IN, DELAY_SCAN_IO, DELAY_SCAN_OUT, and type.
Referenced by ulink_khz().
|
static |
Clear the OpenULINK command queue.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 594 of file ulink.c.
References device, ulink_cmd::free_payload_in_start, ulink_cmd::next, NULL, ulink_cmd::payload_in, ulink_cmd::payload_in_start, and ulink_cmd::payload_out.
Referenced by ulink_append_queue(), ulink_execute_queue(), and ulink_init().
|
static |
Convert an OpenULINK command ID (id) to a human-readable string.
id | the OpenULINK command ID. |
Definition at line 750 of file ulink.c.
References CMD_CLOCK_TCK, CMD_CLOCK_TMS, CMD_CONFIGURE_TCK_FREQ, CMD_GET_SIGNALS, CMD_SCAN_IN, CMD_SCAN_IO, CMD_SCAN_OUT, CMD_SET_LEDS, CMD_SET_SIGNALS, CMD_SLEEP_MS, CMD_SLEEP_US, CMD_SLOW_CLOCK_TCK, CMD_SLOW_CLOCK_TMS, CMD_SLOW_SCAN_IN, CMD_SLOW_SCAN_IO, CMD_SLOW_SCAN_OUT, and CMD_TEST.
Referenced by ulink_print_command().
|
static |
Writes '0' or '1' to the CPUCS register, putting the EZ-USB CPU into reset or out of reset.
device | pointer to struct ulink identifying ULINK driver instance. |
reset_bit | 0 to put CPU into reset, 1 to put CPU out of reset. |
Definition at line 318 of file ulink.c.
References CPUCS_REG, device, ERROR_FAIL, ERROR_OK, LIBUSB_TIMEOUT_MS, and REQUEST_FIRMWARE_LOAD.
Referenced by ulink_load_firmware().
|
static |
Executes the JTAG Command Queue.
This is done in three stages: First, all OpenOCD commands are processed into queued OpenULINK commands. Next, the OpenULINK command queue is sent to the ULINK device and data received from the ULINK device is cached. Finally, the post-processing function writes back data to the corresponding OpenOCD commands.
Definition at line 1908 of file ulink.c.
References cmd, ulink::commands_in_queue, ERROR_FAIL, ERROR_OK, jtag_command_queue, JTAG_PATHMOVE, JTAG_RESET, JTAG_RUNTEST, JTAG_SCAN, JTAG_SLEEP, JTAG_STABLECLOCKS, JTAG_TLR_RESET, LIBUSB_TIMEOUT_MS, LOG_ERROR, ulink_clear_queue(), ulink_execute_queued_commands(), ulink_post_process_queue(), ulink_queue_pathmove(), ulink_queue_reset(), ulink_queue_runtest(), ulink_queue_scan(), ulink_queue_sleep(), ulink_queue_stableclocks(), and ulink_queue_tlr_reset().
|
static |
Sends all queued OpenULINK commands to the ULINK for execution.
device | pointer to struct ulink identifying ULINK driver instance. |
timeout |
Definition at line 688 of file ulink.c.
References buffer, device, ERROR_FAIL, ERROR_OK, ulink_cmd::id, LOG_LEVEL_IS, LOG_LVL_DEBUG_IO, ulink_cmd::next, ulink_cmd::payload_in, ulink_cmd::payload_in_size, ulink_cmd::payload_out, ulink_cmd::payload_out_size, and ulink_print_queue().
Referenced by ulink_append_queue(), ulink_execute_queue(), and ulink_init().
|
static |
Get the current number of bytes in the queue, including command IDs.
device | pointer to struct ulink identifying ULINK driver instance. |
direction | the transfer direction for which to get byte count. |
Definition at line 567 of file ulink.c.
References device, direction, ulink_cmd::next, PAYLOAD_DIRECTION_IN, PAYLOAD_DIRECTION_OUT, ulink_cmd::payload_in_size, and ulink_cmd::payload_out_size.
Referenced by ulink_append_queue().
|
static |
Initiates the firmware download to the ULINK adapter and prepares the USB handle.
Definition at line 2100 of file ulink.c.
References dummy, ulink::ep_in, ulink::ep_out, ERROR_FAIL, ERROR_OK, jtag_libusb_choose_interface(), ulink::libusb_ctx, LOG_ERROR, LOG_INFO, NULL, ulink_cmd::payload_in, ulink::queue_start, ulink_append_get_signals_cmd(), ulink_append_test_cmd(), ulink_clear_queue(), ulink_execute_queued_commands(), ULINK_FIRMWARE_FILE, ulink_load_firmware_and_renumerate(), ulink_print_signal_states(), ULINK_RENUMERATION_DELAY, ulink_usb_open(), and ulink::usb_device_handle.
|
static |
Set the TCK frequency of the ULINK adapter.
khz | desired JTAG TCK frequency. |
jtag_speed | where to store corresponding adapter-specific speed value. |
Definition at line 1971 of file ulink.c.
References DELAY_CLOCK_TCK, ulink::delay_clock_tck, DELAY_CLOCK_TMS, ulink::delay_clock_tms, DELAY_SCAN_IN, ulink::delay_scan_in, DELAY_SCAN_IO, ulink::delay_scan_io, DELAY_SCAN_OUT, ulink::delay_scan_out, ERROR_FAIL, ERROR_OK, LOG_DEBUG_IO, LOG_ERROR, ulink_append_configure_tck_cmd(), ulink_calculate_delay(), and ulink_calculate_frequency().
Referenced by ulink_speed().
|
static |
Downloads a firmware image to the ULINK's EZ-USB microcontroller over the USB bus.
device | pointer to struct ulink identifying ULINK driver instance. |
filename | an absolute or relative path to the Intel HEX file containing the firmware image. |
Definition at line 381 of file ulink.c.
References image::base_address, image::base_address_set, CPU_RESET, CPU_START, device, ERROR_OK, image_close(), image_open(), LOG_ERROR, image::num_sections, ulink_cpu_reset(), and ulink_write_firmware_section().
Referenced by ulink_load_firmware_and_renumerate().
|
static |
Puts the ULINK's EZ-USB microcontroller into reset state, downloads the firmware image, resumes the microcontroller and re-enumerates USB devices.
device | pointer to struct ulink identifying ULINK driver instance. The usb_handle member will be modified during re-enumeration. |
filename | path to the Intel HEX file containing the firmware image. |
delay | the delay to wait for the device to re-enumerate. |
Definition at line 345 of file ulink.c.
References device, ERROR_OK, ulink_load_firmware(), ulink_usb_close(), and ulink_usb_open().
Referenced by COMMAND_HANDLER(), and ulink_init().
|
static |
Perform post-processing of commands after OpenULINK queue has been executed.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 1850 of file ulink.c.
References ulink_cmd::cmd_origin, device, ERROR_FAIL, ERROR_OK, JTAG_PATHMOVE, JTAG_RESET, JTAG_RUNTEST, JTAG_SCAN, JTAG_SLEEP, JTAG_STABLECLOCKS, JTAG_TLR_RESET, LOG_ERROR, ulink_cmd::needs_postprocessing, ulink_cmd::next, jtag_command::type, and ulink_post_process_scan().
Referenced by ulink_append_queue(), and ulink_execute_queue().
|
static |
Post-process JTAG_SCAN command.
ulink_cmd | pointer to OpenULINK command that shall be processed. |
Definition at line 1819 of file ulink.c.
References cmd, ulink_cmd::cmd_origin, ERROR_FAIL, ERROR_OK, jtag_read_buffer(), jtag_scan_type(), LOG_ERROR, ulink_cmd::payload_in_start, SCAN_IN, SCAN_IO, and SCAN_OUT.
Referenced by ulink_post_process_queue().
|
static |
Print one OpenULINK command to stdout.
ulink_cmd | pointer to OpenULINK command. |
Definition at line 797 of file ulink.c.
References ulink_cmd::id, ulink_cmd::payload_in_size, ulink_cmd::payload_out, ulink_cmd::payload_out_size, and ulink_cmd_id_string().
Referenced by ulink_print_queue().
|
static |
Print the OpenULINK command queue to stdout.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 815 of file ulink.c.
References device, ulink_cmd::next, and ulink_print_command().
Referenced by ulink_execute_queued_commands().
|
static |
Print state of interesting signals via LOG_INFO().
input_signals | input signal states as returned by CMD_GET_SIGNALS |
output_signals | output signal states as returned by CMD_GET_SIGNALS |
Definition at line 490 of file ulink.c.
References LOG_INFO, SIGNAL_RESET, SIGNAL_TCK, SIGNAL_TDI, SIGNAL_TDO, SIGNAL_TMS, and SIGNAL_TRST.
Referenced by ulink_init().
|
static |
Move to one TAP state or several states in succession.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1702 of file ulink.c.
References buf_set_u32(), cmd, ERROR_FAIL, ERROR_OK, LOG_ERROR, LOG_INFO, tap_get_state(), tap_set_state, tap_state_name(), tap_state_transition(), and ulink_append_clock_tms_cmd().
Referenced by ulink_execute_queue().
|
static |
Execute a JTAG_RESET command.
device | |
cmd | pointer to the command that shall be executed. |
Definition at line 1676 of file ulink.c.
References cmd, device, low, SIGNAL_RESET, SIGNAL_TRST, TAP_RESET, tap_set_state, and ulink_append_set_signals_cmd().
Referenced by ulink_execute_queue().
|
static |
Run Test.
Generate TCK clock cycles while remaining in the Run-Test/Idle state.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1644 of file ulink.c.
References cmd, device, ERROR_OK, tap_get_state(), TAP_IDLE, tap_set_end_state(), ulink_append_clock_tck_cmd(), ulink_queue_statemove(), and ulink_set_end_state().
Referenced by ulink_execute_queue().
|
static |
Perform a scan operation on a JTAG register.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1442 of file ulink.c.
References cmd, device, DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, jtag_build_buffer(), jtag_scan_size(), jtag_scan_type(), NULL, SCAN_IN, SCAN_IO, SCAN_OUT, TAP_DRPAUSE, TAP_DRSHIFT, tap_get_end_state(), tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), TAP_IRPAUSE, TAP_IRSHIFT, tap_set_end_state(), tap_set_state, tdi_buffer, tdo_buffer, type, ulink_append_scan_cmd(), and ulink_set_end_state().
Referenced by ulink_execute_queue().
|
static |
Sleep for a specific amount of time.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1761 of file ulink.c.
References cmd, device, and ulink_append_sleep_cmd().
Referenced by ulink_execute_queue().
|
static |
Generate TCK cycles while remaining in a stable state.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1774 of file ulink.c.
References cmd, device, ERROR_FAIL, ERROR_OK, LOG_ERROR, SIGNAL_TMS, tap_get_state(), tap_is_state_stable(), TAP_RESET, ulink_append_clock_tck_cmd(), and ulink_append_set_signals_cmd().
Referenced by ulink_execute_queue().
|
static |
Move from the current TAP state to the current TAP end state.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 1413 of file ulink.c.
References device, ERROR_OK, tap_get_end_state(), tap_get_state(), tap_get_tms_path(), tap_get_tms_path_len(), tap_set_state, and ulink_append_clock_tms_cmd().
Referenced by ulink_queue_runtest().
|
static |
Move the TAP into the Test Logic Reset state.
device | pointer to struct ulink identifying ULINK driver instance. |
cmd | pointer to the command that shall be executed. |
Definition at line 1621 of file ulink.c.
References device, ERROR_OK, TAP_RESET, tap_set_state, and ulink_append_clock_tms_cmd().
Referenced by ulink_execute_queue().
|
static |
Closes the USB handle for the ULINK device.
Definition at line 2213 of file ulink.c.
References ulink_usb_close().
|
static |
Sets the end state follower (see interface.h) if endstate is a stable state.
endstate | the state the end state follower should be set to. |
Definition at line 1396 of file ulink.c.
References LOG_ERROR, tap_is_state_stable(), tap_set_end_state(), and tap_state_name().
Referenced by ulink_queue_runtest(), and ulink_queue_scan().
|
static |
Set the TCK frequency of the ULINK adapter.
Because of the way the TCK frequency is set up in the OpenULINK firmware, there are five different speed settings. To simplify things, the adapter-specific speed setting value is identical to the TCK frequency in khz.
speed | desired adapter-specific speed value. |
Definition at line 2066 of file ulink.c.
References dummy, and ulink_khz().
|
static |
Convert adapter-specific speed value to corresponding TCK frequency in kHz.
Because of the way the TCK frequency is set up in the OpenULINK firmware, there are five different speed settings. To simplify things, the adapter-specific speed setting value is identical to the TCK frequency in khz.
speed | adapter-specific speed value. |
khz | where to store corresponding TCK frequency in kHz. |
Definition at line 2086 of file ulink.c.
References ERROR_OK.
|
static |
Releases the ULINK interface and closes the USB device handle.
device | pointer to struct ulink identifying ULINK driver instance. |
Definition at line 295 of file ulink.c.
References ERROR_FAIL, ERROR_OK, and NULL.
Referenced by ulink_load_firmware_and_renumerate(), and ulink_quit().
|
static |
Referenced by ulink_init(), and ulink_load_firmware_and_renumerate().
|
static |
Send one contiguous firmware section to the ULINK's EZ-USB microcontroller over the USB bus.
device | pointer to struct ulink identifying ULINK driver instance. |
firmware_image | pointer to the firmware image that contains the section which should be sent to the ULINK's EZ-USB microcontroller. |
section_index | index of the section within the firmware image. |
Definition at line 430 of file ulink.c.
References addr, imagesection::base_address, device, ERROR_FAIL, ERROR_OK, FIRMWARE_ADDR, image_read_section(), LIBUSB_TIMEOUT_MS, LOG_DEBUG, REQUEST_FIRMWARE_LOAD, SECTION_BUFFERSIZE, image::sections, size, and imagesection::size.
Referenced by ulink_load_firmware().
struct adapter_driver ulink_adapter_driver |
|
static |
|
static |
|
static |