30 #define ANGIE_VID 0x584e
34 #define ANGIE_PID 0x414F
35 #define ANGIE_PID_2 0x424e
36 #define ANGIE_PID_3 0x4255
37 #define ANGIE_PID_4 0x4355
38 #define ANGIE_PID_5 0x4a55
42 #define CPUCS_REG 0xE600
45 #define REQUEST_FIRMWARE_LOAD 0xA0
48 #define CPU_RESET 0x01
51 #define CPU_START 0x00
54 #define FIRMWARE_ADDR 0x0000
57 #define USB_INTERFACE 0
60 #define ANGIE_RENUMERATION_DELAY_US 1500000
63 #define ANGIE_FIRMWARE_FILE PKGDATADIR "/angie/angie_firmware.bin"
66 #define ANGIE_BITSTREAM_FILE PKGDATADIR "/angie/angie_bitstream.bit"
69 #define SECTION_BUFFERSIZE 16384
72 #define SPLIT_SCAN_THRESHOLD 10
173 struct image *firmware_image,
int section_index);
197 uint8_t tms_count_start,
198 uint8_t tms_sequence_start,
199 uint8_t tms_count_end,
200 uint8_t tms_sequence_end,
237 static int angie_khz(
int khz,
int *jtag_speed);
259 struct libusb_device_handle *usb_device_handle;
266 LOG_ERROR(
"Could not find and open ANGIE");
270 device->usb_device_handle = usb_device_handle;
285 if (
device->usb_device_handle) {
286 if (libusb_release_interface(
device->usb_device_handle, 0) != 0) {
287 LOG_ERROR(
"Could not release interface 0");
311 (LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE),
328 const char *filename, uint32_t
delay_us)
351 if (ret != LIBUSB_SUCCESS)
369 struct image angie_firmware_image;
381 ret =
image_open(&angie_firmware_image, filename,
"bin");
383 LOG_ERROR(
"Could not load firmware image");
388 for (
unsigned int i = 0; i < angie_firmware_image.
num_sections; i++) {
391 LOG_ERROR(
"Could not write firmware section");
400 LOG_ERROR(
"Could not restart ANGIE CPU");
419 int ret, transferred;
420 const char *bitstream_file_path = filename;
421 FILE *bitstream_file =
NULL;
422 char *bitstream_data =
NULL;
423 size_t bitstream_size = 0;
427 bitstream_file = fopen(bitstream_file_path,
"rb");
428 if (!bitstream_file) {
429 LOG_ERROR(
"Failed to open bitstream file: %s\n", bitstream_file_path);
434 fseek(bitstream_file, 0, SEEK_END);
435 bitstream_size = ftell(bitstream_file);
436 fseek(bitstream_file, 0, SEEK_SET);
439 bitstream_data = malloc(bitstream_size);
440 if (!bitstream_data) {
441 LOG_ERROR(
"Failed to allocate memory for bitstream data.");
442 fclose(bitstream_file);
447 if (fread(bitstream_data, 1, bitstream_size, bitstream_file) != bitstream_size) {
448 LOG_ERROR(
"Failed to read bitstream data.");
449 free(bitstream_data);
450 fclose(bitstream_file);
466 int actual_length = 0;
469 LOG_ERROR(
"Failed to send bitstream data: %s", libusb_strerror(ret));
470 free(bitstream_data);
471 fclose(bitstream_file);
475 LOG_INFO(
"Bitstream sent successfully.");
478 free(bitstream_data);
479 fclose(bitstream_file);
504 char i2c_data_buffer[i2c_data_size + 2];
505 char buffer_received[1];
506 int ret, transferred;
507 i2c_data_buffer[0] = 0;
508 i2c_data_buffer[1] = i2c_data_size - 1;
510 for (uint8_t i = 0; i < i2c_data_size; i++)
511 i2c_data_buffer[i + 2] = i2c_data[i];
515 i2c_data_size + 2, 1000, &transferred);
517 LOG_ERROR(
"Error in i2c clock gen configuration : ret ERROR");
520 if (transferred != i2c_data_size + 2) {
521 LOG_ERROR(
"Error in i2c clock gen configuration : bytes transferred");
530 LOG_ERROR(
"Error in i2c clock gen configuration : ret ERROR");
549 uint8_t ioconfig[3] = {i2c_adr, 3, cfg_value};
570 struct image *firmware_image,
int section_index)
572 int addr, bytes_remaining, chunk_size;
574 uint8_t *data_ptr = data;
577 int ret, transferred;
582 LOG_DEBUG(
"section %02i at addr 0x%04x (size 0x%04" PRIx16
")", section_index,
addr,
591 if (size_read !=
size)
594 bytes_remaining =
size;
597 while (bytes_remaining > 0) {
598 if (bytes_remaining > 64)
601 chunk_size = bytes_remaining;
604 (LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE),
611 if (transferred != chunk_size) {
616 bytes_remaining -= chunk_size;
618 data_ptr += chunk_size;
634 LOG_INFO(
"ANGIE signal states: TDI: %i, TDO: %i, TMS: %i, TCK: %i, TRST: %i "
660 payload = calloc(
size,
sizeof(uint8_t));
663 LOG_ERROR(
"Could not allocate ANGIE command payload: out of memory");
670 LOG_ERROR(
"BUG: Duplicate payload allocation for ANGIE command");
679 LOG_ERROR(
"BUG: Duplicate payload allocation for ANGIE command");
725 current = current->
next;
764 device->commands_in_queue = 0;
780 int newsize_out, newsize_in;
790 if (newsize_out > 64 || newsize_in > 64) {
802 if (!
device->queue_start) {
804 device->commands_in_queue = 1;
810 device->commands_in_queue++;
833 int ret, i, index_out, index_in, count_out, count_in, transferred;
843 for (current =
device->queue_start; current; current = current->
next) {
858 (
char *)
buffer, count_out, timeout_ms, &transferred);
860 LOG_ERROR(
"Libusb bulk write queued commands failed.");
863 if (transferred != count_out) {
864 LOG_ERROR(
"Libusb bulk write queued commands failed: transferred byte count");
871 (
char *)
buffer, count_in, timeout_ms, &transferred);
873 LOG_ERROR(
"Libusb bulk write input payload data failed");
876 if (transferred != count_in) {
877 LOG_ERROR(
"Libusb bulk write input payload data failed: transferred byte count");
883 for (current =
device->queue_start; current; current = current->
next) {
903 return "CMD_SCAN_IN";
905 return "CMD_SLOW_SCAN_IN";
907 return "CMD_SCAN_OUT";
909 return "CMD_SLOW_SCAN_OUT";
911 return "CMD_SCAN_IO";
913 return "CMD_SLOW_SCAN_IO";
915 return "CMD_CLOCK_TMS";
917 return "CMD_SLOW_CLOCK_TMS";
919 return "CMD_CLOCK_TCK";
921 return "CMD_SLOW_CLOCK_TCK";
923 return "CMD_SLEEP_US";
925 return "CMD_SLEEP_MS";
927 return "CMD_GET_SIGNALS";
929 return "CMD_SET_SIGNALS";
931 return "CMD_CONFIGURE_TCK_FREQ";
933 return "CMD_SET_LEDS";
937 return "CMD_UNKNOWN";
953 LOG_DEBUG_IO(
" %-22s | OUT size = %" PRIi8
", bytes = %s",
970 for (current =
device->queue_start; current; current = current->
next)
1005 int scan_size_bits, uint8_t *tdi, uint8_t *tdo_start, uint8_t *tdo,
1006 uint8_t tms_count_start, uint8_t tms_sequence_start, uint8_t tms_count_end,
1007 uint8_t tms_sequence_end,
struct jtag_command *origin,
bool postprocess)
1010 int ret, i, scan_size_bytes;
1011 uint8_t bits_last_byte;
1018 if (scan_size_bits > (58 * 8)) {
1019 LOG_ERROR(
"BUG: Tried to create CMD_SCAN_IO ANGIE command with too"
1027 bits_last_byte = scan_size_bits % 8;
1028 if (bits_last_byte == 0)
1034 if (
device->delay_scan_in < 0)
1041 if (
device->delay_scan_out < 0)
1048 if (
device->delay_scan_io < 0)
1055 LOG_ERROR(
"BUG: 'append scan cmd' encountered an unknown scan type");
1066 cmd->payload_out[0] = scan_size_bytes & 0xFF;
1067 cmd->payload_out[1] = bits_last_byte & 0xFF;
1068 cmd->payload_out[2] = ((tms_count_start & 0x0F) << 4) | (tms_count_end & 0x0F);
1069 cmd->payload_out[3] = tms_sequence_start;
1070 cmd->payload_out[4] = tms_sequence_end;
1074 for (i = 0; i < scan_size_bytes; i++)
1075 cmd->payload_out[i + 5] = tdi[i];
1080 cmd->payload_in_start = tdo_start;
1081 cmd->payload_in = tdo;
1082 cmd->payload_in_size = scan_size_bytes;
1085 cmd->needs_postprocessing = postprocess;
1086 cmd->cmd_origin = origin;
1090 cmd->free_payload_in_start = postprocess;
1116 if (
device->delay_clock_tms < 0)
1154 if (
device->delay_clock_tck < 0)
1166 cmd->payload_out[0] =
count & 0xff;
1167 cmd->payload_out[1] = (
count >> 8) & 0xff;
1190 cmd->needs_postprocessing =
true;
1241 cmd->payload_out[0] =
low;
1242 cmd->payload_out[1] = high;
1275 cmd->payload_out[0] = us & 0x00ff;
1276 cmd->payload_out[1] = (us >> 8) & 0x00ff;
1315 cmd->payload_out[0] = 0;
1320 cmd->payload_out[1] = 0;
1325 cmd->payload_out[2] = 0;
1330 cmd->payload_out[3] = 0;
1335 cmd->payload_out[4] = 0;
1369 cmd->payload_out[0] = 0xAA;
1410 float t_us, x, x_ceil;
1413 t_us = 1000000.0 / f;
1417 x = (t_us - 6.0) / 4;
1420 x = (t_us - 8.5) / 4;
1423 x = (t_us - 8.8308) / 4;
1426 x = (t_us - 10.527) / 4;
1429 x = (t_us - 13.132) / 4;
1451 *delay = (int)x_ceil;
1470 float t_us, f_float;
1480 t_us = (4.0 * delay) + 6.0;
1486 t_us = (4.0 * delay) + 8.5;
1492 t_us = (4.0 * delay) + 8.8308;
1498 t_us = (4.0 * delay) + 10.527;
1504 t_us = (4.0 * delay) + 13.132;
1510 f_float = 1000000.0 / t_us;
1511 return roundf(f_float);
1539 uint8_t tms_sequence, tms_count;
1568 uint32_t scan_size_bits, scan_size_bytes, bits_last_scan;
1569 uint32_t scans_max_payload, bytecount;
1573 uint8_t first_tms_count, first_tms_sequence;
1574 uint8_t last_tms_count, last_tms_sequence;
1576 uint8_t tms_count_pause, tms_sequence_pause;
1577 uint8_t tms_count_resume, tms_sequence_resume;
1579 uint8_t tms_count_start, tms_sequence_start;
1580 uint8_t tms_count_end, tms_sequence_end;
1593 scans_max_payload = scan_size_bytes / 58;
1596 bits_last_scan = scan_size_bits - (scans_max_payload * 58 * 8);
1600 tdo_buffer_start = calloc(scan_size_bytes,
sizeof(uint8_t));
1602 if (!tdo_buffer_start)
1615 if (
cmd->cmd.scan->ir_scan) {
1648 bytecount = scan_size_bytes;
1649 while (bytecount > 0) {
1650 if (bytecount == scan_size_bytes) {
1652 tms_count_start = first_tms_count;
1653 tms_sequence_start = first_tms_sequence;
1656 tms_count_start = tms_count_resume;
1657 tms_sequence_start = tms_sequence_resume;
1660 if (bytecount > 58) {
1661 tms_count_end = tms_count_pause;
1662 tms_sequence_end = tms_sequence_pause;
1680 if (tdi_buffer_start)
1682 if (tdo_buffer_start)
1684 }
else if (bytecount == 58) {
1685 tms_count_end = last_tms_count;
1686 tms_sequence_end = last_tms_sequence;
1703 tms_count_end = last_tms_count;
1704 tms_sequence_end = last_tms_sequence;
1723 free(tdi_buffer_start);
1724 free(tdo_buffer_start);
1729 free(tdi_buffer_start);
1802 uint8_t
low = 0, high = 0;
1839 int ret, state_count;
1841 uint8_t tms_sequence;
1843 unsigned int num_states =
cmd->cmd.pathmove->num_states;
1844 path =
cmd->cmd.pathmove->path;
1847 while (num_states > 0) {
1848 unsigned int batch_size;
1853 if (num_states >= 8)
1856 batch_size = num_states;
1858 for (
unsigned int i = 0; i < batch_size; i++) {
1863 == path[state_count]) {
1868 LOG_ERROR(
"BUG: %s -> %s isn't a valid TAP state transition",
1880 LOG_INFO(
"pathmove batch: count = %i, sequence = 0x%" PRIx8
"", batch_size, tms_sequence);
1915 LOG_ERROR(
"JTAG_STABLECLOCKS: state not stable");
1919 unsigned int num_cycles =
cmd->cmd.stableclocks->num_cycles;
1930 while (num_cycles > 0) {
1931 if (num_cycles > 0xFFFF) {
1934 num_cycles -= 0xFFFF;
1969 LOG_ERROR(
"BUG: angie post process scan encountered an unknown JTAG scan type");
1990 current =
device->queue_start;
1998 switch (openocd_cmd->
type) {
2012 LOG_ERROR(
"BUG: angie post process queue encountered unknown JTAG "
2021 current = current->
next;
2047 switch (
cmd->type) {
2068 LOG_ERROR(
"BUG: encountered unknown JTAG command type");
2152 LOG_DEBUG_IO(
"ANGIE TCK setup: delay_tck = %i (%li Hz),",
2232 int ret, transferred;
2233 char str_manufacturer[20];
2234 bool download_firmware =
false;
2236 uint8_t input_signals, output_signals;
2256 download_firmware =
true;
2259 if (strncmp(str_manufacturer,
"NanoXplore, SAS.", 16) != 0)
2260 download_firmware =
true;
2263 if (download_firmware) {
2264 LOG_INFO(
"Loading ANGIE firmware. This is reversible by power-cycling ANGIE device.");
2266 LOG_ERROR(
"Could not claim interface 0");
2272 LOG_ERROR(
"Could not download firmware and re-numerate ANGIE");
2278 LOG_ERROR(
"Could not download bitstream");
2287 LOG_ERROR(
"Could not claim interface 1");
2293 LOG_ERROR(
"Could not configure io extender 23");
2301 LOG_INFO(
"ANGIE device is already running ANGIE firmware");
2308 LOG_ERROR(
"Choose and claim interface failed");
2319 LOG_ERROR(
"Append test command failed.");
2331 dummy, 64, 200, &transferred);
2333 if (ret !=
ERROR_OK || transferred == 0) {
2335 LOG_ERROR(
"Cannot communicate with ANGIE device. Disconnect ANGIE from "
2336 "the USB port and re-connect, then re-run OpenOCD");
2341 LOG_INFO(
"Recovered from lost Bulk IN packet");
2349 LOG_ERROR(
"Append get signals command failed");
2355 LOG_ERROR(
"Execute get signals command failed");
const char *const jtag_only[]
Definition of the commands supported by the ANGIE firmware.
#define CMD_CONFIGURE_TCK_FREQ
#define CMD_SLOW_CLOCK_TCK
#define CMD_SLOW_SCAN_OUT
#define CMD_SLOW_CLOCK_TMS
static int angie_usb_open(struct angie *device)
Opens the ANGIE device.
#define SECTION_BUFFERSIZE
Maximum size of a single firmware section.
static int angie_speed(int speed)
Set the TCK frequency of the ANGIE adapter.
static int angie_append_scan_cmd(struct angie *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 angie_reset(int trst, int srst)
Execute a JTAG_RESET command.
static int angie_append_get_signals_cmd(struct angie *device)
Read JTAG signals.
#define CPUCS_REG
Address of EZ-USB ANGIE CPU Control & Status register.
static int angie_init(void)
Initiates the firmware download to the ANGIE adapter and prepares the USB handle.
#define ANGIE_FIRMWARE_FILE
Default location of ANGIE firmware image.
static int angie_queue_runtest(struct angie *device, struct jtag_command *cmd)
Run Test.
static int angie_append_configure_tck_cmd(struct angie *device, int delay_scan_in, int delay_scan_out, int delay_scan_io, int delay_tck, int delay_tms)
Set TCK delay counters.
static int angie_load_firmware(struct angie *device, const char *filename)
Downloads a firmware image to the ANGIE's EZ-USB microcontroller over the USB bus.
#define CPU_START
Value to write into CPUCS to put EZ-USB ANGIE out of reset.
static int angie_allocate_payload(struct angie_cmd *angie_cmd, int size, enum angie_payload_direction direction)
Allocate and initialize space in memory for ANGIE command payload.
static int angie_execute_queue(struct jtag_command *cmd_queue)
Executes the JTAG Command Queue.
static void angie_dump_command(struct angie_cmd *angie_cmd)
Print one ANGIE command to stdout.
static int angie_post_process_queue(struct angie *device)
Perform post-processing of commands after ANGIE queue has been executed.
struct adapter_driver angie_adapter_driver
#define REQUEST_FIRMWARE_LOAD
USB Control EP0 bRequest: "Firmware Load".
static struct jtag_interface angie_interface
#define FIRMWARE_ADDR
Base address of firmware in EZ-USB ANGIE code space.
static int angie_queue_pathmove(struct angie *device, struct jtag_command *cmd)
Move to one TAP state or several states in succession.
static void angie_dump_signal_states(uint8_t input_signals, uint8_t output_signals)
Print state of interesting signals via LOG_INFO().
static int angie_append_test_cmd(struct angie *device)
Test command.
static int angie_khz(int khz, int *jtag_speed)
Set the TCK frequency of the ANGIE adapter.
static const char * angie_cmd_id_string(uint8_t id)
Convert an ANGIE command ID (id) to a human-readable string.
static int angie_append_clock_tms_cmd(struct angie *device, uint8_t count, uint8_t sequence)
Perform TAP state transitions.
#define ANGIE_PID
USB Product ID of ANGIE device in unconfigured state (no firmware loaded yet) or with its firmware.
static int angie_queue_sleep(struct angie *device, struct jtag_command *cmd)
Sleep for a specific amount of time.
static void angie_dump_queue(struct angie *device)
Print the ANGIE command queue to stdout.
static int angie_append_clock_tck_cmd(struct angie *device, uint16_t count)
Generate a defined amount of TCK clock cycles.
static int angie_execute_queued_commands(struct angie *device, int timeout_ms)
Sends all queued ANGIE commands to the ANGIE for execution.
static int angie_queue_tlr_reset(struct angie *device, struct jtag_command *cmd)
Move the TAP into the Test Logic Reset state.
static int angie_write_firmware_section(struct angie *device, struct image *firmware_image, int section_index)
Send one contiguous firmware section to the ANGIE's EZ-USB microcontroller over the USB bus.
static int angie_post_process_scan(struct angie_cmd *angie_cmd)
Post-process JTAG_SCAN command.
#define ANGIE_VID
USB Vendor ID of ANGIE device in unconfigured state (no firmware loaded yet) or with its firmware.
static void angie_clear_queue(struct angie *device)
Clear the ANGIE command queue.
static struct angie * angie_handle
static int angie_queue_scan(struct angie *device, struct jtag_command *cmd)
Perform a scan operation on a JTAG register.
angie_type
ANGIE hardware type.
static int angie_queue_statemove(struct angie *device)
Move from the current TAP state to the current TAP end state.
static int angie_get_queue_size(struct angie *device, enum angie_payload_direction direction)
Get the current number of bytes in the queue, including command IDs.
#define ANGIE_RENUMERATION_DELAY_US
Delay (in microseconds) to wait while EZ-USB performs ReNumeration.
static int angie_load_firmware_and_renumerate(struct angie *device, const char *filename, uint32_t delay_us)
Puts the ANGIE's EZ-USB microcontroller into reset state, downloads the firmware image,...
static int angie_i2c_write(struct angie *device, uint8_t *i2c_data, uint8_t i2c_data_size)
Send an i2c write operation to dev-board components.
static int angie_append_sleep_cmd(struct angie *device, uint32_t us)
Sleep for a pre-defined number of microseconds.
static int angie_calculate_delay(enum angie_delay_type type, long f, int *delay)
Calculate delay values for a given TCK frequency.
static int angie_speed_div(int speed, int *khz)
Convert adapter-specific speed value to corresponding TCK frequency in kHz.
static int angie_quit(void)
Closes the USB handle for the ANGIE device.
static int angie_usb_close(struct angie *device)
Releases the ANGIE interface and closes the USB device handle.
static long angie_calculate_frequency(enum angie_delay_type type, int delay)
Calculate frequency for a given delay value.
#define CPU_RESET
Value to write into CPUCS to put EZ-USB ANGIE into reset.
static int angie_cpu_reset(struct angie *device, char reset_bit)
Writes '0' or '1' to the CPUCS register, putting the EZ-USB CPU into reset or out of reset.
#define ANGIE_BITSTREAM_FILE
Default location of ANGIE firmware image.
static int angie_append_set_signals_cmd(struct angie *device, uint8_t low, uint8_t high)
Arbitrarily set JTAG output signals.
static int angie_queue_stableclocks(struct angie *device, struct jtag_command *cmd)
Generate TCK cycles while remaining in a stable state.
static int angie_append_queue(struct angie *device, struct angie_cmd *angie_cmd)
Add a command to the ANGIE command queue.
static void angie_set_end_state(tap_state_t endstate)
Sets the end state follower (see interface.h) if endstate is a stable state.
static int angie_io_extender_config(struct angie *device, uint8_t i2c_adr, uint8_t cfg_value)
Configure dev-board gpio extender modules by configuring their register 3 and register 1 responsible ...
static int angie_load_bitstream(struct angie *device, const char *filename)
Downloads a bitstream file to the ANGIE's FPGA through the EZ-USB microcontroller over the USB bus.
static uint8_t tdi_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]
static uint8_t tdo_buffer[ARMJTAGEW_TAP_BUFFER_SIZE]
static const struct device_t * device
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
unsigned int jtag_scan_size(const struct scan_command *cmd)
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
enum scan_type jtag_scan_type(const struct scan_command *cmd)
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
scan_type
The inferred type of a scan_command structure, indicating whether the command has the host scan in fr...
@ SCAN_IN
From device to host,.
@ SCAN_OUT
From host to device,.
@ SCAN_IO
Full-duplex scan.
void delay_us(uint16_t delay)
static uint16_t direction
void image_close(struct image *image)
int image_read_section(struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read)
int image_open(struct image *image, const char *url, const char *type_string)
bool tap_is_state_stable(tap_state_t astate)
Function tap_is_state_stable returns true if the astate is stable.
tap_state_t tap_state_transition(tap_state_t cur_state, bool tms)
Function tap_state_transition takes a current TAP state and returns the next state according to the t...
const char * tap_state_name(tap_state_t state)
Function tap_state_name Returns a string suitable for display representing the JTAG tap_state.
void tap_set_end_state(tap_state_t new_end_state)
This function sets the state of an "end state follower" which tracks the state that any cable driver ...
tap_state_t tap_get_end_state(void)
For more information,.
int tap_get_tms_path(tap_state_t from, tap_state_t to)
This function provides a "bit sequence" indicating what has to be done with TMS during a sequence of ...
int tap_get_tms_path_len(tap_state_t from, tap_state_t to)
Function int tap_get_tms_path_len returns the total number of bits that represents a TMS path transit...
tap_state_t tap_get_state(void)
This function gets the state of the "state follower" which tracks the state of the TAPs connected to ...
#define tap_set_state(new_state)
This function sets the state of a "state follower" which tracks the state of the TAPs connected to th...
uint8_t delay_scan_in
Delay value for SCAN_IN operations with less than maximum TCK frequency.
uint8_t delay_scan_out
Delay value for SCAN_OUT operations with less than maximum TCK frequency.
uint8_t delay_tck
Delay value for CLOCK_TCK operations with less than maximum frequency.
uint8_t delay_scan_io
Delay value for SCAN_IO operations with less than maximum TCK frequency.
uint8_t delay_tms
Delay value for CLOCK_TMS operations with less than maximum frequency.
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], const char *product, struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial)
int jtag_libusb_bulk_write(struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout, int *transferred)
int jtag_libusb_control_transfer(struct libusb_device_handle *dev, uint8_t request_type, uint8_t request, uint16_t value, uint16_t index, char *bytes, uint16_t size, unsigned int timeout, int *transferred)
void jtag_libusb_close(struct libusb_device_handle *dev)
int jtag_libusb_choose_interface(struct libusb_device_handle *devh, unsigned int *usb_read_ep, unsigned int *usb_write_ep, int bclass, int subclass, int protocol, int trans_type)
Find the first interface optionally matching class, subclass and protocol and claim it.
#define LIBUSB_TIMEOUT_MS
#define LOG_DEBUG_IO(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_LEVEL_IS(FOO)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
target_addr_t addr
Start address to search for the control block.
size_t size
Size of the control block search area.
Represents a driver for a debugging interface.
const char *const name
The name of the interface driver.
ANGIE command (ANGIE command queue element).
uint8_t payload_out_size
OUT direction payload size for this command.
uint8_t payload_in_size
IN direction payload size for this command.
uint8_t * payload_in_start
Pointer to first element of IN payload array.
bool free_payload_in_start
Indicates if angie_clear_queue() should free payload_in_start
uint8_t * payload_in
Pointer where IN payload shall be stored.
struct jtag_command * cmd_origin
Pointer to corresponding OpenOCD command for post-processing.
uint8_t * payload_out
Pointer where OUT payload shall be stored.
struct angie_cmd * next
Pointer to next command (linked list)
uint8_t id
ANGIE command ID.
bool needs_postprocessing
Indicates if this command needs post-processing.
Describes one driver instance.
unsigned int ep_in
IN endpoint number.
int delay_scan_out
Delay value for SCAN_OUT commands.
struct libusb_device_handle * usb_device_handle
int delay_scan_io
Delay value for SCAN_IO commands.
int delay_clock_tms
Delay value for CLOCK_TCK commands.
int commands_in_queue
Number of commands in queue.
int delay_clock_tck
Delay value for CLOCK_TMS commands.
struct angie_cmd * queue_end
Pointer to last command in queue.
int delay_scan_in
Delay value for SCAN_IN commands.
struct libusb_context * libusb_ctx
struct angie_cmd * queue_start
Pointer to first command in queue.
unsigned int ep_out
OUT endpoint number.
unsigned int num_sections
struct imagesection * sections
target_addr_t base_address
enum jtag_command_type type
Represents a driver for a debugging interface.
int(* execute_queue)(struct jtag_command *cmd_queue)
Execute commands in the supplied queue.
static void h_u32_to_be(uint8_t *buf, uint32_t val)
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.
static struct ublast_lowlevel low