20 #define AICE_KHZ_TO_SPEED_MAP_SIZE 16
63 LOG_ERROR(
"<-- TARGET ERROR! Failed to identify AndesCore "
64 "JTAG Manufacture ID in the JTAG scan chain. "
65 "Failed to access EDM registers. -->");
76 for (ii = 0; ii < limit; ii++) {
88 (
"aice_init_targets: target not found: idcode: %" PRIx32,
115 LOG_ERROR(
"Cannot find AICE Interface! Please check "
116 "connection and permissions.");
123 LOG_INFO(
"AICE JTAG Interface ready");
139 static int last_trst;
144 if (
cmd->cmd.reset->trst != last_trst) {
145 if (
cmd->cmd.reset->trst)
148 last_trst =
cmd->cmd.reset->trst;
219 LOG_INFO(
"No support the jtag clock: %d", khz);
220 LOG_INFO(
"Supported jtag clocks are:");
234 uint8_t num_of_idcode = 0;
239 LOG_ERROR(
"<-- TARGET ERROR! Failed to identify AndesCore "
240 "JTAG Manufacture ID in the JTAG scan chain. "
241 "Failed to access EDM registers. -->");
245 for (
unsigned int i = 0; i < num_of_idcode; i++)
259 LOG_DEBUG(
"aice_handle_aice_info_command");
271 LOG_DEBUG(
"aice_handle_aice_port_command");
274 LOG_ERROR(
"Need exactly one argument to 'aice port'");
279 if (strcmp(l->name,
CMD_ARGV[0]) == 0) {
291 LOG_DEBUG(
"aice_handle_aice_desc_command");
296 LOG_ERROR(
"expected exactly one argument to aice desc <description>");
303 LOG_DEBUG(
"aice_handle_aice_vid_pid_command");
306 LOG_WARNING(
"ignoring extra IDs in aice vid_pid (maximum is 1 pair)");
318 LOG_DEBUG(
"aice_handle_aice_adapter_command");
323 LOG_ERROR(
"expected exactly one argument to aice adapter <adapter-name>");
330 LOG_DEBUG(
"aice_handle_aice_retry_times_command");
335 LOG_ERROR(
"expected exactly one argument to aice retry_times <num_of_retry>");
342 LOG_DEBUG(
"aice_handle_aice_count_to_check_dbger_command");
347 LOG_ERROR(
"expected exactly one argument to aice count_to_check_dbger "
348 "<count_of_checking>");
355 LOG_DEBUG(
"aice_handle_aice_custom_srst_script_command");
367 LOG_DEBUG(
"aice_handle_aice_custom_trst_script_command");
379 LOG_DEBUG(
"aice_handle_aice_custom_restart_script_command");
391 LOG_DEBUG(
"aice_handle_aice_reset_command");
400 .handler = &aice_handle_aice_info_command,
402 .help =
"show aice info",
407 .handler = &aice_handle_aice_port_command,
409 .help =
"set the port of the AICE",
410 .usage =
"['aice_pipe'|'aice_usb']",
414 .handler = &aice_handle_aice_desc_command,
416 .help =
"set the aice device description",
417 .usage =
"[description string]",
421 .handler = &aice_handle_aice_vid_pid_command,
423 .help =
"the vendor and product ID of the AICE device",
424 .usage =
"(vid pid)*",
428 .handler = &aice_handle_aice_adapter_command,
430 .help =
"set the file name of adapter",
431 .usage =
"[adapter name]",
434 .name =
"retry_times",
435 .handler = &aice_handle_aice_retry_times_command,
437 .help =
"set retry times as AICE timeout",
438 .usage =
"num_of_retry",
441 .name =
"count_to_check_dbger",
442 .handler = &aice_handle_aice_count_to_check_dbger_command,
444 .help =
"set retry times as checking $DBGER status",
445 .usage =
"count_of_checking",
448 .name =
"custom_srst_script",
449 .handler = &aice_handle_aice_custom_srst_script_command,
451 .usage =
"script_file_name",
452 .help =
"set custom srst script",
455 .name =
"custom_trst_script",
456 .handler = &aice_handle_aice_custom_trst_script_command,
458 .usage =
"script_file_name",
459 .help =
"set custom trst script",
462 .name =
"custom_restart_script",
463 .handler = &aice_handle_aice_custom_restart_script_command,
465 .usage =
"script_file_name",
466 .help =
"set custom restart script",
470 .handler = &aice_handle_aice_reset_command,
473 .help =
"reset AICE",
482 .help =
"perform aice management",
483 .usage =
"[subcommand]",
const char * adapter_get_required_serial(void)
Retrieves the serial number set with command 'adapter serial'.
static uint32_t count_to_check_dbger
static int aice_khz(int khz, int *jtag_speed)
static const struct command_registration aice_command_handlers[]
static int aice_execute_command(struct jtag_command *cmd)
int aice_init_targets(void)
static struct aice_port_param_s param
static const struct aice_port * aice_port
struct adapter_driver aice_adapter_driver
static int aice_speed(int speed)
static int aice_speed_div(int speed, int *khz)
#define AICE_KHZ_TO_SPEED_MAP_SIZE
COMMAND_HANDLER(aice_handle_aice_info_command)
int aice_scan_jtag_chain(void)
static int aice_quit(void)
static uint8_t aice_num_of_target_id_codes
static int aice_execute_reset(struct jtag_command *cmd)
static uint32_t retry_times
static const struct command_registration aice_subcommand_handlers[]
static int aice_init(void)
static uint32_t aice_target_id_codes[AICE_MAX_NUM_CORE]
static const int aice_khz_to_speed_map[AICE_KHZ_TO_SPEED_MAP_SIZE]
static struct jtag_interface aice_interface
static int aice_execute_queue(void)
const struct aice_port * aice_port_get_list(void)
#define AICE_MAX_NUM_CORE
const char * aice_transports[]
#define AICE_TCK_CONTROL_TCK3048
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
struct jtag_command * jtag_command_queue
The current queue of jtag_command_s structures.
#define ERROR_JTAG_QUEUE_FAILED
#define ERROR_JTAG_INIT_FAILED
#define LOG_DEBUG_IO(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
Represents a driver for a debugging interface.
const char *const name
The name of the interface driver.
int(* set_retry_times)(uint32_t a_retry_times)
int(* set_custom_restart_script)(const char *script)
int(* set_custom_srst_script)(const char *script)
int(* open)(struct aice_port_param_s *param)
int(* set_count_to_check_dbger)(uint32_t count_to_check)
int(* idcode)(uint32_t *idcode, uint8_t *num_of_idcode)
int(* set_jtag_clock)(uint32_t a_clock)
int(* set_custom_trst_script)(const char *script)
const struct aice_port * port
struct aice_port_api_s *const api
Represents a driver for a debugging interface.
int(* execute_queue)(void)
Execute queued commands.
uint8_t expected_ids_cnt
Number of expected identification codes.
bool hasidcode
not all devices have idcode, we'll discover this during chain examination
uint32_t * expected_ids
Array of expected identification codes.
uint32_t idcode
device identification code
struct target * all_targets