OpenOCD
angie.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /****************************************************************************
3  * File : angie.c
4  * Contents : Driver code for NanoXplore USB-JTAG ANGIE
5  * adapter hardware.
6  * Based on FT232R driver code by: Serge Vakulenko
7  *
8  * Copyright 2024, Ahmed BOUDJELIDA, NanoXplore SAS.
9  * <aboudjelida@nanoxplore.com>
10  ****************************************************************************/
11 
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15 
16 #if IS_CYGWIN == 1
17 #include "windows.h"
18 #undef LOG_ERROR
19 #endif
20 
21 // project specific includes
22 #include <jtag/adapter.h>
23 #include <jtag/interface.h>
24 #include <jtag/commands.h>
25 #include <helper/time_support.h>
26 #include "libusb_helper.h"
27 #include <target/image.h>
28 #include <libusb.h>
29 
30 // system includes
31 #include <string.h>
32 #include <stdlib.h>
33 #include <unistd.h>
34 #include <sys/time.h>
35 #include <time.h>
36 
37 /*
38  * Sync bit bang mode is implemented as described in FTDI Application
39  * Note AN232R-01: "Bit Bang Modes for the ANGIE and FT245R".
40  */
41 
45 #define IN_EP 0x84
46 #define OUT_EP 0x02
47 
52 #define CPUCS_REG 0xE600
53 
55 #define REQUEST_FIRMWARE_LOAD 0xA0
56 
58 #define CPU_RESET 0x01
59 
61 #define CPU_START 0x00
62 
64 #define FIRMWARE_ADDR 0x0000
65 
67 #define ANGIE_RENUMERATION_DELAY_US 800000
68 
70 #define ANGIE_FIRMWARE_FILE PKGDATADIR "/angie/angie_firmware.bin"
71 
73 #define ANGIE_BITSTREAM_FILE PKGDATADIR "/angie/angie_bitstream.bit"
74 
79 #define ANGIE_FW_SECTION_SIZE 16384
80 
82 #define VR_CFGOPEN 0xB0
83 #define VR_DATAOUTOPEN 0xB2
84 
85 #define ANGIE_VID 0x584E /* NX Vendor id */
86 #define ANGIE_NPROG_PID 0x424E /* ANGIE non programmed */
87 #define ANGIE_PROG_OOCD_PID 0x414F /* ANGIE programmed OpenOCD */
88 #define ANGIE_PROG_NXB2_PID 0x4a55 /* ANGIE programmed Nxbase2 */
89 
90 #define TCK_GPIO 0
91 #define TDI_GPIO 1
92 #define TDO_GPIO 2
93 #define TMS_GPIO 3
94 #define NTRST_GPIO 4
95 #define NSYSRST_GPIO 6
96 
97 #define ANGIE_XFER_BUFFER_TOTAL_SIZE (16 * 1024)
98 #define ANGIE_USB_BULK_SIZE 512
99 
101 #define ANGIE_USB_TIMEOUT_MS 1000
102 
106 struct read_queue {
107  struct list_head list;
108 };
109 
114  const struct scan_command *cmd;
116  uint8_t *buffer;
117  struct list_head list;
118 };
119 
123 struct angie {
124  struct libusb_device_handle *usbdev;
129  struct read_queue read_queue;
130 };
131 
136 
143 {
144  INIT_LIST_HEAD(&queue->list);
145 }
146 
147 
155  struct read_queue_entry *entry)
156 {
157  list_add_tail(&entry->list, &queue->list);
158 }
159 
167  struct angie *device)
168 {
169  struct read_queue_entry *entry;
170  struct read_queue_entry *tmp;
171 
172  list_for_each_entry_safe(entry, tmp, &queue->list, list) {
173  int scan_size = jtag_scan_size(entry->cmd);
174 
175  // iterate over each bit in scan data
176  for (int bit_cnt = 0; bit_cnt < scan_size; bit_cnt++) {
177  // calculate byte index
178  int bytec = bit_cnt / 8;
179  // calculate bit mask: isolate the specific bit in corresponding byte
180  int bcval = 1 << (bit_cnt % 8);
181  // extract tdo value using index: "bit0_index + bit_cnt*2 + 1"
182  int val = device->reply_buffer[entry->reply_buffer_offset + bit_cnt * 2 + 1];
183  if (val & (1 << TDO_GPIO))
184  entry->buffer[bytec] |= bcval;
185  else
186  entry->buffer[bytec] &= ~bcval;
187  }
188 
189  jtag_read_buffer(entry->buffer, entry->cmd);
190 
191  list_del(&entry->list);
192  free(entry->buffer);
193  free(entry);
194  }
195 }
196 
203 {
204  struct read_queue_entry *entry;
205  struct read_queue_entry *tmp;
206 
207  list_for_each_entry_safe(entry, tmp, &queue->list, list) {
208  list_del(&entry->list);
209  free(entry->buffer);
210  free(entry);
211  }
212 }
213 
231  int xfer_size,
232  int offset,
233  int *bytes_sent)
234 {
235  uint8_t gpifcnt[4];
236  int sent_chunk_size = 0, bytes_received = 0;
237 
238  if (bytes_sent)
239  *bytes_sent = 0;
240 
241  h_u32_to_be(gpifcnt, xfer_size);
242 
243  int ret = jtag_libusb_control_transfer(device->usbdev,
244  LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
245  VR_DATAOUTOPEN, 0, 0, (char *)gpifcnt, sizeof(gpifcnt),
247  if (ret != ERROR_OK) {
248  LOG_ERROR("Failed to send GPIF count to target");
249  return ret;
250  }
251 
252  ret = jtag_libusb_bulk_write(device->usbdev, OUT_EP,
253  (char *)device->xfer_buffer + offset,
254  xfer_size, ANGIE_USB_TIMEOUT_MS, &sent_chunk_size);
255  if (ret != ERROR_OK) {
256  LOG_ERROR("USB bulk transfer failed");
257  return ret;
258  }
259 
260  ret = jtag_libusb_bulk_read(device->usbdev, IN_EP,
261  (char *)device->reply_buffer + offset,
262  sent_chunk_size, ANGIE_USB_TIMEOUT_MS, &bytes_received);
263  if (ret != ERROR_OK) {
264  LOG_ERROR("Failed to read USB reply");
265  return ret;
266  }
267 
268  if (sent_chunk_size == xfer_size && bytes_received == xfer_size) {
269  device->reply_buffer_len += xfer_size;
270  device->xfer_buffer_len -= xfer_size;
271  if (bytes_sent)
272  *bytes_sent += sent_chunk_size;
273  } else {
274  return ERROR_FAIL;
275  }
276 
277  return ERROR_OK;
278 }
279 
289 static int angie_buffer_flush(struct angie *device)
290 {
291  if (device->xfer_buffer_len == 0)
292  return ERROR_OK;
293 
294  int total_bytes_sent = 0;
295  device->reply_buffer_len = 0;
296 
297  do {
298  int sent_chunk_size;
299  size_t xfer_size = MIN(device->xfer_buffer_len, ANGIE_USB_BULK_SIZE);
300  int ret = angie_buffer_flush_chunk(device, xfer_size,
301  total_bytes_sent, &sent_chunk_size);
302  if (ret != ERROR_OK)
303  return ret;
304  total_bytes_sent += sent_chunk_size;
305  } while (device->xfer_buffer_len > 0);
306 
307  angie_read_queue_execute(&device->read_queue, device);
308 
309  return ERROR_OK;
310 }
311 
320 static int angie_buffer_flush_check(struct angie *device, size_t size)
321 {
322  if (device->xfer_buffer_len + size >= ANGIE_XFER_BUFFER_TOTAL_SIZE)
323  return angie_buffer_flush(device);
324  return ERROR_OK;
325 }
326 
334 static int angie_buffer_append_simple(struct angie *device, uint8_t value)
335 {
336  if (device->xfer_buffer_len >= ANGIE_XFER_BUFFER_TOTAL_SIZE) {
337  int ret = angie_buffer_flush(device);
338  if (ret != ERROR_OK)
339  return ret;
340  }
341  device->xfer_buffer[device->xfer_buffer_len++] = value;
342  return ERROR_OK;
343 }
344 
354 static int angie_buffer_append(struct angie *device, int tck, int tms, int tdi)
355 {
356  uint8_t val = (1 << NTRST_GPIO) | (1 << NSYSRST_GPIO);
357  if (tck)
358  val |= (1 << TCK_GPIO);
359  if (tms)
360  val |= (1 << TMS_GPIO);
361  if (tdi)
362  val |= (1 << TDI_GPIO);
363 
364  return angie_buffer_append_simple(device, val);
365 }
366 
373 static int angie_usb_open(struct angie *device)
374 {
375  uint16_t avids[] = {
376  ANGIE_VID,
377  ANGIE_VID,
378  ANGIE_VID,
379  0,
380  };
381  uint16_t apids[] = {
385  0,
386  };
387  struct libusb_device_handle *usb_dev;
388 
389  int ret = jtag_libusb_open(avids, apids, NULL, &usb_dev, NULL);
390  if (ret != ERROR_OK) {
391  LOG_ERROR("Failed to open ANGIE USB interface");
392  return ret;
393  }
394 
395  device->usbdev = usb_dev;
396 
397  return ERROR_OK;
398 }
399 
406 static int angie_usb_close(struct angie *device)
407 {
408  int ret = ERROR_OK;
409 
410  if (device->usbdev) {
411  if (libusb_release_interface(device->usbdev, 0) != LIBUSB_SUCCESS) {
412  LOG_ERROR("Could not release interface 0");
413  ret = ERROR_FAIL;
414  }
415 
416  jtag_libusb_close(device->usbdev);
417  device->usbdev = NULL;
418  }
419 
420  return ret;
421 }
422 
431 static int angie_cpu_reset(struct angie *device, char reset_bit)
432 {
433  return jtag_libusb_control_transfer(device->usbdev,
434  LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
435  REQUEST_FIRMWARE_LOAD, CPUCS_REG, 0, &reset_bit, 1,
437 }
438 
449 static int angie_write_firmware_section(struct angie *device, uint16_t address,
450  uint8_t *data, size_t size)
451 {
452  int bytes_remaining = size;
453 
454  // Send section data in chunks of up to 64 bytes to ANGIE
455  while (bytes_remaining > 0) {
456  int chunk_size;
457  int transferred;
458 
459  if (bytes_remaining > 64)
460  chunk_size = 64;
461  else
462  chunk_size = bytes_remaining;
463 
464  int ret = jtag_libusb_control_transfer(device->usbdev,
465  LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
467  chunk_size, ANGIE_USB_TIMEOUT_MS, &transferred);
468 
469  if (ret != ERROR_OK)
470  return ret;
471 
472  if (transferred != chunk_size) {
473  // Abort if libusb sent less data than requested
474  return ERROR_FAIL;
475  }
476 
477  bytes_remaining -= chunk_size;
478  address += chunk_size;
479  data += chunk_size;
480  }
481 
482  return ERROR_OK;
483 }
484 
494 static int angie_load_firmware(struct angie *device, const char *filename)
495 {
496  struct image angie_firmware_image;
497 
498  int ret = angie_cpu_reset(device, CPU_RESET);
499  if (ret != ERROR_OK) {
500  LOG_ERROR("Could not halt ANGIE CPU");
501  return ret;
502  }
503 
504  angie_firmware_image.base_address = 0;
505  angie_firmware_image.base_address_set = false;
506 
507  ret = image_open(&angie_firmware_image, filename, "bin");
508  if (ret != ERROR_OK) {
509  LOG_ERROR("Could not load firmware image");
510  return ret;
511  }
512 
513  uint8_t *data = malloc(ANGIE_FW_SECTION_SIZE);
514  if (!data) {
515  LOG_ERROR("Out of memory");
516  return ERROR_FAIL;
517  }
518 
519  // Download all sections in the image to ANGIE
520  for (unsigned int i = 0; i < angie_firmware_image.num_sections; i++) {
521  size_t size_read;
522  uint32_t size = angie_firmware_image.sections[i].size;
523  int addr = angie_firmware_image.sections[i].base_address;
524 
525  LOG_DEBUG("section %02i at addr 0x%04x (size 0x%04" PRIx32 ")",
526  i, addr, size);
527 
528  ret = image_read_section(&angie_firmware_image, i, 0,
529  size, data, &size_read);
530  if (ret != ERROR_OK)
531  goto exit;
532  if (size_read != size) {
533  ret = ERROR_FAIL;
534  goto exit;
535  }
536 
538  if (ret != ERROR_OK) {
539  LOG_ERROR("Could not write firmware section");
540  goto exit;
541  }
542  }
543 
544  image_close(&angie_firmware_image);
545 
547  if (ret != ERROR_OK) {
548  LOG_ERROR("Could not restart ANGIE CPU");
549  goto exit;
550  }
551 
552 exit:
553  free(data);
554  return ret;
555 }
556 
569  const char *filename,
570  uint32_t delay_us)
571 {
572  /*
573  * Basic process: After downloading the firmware, the ANGIE will disconnect
574  * itself and re-connect after a short amount of time so we have to close
575  * the handle and re-enumerate USB devices.
576  */
577 
578  int ret = angie_load_firmware(device, filename);
579  if (ret != ERROR_OK)
580  return ret;
581 
582  ret = angie_usb_close(device);
583  if (ret != ERROR_OK)
584  return ret;
585 
586  usleep(delay_us);
587 
588  ret = angie_usb_open(device);
589  if (ret != ERROR_OK)
590  return ret;
591 
592  if (libusb_claim_interface(angie_handle->usbdev, 0) != LIBUSB_SUCCESS)
593  return ERROR_FAIL;
594 
595  return ERROR_OK;
596 }
597 
607 static int angie_load_bitstream(struct angie *device, const char *filename)
608 {
609  int ret = ERROR_OK, transferred;
610  const char *bitstream_file_path = filename;
611  FILE *bitstream_file = NULL;
612  char *bitstream_data = NULL;
613  uint8_t gpifcnt[4];
614 
615  // Open the bitstream file
616  bitstream_file = fopen(bitstream_file_path, "rb");
617  if (!bitstream_file) {
618  LOG_ERROR("Failed to open bitstream file: %s\n", bitstream_file_path);
619  ret = ERROR_FAIL;
620  goto exit;
621  }
622 
623  // Get the size of the bitstream file
624  fseek(bitstream_file, 0, SEEK_END);
625  size_t bitstream_size = ftell(bitstream_file);
626  fseek(bitstream_file, 0, SEEK_SET);
627 
628  // Allocate memory for the bitstream data
629  bitstream_data = malloc(bitstream_size);
630  if (!bitstream_data) {
631  LOG_ERROR("Failed to allocate memory for bitstream data.");
632  ret = ERROR_FAIL;
633  goto exit;
634  }
635 
636  // Read the bitstream data from the file
637  if (fread(bitstream_data, 1, bitstream_size, bitstream_file) != bitstream_size) {
638  LOG_ERROR("Failed to read bitstream data.");
639  ret = ERROR_FAIL;
640  goto exit;
641  }
642 
643  // CFG Open
644  h_u32_to_be(gpifcnt, bitstream_size);
645  ret = jtag_libusb_control_transfer(device->usbdev,
646  LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
647  VR_CFGOPEN, 0, 0, (char *)gpifcnt, sizeof(gpifcnt),
648  ANGIE_USB_TIMEOUT_MS, &transferred);
649  if (ret != ERROR_OK) {
650  LOG_ERROR("Failed opencfg");
651  goto exit;
652  }
653 
654  // Send the bitstream data to the microcontroller
655  int actual_length = 0;
656  ret = jtag_libusb_bulk_write(device->usbdev, OUT_EP, bitstream_data,
657  bitstream_size, ANGIE_USB_TIMEOUT_MS, &actual_length);
658  if (ret != ERROR_OK) {
659  LOG_ERROR("Failed to send bitstream data: %s", libusb_strerror(ret));
660  goto exit;
661  }
662 
663  LOG_INFO("Bitstream sent successfully.");
664 
665 exit:
666  free(bitstream_data);
667  if (bitstream_file)
668  fclose(bitstream_file);
669 
670  return ret;
671 }
672 
680 {
681  struct libusb_device_descriptor desc;
682 
683  // Get String Descriptor to determine if firmware needs to be loaded
684  int ret = libusb_get_device_descriptor(libusb_get_device(angie_handle->usbdev),
685  &desc);
686  if (ret != LIBUSB_SUCCESS)
687  // Could not get descriptor -> Unconfigured or original Keil firmware
688  return true;
689  else if (desc.idProduct != ANGIE_PROG_OOCD_PID)
690  return true;
691 
692  return false;
693 }
694 
701 {
702  if (tap_is_state_stable(state)) {
704  } else {
705  LOG_ERROR("BUG: %i is not a valid end state", state);
706  exit(-1);
707  }
708 }
709 
717 static int angie_state_move(struct angie *device, int skip)
718 {
719  int ret;
720  int tms = 0;
721  uint8_t tms_scan = tap_get_tms_path(tap_get_state(), tap_get_end_state());
723 
724  // tms_scan has 8 bits that we bitbang one by one
725  for (int i = skip; i < tms_count; i++) {
726  tms = (tms_scan >> i) & 1;
727  ret = angie_buffer_append(device, 0, tms, 0);
728  if (ret != ERROR_OK)
729  return ret;
730  ret = angie_buffer_append(device, 1, tms, 0);
731  if (ret != ERROR_OK)
732  return ret;
733  }
734  ret = angie_buffer_append(device, 0, tms, 0);
735  if (ret != ERROR_OK)
736  return ret;
737 
739 
740  return ERROR_OK;
741 }
742 
750 static int angie_jtag_scan_size(struct angie *device,
751  const struct scan_command *cmd)
752 {
753  int cmd_size = 0;
754  int count = 0;
755 
756  // move to TAP_IRSHIFT or TAP_DRSHIFT state
757  if (cmd->ir_scan)
759  else
761  cmd_size += count * 2 + 1;
762 
763  // add scan size
764  cmd_size += jtag_scan_size(cmd) * 2;
765 
766  /*
767  * move to cmd specified end state
768  * Also, see below function
769  * we *KNOW* the above loop transitioned out of
770  * the shift state, so we skip the first state
771  * and move directly to the end state.
772  */
773  if (cmd->ir_scan)
774  count = tap_get_tms_path_len(TAP_IRSHIFT, cmd->end_state) - 1;
775  else
776  count = tap_get_tms_path_len(TAP_DRSHIFT, cmd->end_state) - 1;
777  cmd_size += count * 2 + 1;
778 
779  return cmd_size;
780 }
781 
790  const struct scan_command *cmd)
791 {
792  uint8_t *buffer = NULL;
793  LOG_DEBUG_IO("SCAN: size=%d %s scan end in %s", jtag_scan_size(cmd),
794  (cmd->ir_scan) ? "IR" : "DR", tap_state_name(cmd->end_state));
795 
796  if (cmd->ir_scan) {
797  if (tap_get_state() != TAP_IRSHIFT)
799  } else {
800  if (tap_get_state() != TAP_DRSHIFT)
802  }
803  int ret = angie_state_move(device, 0);
804  if (ret != ERROR_OK)
805  return ret;
806  angie_set_end_state(cmd->end_state);
807 
808  // Execute scan
809  int scan_size = jtag_build_buffer(cmd, &buffer);
811 
812  // starting byte index
813  int start_offset = device->xfer_buffer_len;
814 
815  // iterate over each bit in all scan data
816  int tms = 0;
817  int tdi = 0;
818  for (int i = 0; i < scan_size; i++) {
819  // calculate tms
820  // if we finish shifting tdi bits : '1' , else '0'
821  tms = (i == scan_size - 1) ? 1 : 0;
822  // calculate byte index
823  int bytec = i / 8;
824  // calculate bit mask: isolate the specific bit in corresponding byte
825  int bcval = 1 << (i % 8);
826  // if type is not SCAN_IN (not just reading data)
827  // and the bit masked is '1' then tdi = '1'
828  tdi = 0;
829  if (type != SCAN_IN && (buffer[bytec] & bcval))
830  tdi = 1;
831  // write tdi and tms twice in tck=0 and tck=1
832  ret = angie_buffer_append(device, 0, tms, tdi);
833  if (ret != ERROR_OK) {
834  free(buffer);
835  return ret;
836  }
837  ret = angie_buffer_append(device, 1, tms, tdi);
838  if (ret != ERROR_OK) {
839  free(buffer);
840  return ret;
841  }
842  }
843 
844  angie_set_end_state(cmd->end_state);
845  if (tap_get_state() != tap_get_end_state()) {
846  /*
847  * We *KNOW* the above loop transitioned out of
848  * the shift state, so we skip the first state
849  * and move directly to the end state.
850  */
851  ret = angie_state_move(device, 1);
852  if (ret != ERROR_OK) {
853  free(buffer);
854  return ret;
855  }
856  }
857 
858  if (jtag_scan_type(cmd) != SCAN_OUT) {
859  // queue read back buffer for further processing
860  struct read_queue_entry *entry = malloc(sizeof(*entry));
861  if (!entry) {
862  LOG_ERROR("Out of memory");
863  free(buffer);
864  return ERROR_FAIL;
865  }
866 
867  entry->reply_buffer_offset = start_offset;
868  entry->cmd = cmd;
869  entry->buffer = buffer;
870  angie_read_queue_add(&device->read_queue, entry);
871  } else {
872  // built buffer won't be of later use
873  free(buffer);
874  }
875 
876  return ERROR_OK;
877 }
878 
887  const struct runtest_command *cmd)
888 {
889  int cmd_size = 0;
890 
891  if (tap_get_state() != TAP_IDLE)
892  cmd_size += tap_get_tms_path_len(tap_get_state(), TAP_IDLE) * 2 + 1;
893  cmd_size += cmd->num_cycles * 2 + 1;
894  if (tap_get_end_state() != TAP_IDLE)
895  cmd_size += tap_get_tms_path_len(TAP_IDLE, tap_get_end_state()) * 2 + 1;
896 
897  return cmd_size;
898 }
899 
908  const struct runtest_command *cmd)
909 {
910  int ret;
911  enum tap_state saved_end_state = tap_get_end_state();
912 
913  LOG_DEBUG_IO("RUNTEST: %d cycles", cmd->num_cycles);
914 
915  // only do a state_move when we're not already in IDLE
916  if (tap_get_state() != TAP_IDLE) {
918  ret = angie_state_move(device, 0);
919  if (ret != ERROR_OK)
920  return ret;
921  }
922 
923  // execute num_cycles
924  for (unsigned int i = 0; i < cmd->num_cycles; i++) {
925  ret = angie_buffer_append(device, 0, 0, 0);
926  if (ret != ERROR_OK)
927  return ret;
928  ret = angie_buffer_append(device, 1, 0, 0);
929  if (ret != ERROR_OK)
930  return ret;
931  }
932  ret = angie_buffer_append(device, 0, 0, 0);
933  if (ret != ERROR_OK)
934  return ret;
935 
936  // finish in end_state
937  angie_set_end_state(saved_end_state);
938  if (tap_get_state() != tap_get_end_state()) {
939  ret = angie_state_move(device, 0);
940  if (ret != ERROR_OK)
941  return ret;
942  }
943 
944  return ERROR_OK;
945 }
946 
957  const struct tms_command *cmd)
958 {
959  unsigned int num_bits = cmd->num_bits;
960  const uint8_t *bits = cmd->bits;
961 
962  LOG_DEBUG_IO("TMS: %d bits", num_bits);
963 
964  int tms = 0;
965  for (unsigned int i = 0; i < num_bits; i++) {
966  tms = ((bits[i / 8] >> (i % 8)) & 1);
967  int ret = angie_buffer_append(device, 0, tms, 0);
968  if (ret != ERROR_OK)
969  return ret;
970  ret = angie_buffer_append(device, 1, tms, 0);
971  if (ret != ERROR_OK)
972  return ret;
973  }
974 
975  return angie_buffer_append(device, 0, tms, 0);
976 }
977 
988  const struct reset_command *cmd)
989 {
990  LOG_DEBUG_IO("RESET: trst %i srst %i", cmd->trst, cmd->srst);
991 
992  uint8_t out_value = (1 << NTRST_GPIO) | (1 << NSYSRST_GPIO);
993  if (cmd->trst == 1 ||
996 
997  if (cmd->trst == 1)
998  out_value &= ~(1 << NTRST_GPIO); // switch /TRST low
999  else if (cmd->trst == 0)
1000  out_value |= (1 << NTRST_GPIO); // switch /TRST high
1001 
1002  if (cmd->srst == 1)
1003  out_value &= ~(1 << NSYSRST_GPIO); // switch /SYSRST low
1004  else if (cmd->srst == 0)
1005  out_value |= (1 << NSYSRST_GPIO); // switch /SYSRST high
1006 
1007  return angie_buffer_append_simple(device, out_value);
1008 }
1009 
1023  const struct stableclocks_command *cmd)
1024 {
1025  int tms = (tap_get_state() == TAP_RESET ? 1 : 0);
1026 
1027  // send num_cycles clocks onto the cable
1028  for (unsigned int i = 0; i < cmd->num_cycles; i++) {
1029  int ret = angie_buffer_append(device, 1, tms, 0);
1030  if (ret != ERROR_OK)
1031  return ret;
1032  ret = angie_buffer_append(device, 0, tms, 0);
1033  if (ret != ERROR_OK)
1034  return ret;
1035  }
1036 
1037  LOG_DEBUG_IO("clocks %i while in %s", cmd->num_cycles,
1039 
1040  return ERROR_OK;
1041 }
1042 
1051  const struct statemove_command *cmd)
1052 {
1053  LOG_DEBUG_IO("statemove end in %s", tap_state_name(cmd->end_state));
1054  angie_set_end_state(cmd->end_state);
1055  return angie_state_move(device, 0);
1056 }
1057 
1066  const struct pathmove_command *cmd)
1067 {
1068  int ret;
1069  int num_states = cmd->num_states;
1070  int tms = 0;
1071 
1072  LOG_DEBUG_IO("pathmove: %i states, end in %s", cmd->num_states,
1073  tap_state_name(cmd->path[cmd->num_states - 1]));
1074 
1075  int state_count = 0;
1076  while (num_states) {
1077  if (tap_state_transition(tap_get_state(), false) == cmd->path[state_count]) {
1078  tms = 0;
1079  } else if (tap_state_transition(tap_get_state(), true) == cmd->path[state_count]) {
1080  tms = 1;
1081  } else {
1082  LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition",
1084  tap_state_name(cmd->path[state_count]));
1085  return ERROR_JTAG_DEVICE_ERROR;
1086  }
1087 
1088  ret = angie_buffer_append(device, 0, tms, 0);
1089  if (ret != ERROR_OK)
1090  return ret;
1091  ret = angie_buffer_append(device, 1, tms, 0);
1092  if (ret != ERROR_OK)
1093  return ret;
1094 
1095  tap_set_state(cmd->path[state_count]);
1096  state_count++;
1097  num_states--;
1098  }
1099  ret = angie_buffer_append(device, 0, tms, 0);
1100  if (ret != ERROR_OK)
1101  return ret;
1102 
1104 
1105  return ERROR_OK;
1106 }
1107 
1115 static size_t angie_cmd_size(struct angie *device, const struct jtag_command *cmd)
1116 {
1117  switch (cmd->type) {
1118  case JTAG_SCAN:
1119  return angie_jtag_scan_size(device, cmd->cmd.scan);
1120  case JTAG_TMS:
1121  return cmd->cmd.tms->num_bits + 2 + 1;
1122  case JTAG_RESET:
1123  return 1;
1124  case JTAG_RUNTEST:
1125  return angie_jtag_runtest_size(device, cmd->cmd.runtest);
1126  case JTAG_STABLECLOCKS:
1127  return cmd->cmd.stableclocks->num_cycles * 2;
1128  case JTAG_TLR_RESET: // renamed from JTAG_STATEMOVE
1130  cmd->cmd.statemove->end_state) * 2 + 1;
1131  case JTAG_PATHMOVE:
1132  return cmd->cmd.pathmove->num_states * 2 + 1;
1133  case JTAG_SLEEP:
1134  LOG_DEBUG_IO("sleep %" PRIu32, cmd->cmd.sleep->us);
1135  return 0;
1136  default:
1137  LOG_ERROR("BUG: unknown JTAG command type encountered");
1138  return 0;
1139  }
1140 }
1141 
1148 static int angie_jtag_execute_queue(struct jtag_command *cmd_queue)
1149 {
1150  int retval = ERROR_OK;
1151  struct jtag_command *cmd = cmd_queue;
1152  struct angie *device = angie_handle;
1153 
1154  while (cmd) {
1156  if (retval != ERROR_OK)
1157  return retval;
1158 
1159  switch (cmd->type) {
1160  case JTAG_SCAN:
1161  retval = angie_jtag_execute_scan(device, cmd->cmd.scan);
1162  if (retval != ERROR_OK)
1163  return retval;
1164  break;
1165  case JTAG_TMS:
1166  retval = angie_jtag_execute_tms(device, cmd->cmd.tms);
1167  if (retval != ERROR_OK)
1168  return retval;
1169  retval = angie_buffer_flush(device);
1170  if (retval != ERROR_OK)
1171  return retval;
1172  break;
1173  case JTAG_RESET:
1174  angie_jtag_execute_reset(device, cmd->cmd.reset);
1175  retval = angie_buffer_flush(device);
1176  if (retval != ERROR_OK)
1177  return retval;
1178  break;
1179  case JTAG_RUNTEST:
1180  retval = angie_jtag_execute_runtest(device, cmd->cmd.runtest);
1181  if (retval != ERROR_OK)
1182  return retval;
1183  break;
1184  case JTAG_STABLECLOCKS:
1185  /* this is only allowed while in a stable state. A check for a stable
1186  * state was done in jtag_add_clocks()
1187  */
1188  retval = angie_jtag_execute_stableclocks(device, cmd->cmd.stableclocks);
1189  if (retval != ERROR_OK)
1190  return retval;
1191  retval = angie_buffer_flush(device);
1192  if (retval != ERROR_OK)
1193  return retval;
1194  break;
1195  case JTAG_TLR_RESET: // renamed from JTAG_STATEMOVE
1196  retval = angie_jtag_execute_statemove(device, cmd->cmd.statemove);
1197  if (retval != ERROR_OK)
1198  return retval;
1199  retval = angie_buffer_flush(device);
1200  if (retval != ERROR_OK)
1201  return retval;
1202  break;
1203  case JTAG_PATHMOVE:
1204  retval = angie_jtag_execute_pathmove(device, cmd->cmd.pathmove);
1205  if (retval != ERROR_OK)
1206  return retval;
1207  retval = angie_buffer_flush(device);
1208  if (retval != ERROR_OK)
1209  return retval;
1210  break;
1211  case JTAG_SLEEP:
1212  LOG_DEBUG_IO("sleep %" PRIu32, cmd->cmd.sleep->us);
1213  jtag_sleep(cmd->cmd.sleep->us);
1214  break;
1215  default:
1216  LOG_ERROR("BUG: unknown JTAG command type encountered");
1217  break;
1218  }
1219 
1220  cmd = cmd->next;
1221  }
1222 
1223  return angie_buffer_flush(device);
1224 }
1225 
1231 static int angie_quit(void)
1232 {
1233  if (!angie_handle)
1234  return ERROR_OK;
1235 
1236  int ret = angie_usb_close(angie_handle);
1237  if (ret != ERROR_OK)
1238  return ret;
1239 
1241 
1242  free(angie_handle);
1243  angie_handle = NULL;
1244 
1245  return ERROR_OK;
1246 }
1247 
1253 static int angie_init(void)
1254 {
1255  int ret;
1256 
1257  angie_handle = calloc(1, sizeof(*angie_handle));
1258  if (!angie_handle) {
1259  ret = ERROR_FAIL;
1260  goto exit;
1261  }
1262 
1264 
1266  if (ret != ERROR_OK)
1267  goto exit;
1268 
1270  LOG_INFO("Loading ANGIE firmware. This is reversible by power-cycling ANGIE device.");
1271 
1272  ret = libusb_claim_interface(angie_handle->usbdev, 0);
1273  if (ret != LIBUSB_SUCCESS) {
1274  LOG_ERROR("Failed to claim interface 0");
1275  ret = ERROR_FAIL;
1276  goto exit;
1277  }
1278 
1282  if (ret != ERROR_OK) {
1283  LOG_ERROR("Could not download firmware and re-numerate ANGIE");
1284  angie_quit();
1285  return ret;
1286  }
1287 
1289  if (ret != ERROR_OK) {
1290  LOG_ERROR("Could not download bitstream");
1291  angie_quit();
1292  return ret;
1293  }
1294  } else {
1295  LOG_INFO("ANGIE device is already running ANGIE firmware");
1296  }
1297 
1298  return ERROR_OK;
1299 exit:
1300  angie_quit();
1301  return ret;
1302 }
1303 
1309 static int angie_speed(int divisor)
1310 {
1311  int baud = (divisor == 0) ? 3000000 :
1312  (divisor == 1) ? 2000000 :
1313  3000000 / divisor;
1314  LOG_DEBUG("angie speed(%d) rate %d bits/sec", divisor, baud);
1315 
1316  return ERROR_OK;
1317 }
1318 
1326 static int angie_khz(int khz, int *divisor)
1327 {
1328  if (khz == 0) {
1329  LOG_DEBUG("RCLK not supported");
1330  return ERROR_FAIL;
1331  }
1332 
1333  // Calculate frequency divisor.
1334  if (khz > 2500) {
1335  *divisor = 0; // Special case: 3 MHz
1336  } else if (khz > 1700) {
1337  *divisor = 1; // Special case: 2 MHz
1338  } else {
1339  *divisor = (2 * 3000 / khz + 1) / 2;
1340  if (*divisor > 0x3FFF)
1341  *divisor = 0x3FFF;
1342  }
1343  return ERROR_OK;
1344 }
1345 
1353 static int angie_speed_div(int divisor, int *khz)
1354 {
1355  // Maximum 3 Mbaud for bit bang mode
1356  if (divisor == 0)
1357  *khz = 30000;
1358  else if (divisor == 1)
1359  *khz = 20000;
1360  else
1361  *khz = 30000 / divisor;
1362  return ERROR_OK;
1363 }
1364 
1365 static struct jtag_interface angie_interface = {
1367  .execute_queue = angie_jtag_execute_queue,
1368 };
1369 
1371  .name = "angie",
1372  .transport_ids = TRANSPORT_JTAG,
1373  .transport_preferred_id = TRANSPORT_JTAG,
1374 
1375  .init = angie_init,
1376  .quit = angie_quit,
1377  .speed = angie_speed,
1378  .khz = angie_khz,
1379  .speed_div = angie_speed_div,
1380 
1381  .jtag_ops = &angie_interface,
1382 };
static int angie_usb_open(struct angie *device)
Open Angie USB interface.
Definition: angie.c:373
#define ANGIE_XFER_BUFFER_TOTAL_SIZE
Definition: angie.c:97
#define CPUCS_REG
Address of EZ-USB ANGIE CPU Control & Status register.
Definition: angie.c:52
static int angie_init(void)
Angie initialization method.
Definition: angie.c:1253
static bool angie_is_firmware_needed(struct angie *device)
Check if Angie firmware must be updated.
Definition: angie.c:679
#define ANGIE_FIRMWARE_FILE
Default location of ANGIE firmware image.
Definition: angie.c:70
#define ANGIE_NPROG_PID
Definition: angie.c:86
static int angie_jtag_execute_pathmove(struct angie *device, const struct pathmove_command *cmd)
Execute JTAG PATHMOVE command.
Definition: angie.c:1065
static int angie_jtag_scan_size(struct angie *device, const struct scan_command *cmd)
Return JTAG SCAN command size in bytes.
Definition: angie.c:750
static int angie_buffer_flush_check(struct angie *device, size_t size)
Check if transfer buffer has enough remaining space for a given size.
Definition: angie.c:320
#define TMS_GPIO
Definition: angie.c:93
static int angie_jtag_execute_scan(struct angie *device, const struct scan_command *cmd)
Execute JTAG SCAN command.
Definition: angie.c:789
static int angie_state_move(struct angie *device, int skip)
Move TAP to given state.
Definition: angie.c:717
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.
Definition: angie.c:494
#define CPU_START
Value to write into CPUCS to put EZ-USB ANGIE out of reset.
Definition: angie.c:61
#define TDI_GPIO
Definition: angie.c:91
#define OUT_EP
Definition: angie.c:46
#define ANGIE_USB_TIMEOUT_MS
USB timeout delay in milliseconds.
Definition: angie.c:101
static void angie_read_queue_execute(struct read_queue *queue, struct angie *device)
Execute elements enqueued in the read queue list.
Definition: angie.c:166
struct adapter_driver angie_adapter_driver
Definition: angie.c:1370
#define REQUEST_FIRMWARE_LOAD
USB Control EP0 bRequest: "Firmware Load".
Definition: angie.c:55
static struct jtag_interface angie_interface
Definition: angie.c:1365
#define IN_EP
USB endpoints.
Definition: angie.c:45
#define NTRST_GPIO
Definition: angie.c:94
#define FIRMWARE_ADDR
Base address of firmware in EZ-USB ANGIE code space.
Definition: angie.c:64
static int angie_buffer_flush_chunk(struct angie *device, int xfer_size, int offset, int *bytes_sent)
Flush a chunk of Angie's buffer.
Definition: angie.c:230
static int angie_write_firmware_section(struct angie *device, uint16_t address, uint8_t *data, size_t size)
Send one contiguous firmware section to the ANGIE's EZ-USB microcontroller over the USB bus.
Definition: angie.c:449
#define TCK_GPIO
Definition: angie.c:90
static int angie_jtag_execute_queue(struct jtag_command *cmd_queue)
Execute JTAG commands queue.
Definition: angie.c:1148
static void angie_read_queue_clean(struct read_queue *queue)
Clear the read queue list.
Definition: angie.c:202
static int angie_buffer_flush(struct angie *device)
Flush Angie transfer buffer.
Definition: angie.c:289
#define ANGIE_USB_BULK_SIZE
Definition: angie.c:98
static void angie_read_queue_add(struct read_queue *queue, struct read_queue_entry *entry)
Add a single entry to the read queue.
Definition: angie.c:154
static int angie_jtag_execute_reset(struct angie *device, const struct reset_command *cmd)
Execute JTAG RESET command Control /TRST and /SYSRST pins.
Definition: angie.c:987
#define ANGIE_VID
Definition: angie.c:85
static int angie_jtag_execute_statemove(struct angie *device, const struct statemove_command *cmd)
Execute JTAG STATEMOVE command.
Definition: angie.c:1050
#define ANGIE_FW_SECTION_SIZE
Maximum size of a single firmware section.
Definition: angie.c:79
struct angie * angie_handle
Angie device singleton.
Definition: angie.c:135
static int angie_buffer_append(struct angie *device, int tck, int tms, int tdi)
Append a bit-bang JTAG value to the transfer buffer.
Definition: angie.c:354
static size_t angie_cmd_size(struct angie *device, const struct jtag_command *cmd)
Process command size in bytes.
Definition: angie.c:1115
#define ANGIE_PROG_OOCD_PID
Definition: angie.c:87
#define TDO_GPIO
Definition: angie.c:92
#define ANGIE_RENUMERATION_DELAY_US
Delay (in microseconds) to wait while EZ-USB performs ReNumeration.
Definition: angie.c:67
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,...
Definition: angie.c:568
static int angie_buffer_append_simple(struct angie *device, uint8_t value)
Append a single byte value to the transfer buffer.
Definition: angie.c:334
static int angie_speed(int divisor)
Angie set speed method.
Definition: angie.c:1309
static int angie_khz(int khz, int *divisor)
Angie set khz method.
Definition: angie.c:1326
#define VR_DATAOUTOPEN
Definition: angie.c:83
static int angie_jtag_execute_stableclocks(struct angie *device, const struct stableclocks_command *cmd)
Execute JTAG STABLECLOCKS command Issues a number of clock cycles while staying in a stable state.
Definition: angie.c:1022
static int angie_jtag_execute_runtest(struct angie *device, const struct runtest_command *cmd)
Execute JTAG RUNTEST command.
Definition: angie.c:907
static int angie_quit(void)
Angie quit method.
Definition: angie.c:1231
static int angie_usb_close(struct angie *device)
Releases the ANGIE interface and closes the USB device handle.
Definition: angie.c:406
#define ANGIE_PROG_NXB2_PID
Definition: angie.c:88
#define CPU_RESET
Value to write into CPUCS to put EZ-USB ANGIE into reset.
Definition: angie.c:58
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.
Definition: angie.c:431
#define NSYSRST_GPIO
Definition: angie.c:95
#define ANGIE_BITSTREAM_FILE
Default location of ANGIE firmware image.
Definition: angie.c:73
static void angie_read_queue_init(struct read_queue *queue)
Init read queue list.
Definition: angie.c:142
static int angie_jtag_execute_tms(struct angie *device, const struct tms_command *cmd)
Execute JTAG TMS command Clock a bunch of TMS transitions, to change the JTAG state machine.
Definition: angie.c:956
#define VR_CFGOPEN
Vendor Requests.
Definition: angie.c:82
static int angie_speed_div(int divisor, int *khz)
Angie set speed div.
Definition: angie.c:1353
static void angie_set_end_state(enum tap_state state)
Set TAP end state.
Definition: angie.c:700
static int angie_jtag_runtest_size(struct angie *device, const struct runtest_command *cmd)
Return JTAG RUNTEST command size in bytes.
Definition: angie.c:886
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.
Definition: angie.c:607
static const struct device_t * device
Definition: at91rm9200.c:94
unsigned int jtag_scan_size(const struct scan_command *cmd)
Definition: commands.c:181
int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
Definition: commands.c:192
enum scan_type jtag_scan_type(const struct scan_command *cmd)
Definition: commands.c:167
int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
Definition: commands.c:230
scan_type
The inferred type of a scan_command structure, indicating whether the command has the host scan in fr...
Definition: commands.h:22
@ SCAN_IN
From device to host,.
Definition: commands.h:24
@ SCAN_OUT
From host to device,.
Definition: commands.h:26
@ JTAG_TLR_RESET
Definition: commands.h:137
@ JTAG_SCAN
Definition: commands.h:129
@ JTAG_PATHMOVE
Definition: commands.h:140
@ JTAG_STABLECLOCKS
Definition: commands.h:142
@ JTAG_RUNTEST
Definition: commands.h:138
@ JTAG_SLEEP
Definition: commands.h:141
@ JTAG_RESET
Definition: commands.h:139
@ JTAG_TMS
Definition: commands.h:143
void delay_us(uint16_t delay)
Definition: delay.c:23
uint64_t buffer
Pointer to data buffer to send over SPI.
Definition: dw-spi-helper.h:0
uint32_t size
Size of dw_spi_transaction::buffer.
Definition: dw-spi-helper.h:4
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
uint8_t type
Definition: esp_usb_jtag.c:0
void image_close(struct image *image)
Definition: image.c:1210
int image_read_section(struct image *image, int section, target_addr_t offset, uint32_t size, uint8_t *buffer, size_t *size_read)
Definition: image.c:1078
int image_open(struct image *image, const char *url, const char *type_string)
Definition: image.c:956
enum tap_state tap_get_end_state(void)
For more information,.
Definition: interface.c:56
enum tap_state tap_state_transition(enum tap_state cur_state, bool tms)
Function tap_state_transition takes a current TAP state and returns the next state according to the t...
Definition: interface.c:223
const char * tap_state_name(enum tap_state state)
Function tap_state_name Returns a string suitable for display representing the JTAG tap_state.
Definition: interface.c:344
int tap_get_tms_path_len(enum tap_state from, enum tap_state to)
Function int tap_get_tms_path_len returns the total number of bits that represents a TMS path transit...
Definition: interface.c:195
void tap_set_end_state(enum tap_state new_end_state)
This function sets the state of an "end state follower" which tracks the state that any cable driver ...
Definition: interface.c:48
enum tap_state tap_get_state(void)
This function gets the state of the "state follower" which tracks the state of the TAPs connected to ...
Definition: interface.c:37
bool tap_is_state_stable(enum tap_state astate)
Function tap_is_state_stable returns true if the astate is stable.
Definition: interface.c:200
int tap_get_tms_path(enum tap_state from, enum tap_state to)
This function provides a "bit sequence" indicating what has to be done with TMS during a sequence of ...
Definition: interface.c:190
#define DEBUG_CAP_TMS_SEQ
Definition: interface.h:188
#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...
Definition: interface.h:50
void jtag_sleep(uint32_t us)
Definition: jtag/core.c:1074
enum reset_types jtag_get_reset_config(void)
Definition: jtag/core.c:1746
#define ERROR_JTAG_DEVICE_ERROR
Definition: jtag.h:558
tap_state
Defines JTAG Test Access Port states.
Definition: jtag.h:37
@ TAP_RESET
Definition: jtag.h:56
@ TAP_IRSHIFT
Definition: jtag.h:51
@ TAP_IDLE
Definition: jtag.h:53
@ TAP_DRSHIFT
Definition: jtag.h:43
@ RESET_SRST_PULLS_TRST
Definition: jtag.h:220
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_bulk_read(struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout, int *transferred)
static void list_add_tail(struct list_head *new, struct list_head *head)
Definition: list.h:203
#define list_for_each_entry_safe(p, n, h, field)
Definition: list.h:159
static void list_del(struct list_head *entry)
Definition: list.h:88
static void INIT_LIST_HEAD(struct list_head *list)
Definition: list.h:54
#define LOG_DEBUG_IO(expr ...)
Definition: log.h:116
#define ERROR_FAIL
Definition: log.h:188
#define LOG_ERROR(expr ...)
Definition: log.h:147
#define LOG_INFO(expr ...)
Definition: log.h:141
#define LOG_DEBUG(expr ...)
Definition: log.h:124
#define ERROR_OK
Definition: log.h:182
uint8_t bits[QN908X_FLASH_MAX_BLOCKS *QN908X_FLASH_PAGES_PER_BLOCK/8]
Definition: qn908x.c:0
#define MIN(a, b)
Definition: replacements.h:22
target_addr_t addr
Start address to search for the control block.
Definition: rtt/rtt.c:28
Represents a driver for a debugging interface.
Definition: interface.h:208
const char *const name
The name of the interface driver.
Definition: interface.h:210
Angie device main context.
Definition: angie.c:123
size_t xfer_buffer_len
Definition: angie.c:126
struct libusb_device_handle * usbdev
Definition: angie.c:124
uint8_t reply_buffer[ANGIE_XFER_BUFFER_TOTAL_SIZE]
Definition: angie.c:127
size_t reply_buffer_len
Definition: angie.c:128
uint8_t xfer_buffer[ANGIE_XFER_BUFFER_TOTAL_SIZE]
Definition: angie.c:125
struct read_queue read_queue
Definition: angie.c:129
Definition: image.h:48
unsigned int num_sections
Definition: image.h:51
struct imagesection * sections
Definition: image.h:52
long long base_address
Definition: image.h:54
bool base_address_set
Definition: image.h:53
target_addr_t base_address
Definition: image.h:42
uint32_t size
Definition: image.h:43
Represents a driver for a debugging interface.
Definition: interface.h:183
unsigned int supported
Bit vector listing capabilities exposed by this driver.
Definition: interface.h:187
Definition: list.h:41
Definition: osbdm.c:25
Entry element used to forge a reply buffer for openocd JTAG core.
Definition: angie.c:113
const struct scan_command * cmd
Definition: angie.c:114
uint8_t * buffer
Definition: angie.c:116
int reply_buffer_offset
Definition: angie.c:115
struct list_head list
Definition: angie.c:117
List of elements used in a multiple commands reply.
Definition: angie.c:106
struct list_head list
Definition: angie.c:107
The scan_command provide a means of encapsulating a set of scan_field structures that should be scann...
Definition: commands.h:35
Encapsulates a series of bits to be clocked out, affecting state and mode of the interface.
Definition: commands.h:101
#define TRANSPORT_JTAG
Definition: transport.h:19
static void h_u32_to_be(uint8_t *buf, uint32_t val)
Definition: types.h:186
#define NULL
Definition: usb.h:16
uint8_t cmd
Definition: vdebug.c:1
uint8_t offset[4]
Definition: vdebug.c:9
uint8_t state[4]
Definition: vdebug.c:21
uint8_t count[4]
Definition: vdebug.c:22