33 #define AICE_FORMAT_HTDA (3)
34 #define AICE_FORMAT_HTDC (7)
35 #define AICE_FORMAT_HTDMA (4)
36 #define AICE_FORMAT_HTDMB (8)
37 #define AICE_FORMAT_HTDMC (8)
38 #define AICE_FORMAT_HTDMD (12)
39 #define AICE_FORMAT_DTHA (6)
40 #define AICE_FORMAT_DTHB (2)
41 #define AICE_FORMAT_DTHMA (8)
42 #define AICE_FORMAT_DTHMB (4)
45 #define AICE_CMD_SCAN_CHAIN 0x00
46 #define AICE_CMD_T_READ_MISC 0x20
47 #define AICE_CMD_T_READ_EDMSR 0x21
48 #define AICE_CMD_T_READ_DTR 0x22
49 #define AICE_CMD_T_READ_MEM_B 0x24
50 #define AICE_CMD_T_READ_MEM_H 0x25
51 #define AICE_CMD_T_READ_MEM 0x26
52 #define AICE_CMD_T_FASTREAD_MEM 0x27
53 #define AICE_CMD_T_WRITE_MISC 0x28
54 #define AICE_CMD_T_WRITE_EDMSR 0x29
55 #define AICE_CMD_T_WRITE_DTR 0x2A
56 #define AICE_CMD_T_WRITE_DIM 0x2B
57 #define AICE_CMD_T_WRITE_MEM_B 0x2C
58 #define AICE_CMD_T_WRITE_MEM_H 0x2D
59 #define AICE_CMD_T_WRITE_MEM 0x2E
60 #define AICE_CMD_T_FASTWRITE_MEM 0x2F
61 #define AICE_CMD_T_EXECUTE 0x3E
62 #define AICE_CMD_READ_CTRL 0x50
63 #define AICE_CMD_WRITE_CTRL 0x51
64 #define AICE_CMD_BATCH_BUFFER_READ 0x60
65 #define AICE_CMD_READ_DTR_TO_BUFFER 0x61
66 #define AICE_CMD_BATCH_BUFFER_WRITE 0x68
67 #define AICE_CMD_WRITE_DTR_FROM_BUFFER 0x69
99 uint8_t extra_word_length, uint32_t address)
108 uint8_t extra_word_length, uint32_t address)
121 uint8_t extra_word_length, uint32_t address, uint32_t word,
142 uint8_t extra_word_length, uint32_t address, uint32_t *word,
151 for (i = 0 ; i < num_of_words ; i++, word++) {
167 uint8_t extra_word_length, uint32_t address, uint32_t word,
192 uint8_t extra_word_length, uint32_t address,
const uint8_t *word,
206 uint32_t num_of_words = extra_word_length + 1;
208 for (i = 0 ; i < num_of_words ; i++, word += 4) {
243 uint8_t *extra_word_length, uint32_t *word, uint8_t num_of_words,
250 for (i = 0 ; i < num_of_words ; i++, word++) {
272 uint8_t *extra_word_length, uint32_t *word,
292 uint8_t *target_id, uint8_t *extra_word_length, uint8_t *word,
312 for (i = 0; i < *extra_word_length; i++) {
329 uint8_t *extra_word_length)
342 int (*f)(
struct libusb_device_handle *,
int,
char *,
int,
int,
int *),
343 struct libusb_device_handle *dev,
int ep,
344 char *bytes,
int size,
int timeout,
int *transferred)
346 int tries = 3,
count = 0;
358 *transferred =
count;
363 char *buff,
int size,
int timeout,
int *transferred)
397 LOG_ERROR(
"aice_write illegal out_length=%i (max=%i)",
405 LOG_DEBUG_IO(
"aice_usb_write, out_length = %i, result = %i",
429 uint32_t num_of_words);
437 LOG_DEBUG(
"Flush usb packets (AICE_COMMAND_MODE_PACK)");
451 LOG_DEBUG(
"Flush usb packets (AICE_COMMAND_MODE_BATCH)");
473 uint32_t batch_status;
481 if (batch_status & 0x1)
483 else if (batch_status & 0xE)
516 LOG_DEBUG(
"Append usb packets 0x%02x", out_buffer[0]);
563 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
568 uint8_t cmd_ack_code;
575 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
588 LOG_DEBUG(
"SCAN_CHAIN response, # of IDs: %" PRIu8, *num_of_ids);
590 if (*num_of_ids == 0xFF) {
594 LOG_INFO(
"The ice chain over 16 targets");
614 LOG_DEBUG(
"READ_CTRL, address: 0x%" PRIx32, address);
618 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
623 uint8_t cmd_ack_code;
624 uint8_t extra_length;
627 LOG_DEBUG(
"READ_CTRL response, data: 0x%" PRIx32, *data);
630 LOG_ERROR(
"aice command error (command=0x%x, response=0x%" PRIx8
")",
652 LOG_DEBUG(
"WRITE_CTRL, address: 0x%" PRIx32
", data: 0x%" PRIx32, address, data);
656 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
661 uint8_t cmd_ack_code;
662 uint8_t extra_length;
668 LOG_ERROR(
"aice command error (command=0x%x, response=0x%" PRIx8
")",
689 LOG_DEBUG(
"READ_DTR, COREID: %" PRIu8, target_id);
693 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
698 uint8_t cmd_ack_code;
699 uint8_t extra_length;
700 uint8_t res_target_id;
705 LOG_DEBUG(
"READ_DTR response, data: 0x%" PRIx32, *data);
710 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
743 LOG_DEBUG(
"READ_DTR_TO_BUFFER, COREID: %" PRIu8, target_id);
751 uint8_t cmd_ack_code;
752 uint8_t extra_length;
753 uint8_t res_target_id;
760 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
794 LOG_DEBUG(
"WRITE_DTR, COREID: %" PRIu8
", data: 0x%" PRIx32, target_id, data);
802 uint8_t cmd_ack_code;
803 uint8_t extra_length;
804 uint8_t res_target_id;
812 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
846 LOG_DEBUG(
"WRITE_DTR_FROM_BUFFER, COREID: %" PRIu8
"", target_id);
854 uint8_t cmd_ack_code;
855 uint8_t extra_length;
856 uint8_t res_target_id;
863 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
893 LOG_DEBUG(
"READ_MISC, COREID: %" PRIu8
", address: 0x%" PRIx32, target_id, address);
897 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
902 uint8_t cmd_ack_code;
903 uint8_t extra_length;
904 uint8_t res_target_id;
909 LOG_DEBUG(
"READ_MISC response, data: 0x%" PRIx32, *data);
913 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
948 LOG_DEBUG(
"WRITE_MISC, COREID: %" PRIu8
", address: 0x%" PRIx32
", data: 0x%" PRIx32,
949 target_id, address, data);
953 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
958 uint8_t cmd_ack_code;
959 uint8_t extra_length;
960 uint8_t res_target_id;
968 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
998 LOG_DEBUG(
"READ_EDMSR, COREID: %" PRIu8
", address: 0x%" PRIx32, target_id, address);
1002 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1007 uint8_t cmd_ack_code;
1008 uint8_t extra_length;
1009 uint8_t res_target_id;
1014 LOG_DEBUG(
"READ_EDMSR response, data: 0x%" PRIx32, *data);
1018 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1054 LOG_DEBUG(
"WRITE_EDMSR, COREID: %" PRIu8
", address: 0x%" PRIx32
", data: 0x%" PRIx32,
1055 target_id, address, data);
1059 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1064 uint8_t cmd_ack_code;
1065 uint8_t extra_length;
1066 uint8_t res_target_id;
1074 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1095 for (uint8_t i = 0 ; i < num_of_words ; i++) {
1096 tmp = ((word[i] >> 24) & 0x000000FF) |
1097 ((word[i] >> 8) & 0x0000FF00) |
1098 ((word[i] << 8) & 0x00FF0000) |
1099 ((word[i] << 24) & 0xFF000000);
1108 uint32_t big_endian_word[4];
1112 memcpy(big_endian_word, word,
sizeof(big_endian_word));
1119 num_of_words - 1, 0, big_endian_word, num_of_words,
1133 ", data: 0x%08" PRIx32
", 0x%08" PRIx32
", 0x%08" PRIx32
", 0x%08" PRIx32,
1138 big_endian_word[3]);
1146 uint8_t cmd_ack_code;
1147 uint8_t extra_length;
1148 uint8_t res_target_id;
1157 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1192 LOG_DEBUG(
"EXECUTE, COREID: %" PRIu8
"", target_id);
1196 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1201 uint8_t cmd_ack_code;
1202 uint8_t extra_length;
1203 uint8_t res_target_id;
1211 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1232 LOG_DEBUG(
"WRITE_MEM_B, COREID: %" PRIu8
", ADDRESS %08" PRIx32
" VALUE %08" PRIx32,
1255 uint8_t cmd_ack_code;
1256 uint8_t extra_length;
1257 uint8_t res_target_id;
1264 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1286 LOG_DEBUG(
"WRITE_MEM_H, COREID: %" PRIu8
", ADDRESS %08" PRIx32
" VALUE %08" PRIx32,
1294 (address >> 1) & 0x7FFFFFFF, data & 0x0000FFFF,
data_endian);
1300 (address >> 1) & 0x7FFFFFFF, data & 0x0000FFFF,
data_endian);
1305 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1310 uint8_t cmd_ack_code;
1311 uint8_t extra_length;
1312 uint8_t res_target_id;
1319 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1341 LOG_DEBUG(
"WRITE_MEM, COREID: %" PRIu8
", ADDRESS %08" PRIx32
" VALUE %08" PRIx32,
1360 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1365 uint8_t cmd_ack_code;
1366 uint8_t extra_length;
1367 uint8_t res_target_id;
1374 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1405 LOG_DEBUG(
"FASTREAD_MEM, COREID: %" PRIu8
", # of DATA %08" PRIx32,
1406 target_id, num_of_words);
1410 LOG_ERROR(
"aice_usb_read failed (requested=%" PRIu32
", result=%d)",
1415 uint8_t cmd_ack_code;
1416 uint8_t extra_length;
1417 uint8_t res_target_id;
1425 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1462 LOG_DEBUG(
"FASTWRITE_MEM, COREID: %" PRIu8
", # of DATA %08" PRIx32,
1463 target_id, num_of_words);
1467 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1472 uint8_t cmd_ack_code;
1473 uint8_t extra_length;
1474 uint8_t res_target_id;
1481 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1511 LOG_DEBUG(
"READ_MEM_B, COREID: %" PRIu8
"", target_id);
1515 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1520 uint8_t cmd_ack_code;
1521 uint8_t extra_length;
1522 uint8_t res_target_id;
1527 LOG_DEBUG(
"READ_MEM_B response, data: 0x%02" PRIx32, *data);
1531 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1561 LOG_DEBUG(
"READ_MEM_H, CORE_ID: %" PRIu8
"", target_id);
1565 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1570 uint8_t cmd_ack_code;
1571 uint8_t extra_length;
1572 uint8_t res_target_id;
1577 LOG_DEBUG(
"READ_MEM_H response, data: 0x%" PRIx32, *data);
1581 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1608 (address >> 2) & 0x3FFFFFFF);
1612 LOG_DEBUG(
"READ_MEM, COREID: %" PRIu8
"", target_id);
1616 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1621 uint8_t cmd_ack_code;
1622 uint8_t extra_length;
1623 uint8_t res_target_id;
1628 LOG_DEBUG(
"READ_MEM response, data: 0x%" PRIx32, *data);
1632 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1658 LOG_DEBUG(
"BATCH_BUFFER_READ, # of DATA %08" PRIx32, num_of_words);
1662 LOG_ERROR(
"aice_usb_read failed (requested=%" PRIu32
", result=%d)",
1667 uint8_t cmd_ack_code;
1668 uint8_t extra_length;
1669 uint8_t res_target_id;
1677 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1698 if (num_of_words == 0)
1711 LOG_DEBUG(
"BATCH_BUFFER_WRITE, # of DATA %08" PRIx32, num_of_words);
1715 LOG_ERROR(
"aice_usb_read failed (requested=%d, result=%d)",
1720 uint8_t cmd_ack_code;
1721 uint8_t extra_length;
1722 uint8_t res_target_id;
1729 LOG_ERROR(
"aice command timeout (command=0x%x, response=0x%" PRIx8
")",
1760 static int aice_read_reg(uint32_t coreid, uint32_t num, uint32_t *val);
1761 static int aice_write_reg(uint32_t coreid, uint32_t num, uint32_t val);
1765 uint32_t ir4_value = 0;
1766 uint32_t ir6_value = 0;
1768 static bool handling_suppressed_exception;
1770 if (handling_suppressed_exception)
1774 LOG_ERROR(
"<-- TARGET WARNING! Exception is detected and suppressed. -->");
1775 handling_suppressed_exception =
true;
1789 LOG_INFO(
"EVA: 0x%08" PRIx32, ir4_value);
1790 LOG_INFO(
"ITYPE: 0x%08" PRIx32, ir6_value);
1792 ir6_value = ir6_value & (~0x300);
1793 ir6_value = ir6_value & (~0x3000);
1796 handling_suppressed_exception =
false;
1805 LOG_ERROR(
"<-- TARGET ERROR! Insufficient security privilege "
1806 "to execute the debug operations. -->");
1820 uint32_t value_dbger = 0;
1825 if ((value_dbger & expect_status) == expect_status) {
1841 LOG_ERROR(
"Timeout (1000ms) waiting for $DBGER status "
1842 "being 0x%08" PRIx32, expect_status);
1868 LOG_ERROR(
"<-- TARGET ERROR! Debug operations do not finish properly: "
1869 "0x%08" PRIx32
"0x%08" PRIx32
"0x%08" PRIx32
"0x%08" PRIx32
". -->",
1882 LOG_DEBUG(
"aice_read_reg, reg_no: 0x%08" PRIx32, num);
1914 }
else if (num ==
FPCFG) {
1920 if (num >=
FS0 && num <=
FS31) {
1925 }
else if (num >=
FD0 && num <=
FD31) {
1941 uint32_t value_edmsw = 0;
1946 LOG_ERROR(
"<-- TARGET ERROR! The debug target failed to update "
1947 "the DTR register. -->");
1960 }
else if (num ==
R1) {
1962 }
else if (num ==
DR41) {
1969 }
else if (num ==
DR42) {
1983 LOG_DEBUG(
"aice_write_reg, reg_no: 0x%08" PRIx32
", value: 0x%08" PRIx32, num, val);
1986 uint32_t value_edmsw = 0;
1991 LOG_ERROR(
"<-- TARGET ERROR! AICE failed to write to the DTR register. -->");
2023 }
else if (num ==
FPCFG) {
2026 if (num >=
FS0 && num <=
FS31) {
2031 }
else if (num >=
FD0 && num <=
FD31) {
2056 else if (num ==
DR42)
2073 const uint16_t vids[] = {
param->
vid, 0 };
2074 const uint16_t pids[] = {
param->
pid, 0 };
2075 struct libusb_device_handle *
devh;
2093 libusb_reset_device(
devh);
2114 libusb_set_configuration(
devh, 0);
2115 libusb_claim_interface(
devh, 0);
2117 unsigned int aice_read_ep;
2118 unsigned int aice_write_ep;
2121 LOG_DEBUG(
"aice_read_ep=0x%x, aice_write_ep=0x%x", aice_read_ep, aice_write_ep);
2135 uint32_t high_value;
2142 LOG_DEBUG(
"low: 0x%08" PRIx32
", high: 0x%08" PRIx32
"\n", value, high_value);
2145 *val = (((uint64_t)high_value) << 32) | value;
2147 *val = (((uint64_t)value) << 32) | high_value;
2155 uint32_t high_value;
2158 value = val & 0xFFFFFFFF;
2159 high_value = (val >> 32) & 0xFFFFFFFF;
2161 high_value = val & 0xFFFFFFFF;
2162 value = (val >> 32) & 0xFFFFFFFF;
2165 LOG_DEBUG(
"aice_usb_write_reg_64, %s, low: 0x%08" PRIx32
", high: 0x%08" PRIx32
"\n",
2174 uint32_t hardware_version;
2175 uint32_t firmware_version;
2176 uint32_t fpga_version;
2187 LOG_INFO(
"AICE version: hw_ver = 0x%" PRIx32
", fw_ver = 0x%" PRIx32
", fpga_ver = 0x%" PRIx32,
2188 hardware_version, firmware_version, fpga_version);
2193 #define LINE_BUFFER_SIZE 1024
2202 uint32_t write_ctrl_value;
2205 script_fd = fopen(script,
"r");
2212 op_str = strstr(line_buffer,
"set");
2215 goto get_reset_type;
2218 op_str = strstr(line_buffer,
"clear");
2222 reset_str = strstr(op_str,
"srst");
2230 reset_str = strstr(op_str,
"dbgi");
2238 reset_str = strstr(op_str,
"trst");
2249 delay = strtoul(reset_str + 4,
NULL, 0);
2250 write_ctrl_value |= (delay << 16);
2272 uint32_t scan_clock;
2278 uint32_t scan_base_freq;
2279 if (scan_clock & 0x8)
2280 scan_base_freq = 48000;
2282 scan_base_freq = 30000;
2284 uint32_t set_base_freq;
2285 if (set_clock & 0x8)
2286 set_base_freq = 48000;
2288 set_base_freq = 30000;
2292 set_freq = set_base_freq >> (set_clock & 0x7);
2293 scan_freq = scan_base_freq >> (scan_clock & 0x7);
2295 if (scan_freq < set_freq) {
2296 LOG_ERROR(
"User specifies higher jtag clock than TCK_SCAN clock");
2304 uint32_t check_speed;
2308 if (((
int)check_speed & 0x0F) != set_clock) {
2322 uint32_t edm_ctl_value;
2331 uint32_t value_edmcfg;
2340 if ((
core_info[coreid].edm_version & 0x1000) == 0)
2350 if (clear_dex_use_psw)
2355 host_edm_ctl &= ~(0x40000000);
2357 LOG_DEBUG(
"aice_init_edm_registers - EDM_CTL: 0x%08" PRIx32, host_edm_ctl);
2387 if (
core_info[coreid].edm_ctl_backup & 0x40000000)
2392 LOG_DEBUG(
"aice_backup_edm_registers - EDM_CTL: 0x%08" PRIx32
", DEX_USE_PSW: %s",
2394 core_info[coreid].dex_use_psw_on ?
"on" :
"off");
2401 LOG_DEBUG(
"aice_restore_edm_registers -");
2405 core_info[coreid].edm_ctl_backup | 0x80000000);
2415 uint32_t value_edmsw = 0;
2418 if (value_edmsw & 0x1) {
2432 if (value_edmsw & 0x2) {
2451 LOG_DEBUG(
"r0: 0x%08" PRIx32
", r1: 0x%08" PRIx32,
2459 LOG_DEBUG(
"restore_tmp_registers - r0: 0x%08" PRIx32
", r1: 0x%08" PRIx32,
2462 if (
core_info[coreid].target_dtr_valid) {
2502 LOG_INFO(
"AICE initialization started");
2518 LOG_ERROR(
"Cannot set AICE JTAG clock!");
2550 for (
int i = 0; i < *num_of_idcode; i++) {
2563 LOG_DEBUG(
"aice_usb_halt check halted");
2576 uint32_t edm_ctl_value = 0;
2578 if (edm_ctl_value & 0x3)
2582 uint32_t acc_ctl_value = 0;
2588 LOG_ERROR(
"<-- TARGET ERROR! Reaching the max interrupt stack level. -->");
2594 acc_ctl_value |= 0x8;
2612 LOG_ERROR(
"<-- TARGET ERROR! Unable to stop the debug target through DBGI. -->");
2616 if (
core_info[coreid].debug_under_dex_on) {
2617 if (
core_info[coreid].dex_use_psw_on ==
false) {
2623 uint32_t ir0_value = 0;
2624 uint32_t debug_mode_ir0_value;
2626 debug_mode_ir0_value = ir0_value | 0x408;
2627 debug_mode_ir0_value &= ~(0x000000C1);
2633 if (edm_ctl_value & 0x3)
2645 uint32_t dbger_value;
2652 LOG_ERROR(
"<-- AICE ERROR! AICE is unplugged. -->");
2656 if ((ice_state & 0x20) == 0) {
2657 LOG_ERROR(
"<-- TARGET ERROR! Target is disconnected with AICE. -->");
2663 LOG_ERROR(
"<-- AICE ERROR! AICE is unplugged. -->");
2668 LOG_ERROR(
"<-- TARGET ERROR! Insufficient security privilege. -->");
2680 uint32_t ir11_value;
2683 LOG_ERROR(
"<-- TARGET ERROR! Reaching the max interrupt stack level; "
2684 "CPU is stalled at 0x%08" PRIx32
" for debugging. -->", ir11_value);
2757 uint32_t dbger_value;
2784 uint32_t pin_status;
2786 if (pin_status & 0x4)
2841 uint32_t write_ctrl_value = 0;
2845 write_ctrl_value |= (0x200 << 16);
2855 write_ctrl_value |= (0x200 << 16);
2901 uint32_t dbger_value;
2907 LOG_WARNING(
"<-- TARGET WARNING! The debug target exited "
2908 "the debug mode unexpectedly. -->");
2947 uint32_t ir0_reg_num;
2957 if ((ir0_value & 0x800) == 0) {
2959 ir0_value |= (0x01 << 11);
2982 LOG_WARNING(
"Timeout (1000ms) waiting for halt to complete");
2991 ir0_value &= ~(0x01 << 11);
3025 *data = value & 0xFF;
3043 *data = value & 0xFFFF;
3068 ORI(
R0,
R0, address & 0x00000FFF),
3079 LOG_DEBUG(
"aice_usb_read_memory_unit, addr: 0x%08" PRIx32
3080 ", size: %" PRIu32
", count: %" PRIu32
"",
3097 for (i = 0; i <
count; i++) {
3098 read_mem_func(coreid,
addr, &value);
3099 *
buffer++ = (uint8_t)value;
3109 for (i = 0; i <
count; i++) {
3110 read_mem_func(coreid,
addr, &value);
3111 uint16_t svalue = value;
3112 memcpy(
buffer, &svalue,
sizeof(uint16_t));
3123 for (i = 0; i <
count; i++) {
3124 read_mem_func(coreid,
addr, &value);
3125 memcpy(
buffer, &value,
sizeof(uint32_t));
3198 LOG_DEBUG(
"aice_usb_write_memory_unit, addr: 0x%08" PRIx32
3199 ", size: %" PRIu32
", count: %" PRIu32
"",
3215 for (i = 0; i <
count; i++) {
3227 for (i = 0; i <
count; i++) {
3229 memcpy(&value,
buffer,
sizeof(uint16_t));
3231 write_mem_func(coreid,
addr, value);
3242 for (i = 0; i <
count; i++) {
3244 memcpy(&value,
buffer,
sizeof(uint32_t));
3246 write_mem_func(coreid,
addr, value);
3259 uint32_t packet_size;
3262 packet_size = (
count >= 0x100) ? 0x100 :
count;
3273 buffer += (packet_size * 4);
3274 addr += (packet_size * 4);
3275 count -= packet_size;
3284 uint32_t packet_size;
3287 packet_size = (
count >= 0x100) ? 0x100 :
count;
3298 buffer += (packet_size * 4);
3299 addr += (packet_size * 4);
3300 count -= packet_size;
3309 LOG_DEBUG(
"aice_usb_bulk_read_mem, addr: 0x%08" PRIx32
", length: 0x%08" PRIx32,
addr,
length);
3327 LOG_DEBUG(
"aice_usb_bulk_write_mem, addr: 0x%08" PRIx32
", length: 0x%08" PRIx32,
addr,
length);
3348 if (
core_info[coreid].target_dtr_valid) {
3377 LOG_DEBUG(
"aice_usb_memory_access, access channel: %u", channel);
3386 if (
core_info[coreid].memory_select == mem_select)
3389 LOG_DEBUG(
"aice_usb_memory_mode, memory select: %u", mem_select);
3409 uint32_t probe_result;
3412 uint32_t access_page_size;
3413 uint32_t virtual_offset;
3414 uint32_t physical_page_number;
3427 if (probe_result & 0x80000000)
3444 access_page_size = value_mr4 & 0xF;
3445 if (access_page_size == 0) {
3446 virtual_offset = virtual_address & 0x00000FFF;
3447 physical_page_number = value_mr3 & 0xFFFFF000;
3448 }
else if (access_page_size == 1) {
3449 virtual_offset = virtual_address & 0x00001FFF;
3450 physical_page_number = value_mr3 & 0xFFFFE000;
3451 }
else if (access_page_size == 5) {
3452 virtual_offset = virtual_address & 0x000FFFFF;
3453 physical_page_number = value_mr3 & 0xFFF00000;
3458 *physical_address = physical_page_number | virtual_offset;
3475 icache->
set = value_cr1 & 0x7;
3477 icache->
set = 64 << icache->
set;
3478 icache->
way = ((value_cr1 >> 3) & 0x7) + 1;
3479 icache->
line_size = (value_cr1 >> 6) & 0x7;
3487 LOG_DEBUG(
"\ticache set: %" PRIu32
", way: %" PRIu32
", line size: %" PRIu32
", "
3488 "log2(set): %" PRIu32
", log2(line_size): %" PRIu32
"",
3494 dcache->
set = value_cr2 & 0x7;
3496 dcache->
set = 64 << dcache->
set;
3497 dcache->
way = ((value_cr2 >> 3) & 0x7) + 1;
3498 dcache->
line_size = (value_cr2 >> 6) & 0x7;
3506 LOG_DEBUG(
"\tdcache set: %" PRIu32
", way: %" PRIu32
", line size: %" PRIu32
", "
3507 "log2(set): %" PRIu32
", log2(line_size): %" PRIu32
"",
3522 uint32_t cache_index;
3532 for (set_index = 0; set_index < dcache->
set; set_index++) {
3533 for (way_index = 0; way_index < dcache->
way; way_index++) {
3570 uint32_t cache_index;
3580 for (set_index = 0; set_index < dcache->
set; set_index++) {
3581 for (way_index = 0; way_index < dcache->
way; way_index++) {
3618 uint32_t cache_index;
3628 for (set_index = 0; set_index < icache->
set; set_index++) {
3629 for (way_index = 0; way_index < icache->
way; way_index++) {
3666 if (
core_info[coreid].cache_init ==
false)
3707 uint32_t data_value;
3711 command_str = strtok(command_sequence,
";");
3718 while (command_str[i] ==
' ' ||
3719 command_str[i] ==
'\n' ||
3720 command_str[i] ==
'\r' ||
3721 command_str[i] ==
'\t')
3725 command_str = command_str + i;
3727 if (strncmp(command_str,
"write_misc", 10) == 0) {
3728 reg_name_0 = strstr(command_str,
"gen_port0");
3729 reg_name_1 = strstr(command_str,
"gen_port1");
3732 data_value = strtoul(reg_name_0 + 9,
NULL, 0);
3738 }
else if (reg_name_1) {
3739 data_value = strtoul(reg_name_1 + 9,
NULL, 0);
3745 LOG_ERROR(
"program EDM, unsupported misc register: %s", command_str);
3748 LOG_ERROR(
"program EDM, unsupported command: %s", command_str);
3752 command_str = strtok(
NULL,
";");
3754 }
while (command_str);
3778 uint32_t instruction_num)
3781 uint8_t current_instruction_num;
3785 if (instruction_num == 4)
3788 for (i = 0 ; i < instruction_num ; i += 3) {
3789 if (instruction_num - i < 3) {
3790 current_instruction_num = instruction_num - i;
3791 for (j = current_instruction_num ; j < 3 ; j++)
3792 dim_instructions[j] =
NOP;
3794 current_instruction_num = 3;
3798 current_instruction_num *
sizeof(uint32_t));
3818 LOG_ERROR(
"<-- TARGET ERROR! Debug operations do not finish properly:"
3819 "0x%08" PRIx32
" 0x%08" PRIx32
" 0x%08" PRIx32
" 0x%08" PRIx32
". -->",
3820 dim_instructions[0],
3821 dim_instructions[1],
3822 dim_instructions[2],
3823 dim_instructions[3]);
3869 uint32_t dim_instructions[4];
3879 dim_instructions[1] =
DSB;
3880 dim_instructions[2] =
NOP;
3889 dim_instructions[0] =
MTSR_DTR(reg_no);
3890 dim_instructions[1] =
DSB;
3891 dim_instructions[2] =
NOP;
3897 dim_instructions[2] =
DSB;
3902 dim_instructions[2] =
DSB;
3912 dim_instructions[1] =
DSB;
3913 dim_instructions[2] =
NOP;
3914 dim_instructions[3] =
IRET;
3933 uint32_t reg_no, uint32_t *samples, uint32_t *num_samples)
3935 uint32_t iteration_count;
3936 uint32_t this_iteration;
3938 const uint32_t MAX_ITERATION = 250;
3953 iteration_count = 0;
3954 while (iteration_count < iteration) {
3955 if (iteration - iteration_count < MAX_ITERATION)
3956 this_iteration = iteration - iteration_count;
3958 this_iteration = MAX_ITERATION;
3961 uint32_t val_iteration;
3962 val_iteration = interval << 16 | this_iteration;
3991 uint32_t batch_status = 0;
3997 if (batch_status & 0x1) {
3999 }
else if (batch_status & 0xE) {
4015 samples + iteration_count, this_iteration) !=
ERROR_OK) {
4020 iteration_count += this_iteration;
4024 *num_samples = iteration_count;
static struct aice_port_param_s param
static uint32_t retry_times
@ AICE_COMMAND_MODE_BATCH
@ AICE_COMMAND_MODE_NORMAL
#define ERROR_AICE_DISCONNECT
@ AICE_CACHE_CTL_L1D_VA_INVAL
@ AICE_CACHE_CTL_L1D_WBALL
@ AICE_CACHE_CTL_L1D_VA_WB
@ AICE_CACHE_CTL_L1I_VA_INVAL
@ AICE_CACHE_CTL_L1D_INVALALL
@ AICE_CACHE_CTL_L1I_INVALALL
#define ERROR_AICE_TIMEOUT
#define AICE_MAX_NUM_CORE
static int aice_usb_cache_ctl(uint32_t coreid, uint32_t subtype, uint32_t address)
int aice_write_ctrl(uint32_t address, uint32_t data)
#define AICE_CMD_T_READ_EDMSR
int(* write_mem_func_t)(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_write_mem_b(uint8_t target_id, uint32_t address, uint32_t data)
static int aice_fastread_mem(uint8_t target_id, uint8_t *word, uint32_t num_of_words)
#define AICE_CMD_T_WRITE_DTR
static uint8_t usb_in_buffer[AICE_IN_BUFFER_SIZE]
static int aice_usb_read(uint8_t *in_buffer, int expected_size)
int aice_read_ctrl(uint32_t address, uint32_t *data)
static int aice_usb_set_jtag_clock(uint32_t a_clock)
static void aice_unpack_dthmb(uint8_t *cmd_ack_code, uint8_t *target_id, uint8_t *extra_word_length)
static int aice_usb_write_mem_w_dim(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_usb_write_mem_h_bus(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_usb_set_count_to_check_dbger(uint32_t count_to_check)
static void aice_pack_htdmb(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address)
static enum aice_target_endian data_endian
static void aice_unpack_dthb(uint8_t *cmd_ack_code, uint8_t *extra_word_length)
static void aice_pack_htdc(uint8_t cmd_code, uint8_t extra_word_length, uint32_t address, uint32_t word, enum aice_target_endian access_endian)
static int aice_usb_idcode(uint32_t *idcode, uint8_t *num_of_idcode)
#define AICE_FORMAT_DTHMA
#define AICE_CMD_WRITE_DTR_FROM_BUFFER
static int aice_max_retry_times
#define AICE_CMD_T_READ_MEM
static uint32_t usb_in_packets_buffer_length
#define AICE_CMD_T_WRITE_MEM
static uint32_t aice_count_to_check_dbger
static int aice_usb_close(void)
static int aice_read_misc(uint8_t target_id, uint32_t address, uint32_t *data)
static int aice_usb_dcache_va_inval(uint32_t coreid, uint32_t address)
static int aice_issue_srst(uint32_t coreid)
static int aice_usb_open(struct aice_port_param_s *param)
static int aice_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
static int aice_usb_set_data_endian(uint32_t coreid, enum aice_target_endian target_data_endian)
static int aice_issue_reset_hold(uint32_t coreid)
static int aice_usb_halt(uint32_t coreid)
static void aice_unpack_dtha(uint8_t *cmd_ack_code, uint8_t *extra_word_length, uint32_t *word, enum aice_target_endian access_endian)
#define AICE_CMD_T_WRITE_MEM_B
static int aice_usb_read_mem_b_dim(uint32_t coreid, uint32_t address, uint32_t *data)
static int aice_write_edmsr(uint8_t target_id, uint32_t address, uint32_t data)
static int aice_usb_write_mem_b_bus(uint32_t coreid, uint32_t address, uint32_t data)
static int usb_bulk_with_retries(int(*f)(struct libusb_device_handle *, int, char *, int, int, int *), struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout, int *transferred)
#define AICE_CMD_T_EXECUTE
static int aice_usb_profiling(uint32_t coreid, uint32_t interval, uint32_t iteration, uint32_t reg_no, uint32_t *samples, uint32_t *num_samples)
static int wrap_usb_bulk_write(struct libusb_device_handle *dev, int ep, char *buff, int size, int timeout, int *transferred)
static int aice_read_mem(uint8_t target_id, uint32_t address, uint32_t *data)
static int aice_usb_read_tlb(uint32_t coreid, target_addr_t virtual_address, target_addr_t *physical_address)
static int check_privilege(uint32_t coreid, uint32_t dbger_value)
static void aice_unpack_dtha_multiple_data(uint8_t *cmd_ack_code, uint8_t *extra_word_length, uint32_t *word, uint8_t num_of_words, enum aice_target_endian access_endian)
static bool is_v2_edm(uint32_t coreid)
#define AICE_CMD_T_READ_MEM_H
static int aice_usb_write_debug_reg(uint32_t coreid, uint32_t addr, const uint32_t val)
static int aice_usb_set_custom_srst_script(const char *script)
static int usb_bulk_write_ex(struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout)
static int aice_usb_read_mem_w_bus(uint32_t coreid, uint32_t address, uint32_t *data)
static int aice_backup_edm_registers(uint32_t coreid)
EDM_CTL will be modified by OpenOCD as debugging.
static int aice_backup_tmp_registers(uint32_t coreid)
static int aice_usb_dcache_va_wb(uint32_t coreid, uint32_t address)
struct aice_port_api_s aice_usb_api
#define AICE_CMD_BATCH_BUFFER_WRITE
static int aice_usb_packet_flush(void)
static int aice_usb_set_custom_restart_script(const char *script)
static int aice_usb_read_mem_w_dim(uint32_t coreid, uint32_t address, uint32_t *data)
static int aice_usb_bulk_read_mem(uint32_t coreid, uint32_t addr, uint32_t length, uint8_t *buffer)
static int aice_write_mem_h(uint8_t target_id, uint32_t address, uint32_t data)
static int aice_usb_set_command_mode(enum aice_command_mode command_mode)
static int aice_bulk_write_mem(uint32_t coreid, uint32_t addr, uint32_t count, const uint8_t *buffer)
static int aice_usb_packet_append(uint8_t *out_buffer, int out_length, int in_length)
static uint32_t usb_out_packets_buffer_length
static void aice_pack_htdma(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address)
static void aice_pack_htdmc_multiple_data(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address, uint32_t *word, uint8_t num_of_words, enum aice_target_endian access_endian)
static int aice_usb_read_mem_h_bus(uint32_t coreid, uint32_t address, uint32_t *data)
static int aice_usb_write_mem_b_dim(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_usb_write_reg_64(uint32_t coreid, uint32_t num, uint64_t val)
static int aice_edm_init(uint32_t coreid)
static int aice_read_mem_b(uint8_t target_id, uint32_t address, uint32_t *data)
static int aice_usb_set_retry_times(uint32_t a_retry_times)
#define AICE_CMD_READ_DTR_TO_BUFFER
static int aice_switch_to_big_endian(uint32_t *word, uint8_t num_of_words)
static int aice_execute_custom_script(const char *script)
static int aice_fastwrite_mem(uint8_t target_id, const uint8_t *word, uint32_t num_of_words)
static void aice_pack_htdmc(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address, uint32_t word, enum aice_target_endian access_endian)
static int aice_usb_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
static int aice_usb_set_custom_trst_script(const char *script)
static int aice_usb_write(uint8_t *out_buffer, int out_length)
static int aice_restore_edm_registers(uint32_t coreid)
static int aice_usb_dcache_wb_all(uint32_t coreid)
static int aice_usb_read_debug_reg(uint32_t coreid, uint32_t addr, uint32_t *val)
#define AICE_CMD_T_READ_MEM_B
static int aice_usb_run(uint32_t coreid)
static int aice_read_mem_h(uint8_t target_id, uint32_t address, uint32_t *data)
static int aice_usb_icache_inval_all(uint32_t coreid)
static int aice_open_device(struct aice_port_param_s *param)
#define AICE_CMD_T_WRITE_MISC
static void aice_pack_htdmd_multiple_data(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address, const uint8_t *word, enum aice_target_endian access_endian)
static int aice_usb_reset(void)
static int aice_usb_execute(uint32_t coreid, uint32_t *instructions, uint32_t instruction_num)
static int aice_usb_read_mem_h_dim(uint32_t coreid, uint32_t address, uint32_t *data)
#define AICE_CMD_WRITE_CTRL
static int aice_batch_buffer_write(uint8_t buf_index, const uint8_t *word, uint32_t num_of_words)
static uint8_t total_num_of_core
static int aice_usb_step(uint32_t coreid)
static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
static int aice_write_dtr_from_buffer(uint8_t target_id, uint32_t buffer_idx)
#define AICE_FORMAT_HTDMB
static int aice_batch_buffer_read(uint8_t buf_index, uint32_t *word, uint32_t num_of_words)
static char * custom_restart_script
static struct aice_usb_handler_s aice_handler
#define AICE_FORMAT_DTHMB
#define AICE_CMD_SCAN_CHAIN
static int aice_restore_tmp_registers(uint32_t coreid)
static uint32_t jtag_clock
static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_words)
static uint8_t usb_in_packets_buffer[AICE_IN_PACKETS_BUFFER_SIZE]
static int aice_usb_assert_srst(uint32_t coreid, enum aice_srst_type_s srst)
static int fill_profiling_batch_commands(uint32_t coreid, uint32_t reg_no)
static int aice_execute_dim(uint32_t coreid, uint32_t *insts, uint8_t n_inst)
static int aice_usb_state(uint32_t coreid, enum aice_target_state_s *state)
static char * custom_srst_script
int(* read_mem_func_t)(uint32_t coreid, uint32_t address, uint32_t *data)
static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer)
static int aice_write_mem(uint8_t target_id, uint32_t address, uint32_t data)
static int aice_usb_memory_mode(uint32_t coreid, enum nds_memory_select mem_select)
static int check_suppressed_exception(uint32_t coreid, uint32_t dbger_value)
static int aice_usb_read_mem_b_bus(uint32_t coreid, uint32_t address, uint32_t *data)
#define AICE_FORMAT_HTDMC
static int aice_write_misc(uint8_t target_id, uint32_t address, uint32_t data)
#define AICE_CMD_BATCH_BUFFER_READ
static void aice_pack_htda(uint8_t cmd_code, uint8_t extra_word_length, uint32_t address)
static void aice_unpack_dthma(uint8_t *cmd_ack_code, uint8_t *target_id, uint8_t *extra_word_length, uint32_t *word, enum aice_target_endian access_endian)
static enum aice_command_mode aice_command_mode
static void aice_unpack_dthma_multiple_data(uint8_t *cmd_ack_code, uint8_t *target_id, uint8_t *extra_word_length, uint8_t *word, enum aice_target_endian access_endian)
static int aice_check_dbger(uint32_t coreid, uint32_t expect_status)
#define AICE_CMD_T_WRITE_MEM_H
static int aice_write_dtr(uint8_t target_id, uint32_t data)
static int aice_usb_init_cache(uint32_t coreid)
#define AICE_CMD_T_WRITE_DIM
static int aice_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
static int aice_usb_bulk_write_mem(uint32_t coreid, uint32_t addr, uint32_t length, const uint8_t *buffer)
static int aice_usb_memory_access(uint32_t coreid, enum nds_memory_access channel)
#define AICE_CMD_T_READ_DTR
static int aice_read_dtr(uint8_t target_id, uint32_t *data)
static int aice_read_edmsr(uint8_t target_id, uint32_t address, uint32_t *data)
static int aice_init_edm_registers(uint32_t coreid, bool clear_dex_use_psw)
static int usb_bulk_read_ex(struct libusb_device_handle *dev, int ep, char *bytes, int size, int timeout)
static uint8_t usb_out_packets_buffer[AICE_OUT_PACKETS_BUFFER_SIZE]
#define AICE_CMD_T_WRITE_EDMSR
static int aice_get_version_info(void)
static int aice_usb_set_clock(int set_clock)
static int aice_usb_program_edm(uint32_t coreid, char *command_sequence)
#define AICE_FORMAT_HTDMD
static int aice_bulk_read_mem(uint32_t coreid, uint32_t addr, uint32_t count, uint8_t *buffer)
#define AICE_CMD_T_FASTREAD_MEM
static struct aice_nds32_info core_info[AICE_MAX_NUM_CORE]
static int aice_usb_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
#define AICE_CMD_T_FASTWRITE_MEM
#define AICE_CMD_T_READ_MISC
#define AICE_FORMAT_HTDMA
static uint8_t usb_out_buffer[AICE_OUT_BUFFER_SIZE]
static int aice_usb_read_reg_64(uint32_t coreid, uint32_t num, uint64_t *val)
static int aice_read_dtr_to_buffer(uint8_t target_id, uint32_t buffer_idx)
static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer)
static int aice_usb_write_mem_w_bus(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_reset_box(void)
static int aice_usb_set_address_dim(uint32_t coreid, uint32_t address)
static void aice_pack_htdmd(uint8_t cmd_code, uint8_t target_id, uint8_t extra_word_length, uint32_t address, uint32_t word, enum aice_target_endian access_endian)
#define AICE_CMD_READ_CTRL
static char * custom_trst_script
static int aice_usb_icache_va_inval(uint32_t coreid, uint32_t address)
static int aice_issue_reset_hold_multi(void)
static int aice_usb_write_mem_h_dim(uint32_t coreid, uint32_t address, uint32_t data)
static int aice_core_init(uint32_t coreid)
static int aice_usb_dcache_inval_all(uint32_t coreid)
static int aice_do_execute(uint8_t target_id)
#define AICE_OUT_PACK_COMMAND_SIZE
#define AICE_CUSTOM_DELAY_CLEAN_DBGI
#define AICE_WRITE_CTRL_BATCH_DATA_BUF1_CTRL
#define AICE_READ_CTRL_GET_FIRMWARE_VERSION
#define AICE_BATCH_COMMAND_BUFFER_0
#define AICE_CUSTOM_DELAY_CLEAN_TRST
#define AICE_OUT_BATCH_COMMAND_SIZE
#define AICE_CUSTOM_DELAY_SET_TRST
#define AICE_READ_CTRL_GET_HARDWARE_VERSION
#define AICE_WRITE_CTRL_CUSTOM_DELAY
#define AICE_READ_CTRL_GET_FPGA_VERSION
#define AICE_WRITE_CTRL_JTAG_PIN_STATUS
#define AICE_OUT_PACKETS_BUFFER_SIZE
#define AICE_WRITE_CTRL_BATCH_DIM_SIZE
#define AICE_OUT_BUFFER_SIZE
#define AICE_READ_CTRL_GET_ICE_STATE
#define AICE_WRITE_CTRL_BATCH_ITERATION
#define AICE_IN_PACKETS_BUFFER_SIZE
#define AICE_TCK_CONTROL_TCK_SCAN
#define AICE_WRITE_CTRL_TCK_CONTROL
#define AICE_BATCH_DATA_BUFFER_0
#define AICE_CUSTOM_DELAY_CLEAN_SRST
#define AICE_READ_CTRL_GET_JTAG_PIN_STATUS
#define AICE_WRITE_CTRL_BATCH_DATA_BUF0_CTRL
#define AICE_WRITE_CTRL_BATCH_CTRL
#define AICE_WRITE_CTRL_BATCH_CMD_BUF0_CTRL
#define AICE_WRITE_CTRL_CLEAR_TIMEOUT_STATUS
#define AICE_JTAG_PIN_CONTROL_RESTART
#define AICE_CUSTOM_DELAY_SET_DBGI
#define AICE_WRITE_CTRL_JTAG_PIN_CONTROL
#define AICE_BATCH_DATA_BUFFER_1
#define AICE_READ_CTRL_BATCH_STATUS
#define AICE_JTAG_PIN_CONTROL_SRST
#define AICE_JTAG_PIN_CONTROL_TRST
#define AICE_IN_BUFFER_SIZE
#define AICE_CUSTOM_DELAY_SET_SRST
#define MFSR(reg, sysreg)
#define MTSR(sysreg, reg)
command_mode
OpenOCD command mode is COMMAND_CONFIG at start, then switches to COMMAND_EXEC during the execution o...
static struct jaylink_device_handle * devh
The JTAG interface can be implemented with a software or hardware fifo.
static const struct @102 instructions[]
int jtag_libusb_bulk_write(struct libusb_device_handle *dev, int ep, char *bytes, int size, 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)
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial)
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.
void alive_sleep(uint64_t ms)
#define LOG_DEBUG_IO(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define ERROR_TIMEOUT_REACHED
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
#define NDS_DBGER_ALL_SUPRS_EX
#define NDS_DBGER_ILL_SEC_ACC
#define NDS_DBGER_CLEAR_ALL
#define TLBOP_TARGET_READ(a)
#define TLBOP_TARGET_PROBE(a, b)
uint32_t nds32_reg_sr_index(uint32_t number)
enum nds32_reg_type_s nds32_reg_type(uint32_t number)
const char * nds32_reg_simple_name(uint32_t number)
size_t size
Size of the control block search area.
enum nds_memory_access access_channel
enum nds_memory_select memory_select
enum aice_target_state_s core_state
uint32_t target_dtr_backup
int(* open)(struct aice_port_param_s *param)
struct libusb_device_handle * usb_handle
unsigned int usb_write_ep