76 uint32_t val = enable ? 1 : 0;
94 if ((tmp & event) == 0)
160 static const struct {
342 else if (!strcmp(
CMD_ARGV[1],
"ungate"))
344 else if (!strcmp(
CMD_ARGV[1],
"pulse"))
346 else if (!strcmp(
CMD_ARGV[1],
"set"))
348 else if (!strcmp(
CMD_ARGV[1],
"clear"))
351 command_print(
CMD,
"Possible channel operations: gate|ungate|set|clear|pulse");
365 .handler = handle_cti_dump,
366 .help =
"dump CTI registers",
372 .handler = handle_cti_enable,
373 .help =
"enable or disable the CTI",
374 .usage =
"'on'|'off'",
379 .handler = handle_cti_testmode,
380 .help =
"enable or disable integration test mode",
381 .usage =
"'on'|'off'",
386 .handler = handle_cti_write,
387 .help =
"write to a CTI register",
388 .usage =
"register_name value",
393 .handler = handle_cti_read,
394 .help =
"read a CTI register",
395 .usage =
"register_name",
400 .handler = handle_cti_ack,
401 .help =
"acknowledge a CTI event",
407 .handler = handle_cti_channel,
408 .help =
"do an operation on one CTI channel, possible operations: "
409 "gate, ungate, set, clear and pulse",
410 .usage =
"channel_number operation",
418 while (goi->
argc > 0) {
421 if (e == JIM_CONTINUE)
422 Jim_SetResultFormatted(goi->
interp,
"unknown option '%s'",
423 Jim_String(goi->
argv[0]));
430 Jim_SetResultString(goi->
interp,
"-dap required when creating CTI", -1);
450 Jim_WrongNumArgs(goi->
interp, 1, goi->
argv,
"?name? ..options...");
456 cmd = Jim_GetCommand(goi->
interp, new_cmd, JIM_NONE);
458 cp = Jim_GetString(new_cmd,
NULL);
459 Jim_SetResultFormatted(goi->
interp,
"Command: %s Exists", cp);
464 cti = calloc(1,
sizeof(*cti));
478 cp = Jim_GetString(new_cmd,
NULL);
479 cti->
name = strdup(cp);
492 .help =
"cti instance command group",
494 .chain = cti_subcommands,
506 Jim_SetResultString(goi->
interp,
"Cannot get AP", -1);
519 "<name> [<cti_options> ...]");
543 .usage =
"name '-chain-position' name [options ...]",
544 .help =
"Creates a new CTI object",
549 .handler = cti_handle_names,
551 .help =
"Lists all registered CTI objects by name",
560 .help =
"CTI commands",
int mem_ap_read_u32(struct adiv5_ap *ap, target_addr_t address, uint32_t *value)
Asynchronous (queued) read of a word from memory or a system register.
int adiv5_mem_ap_spot_init(struct adiv5_mem_ap_spot *p)
int mem_ap_read_atomic_u32(struct adiv5_ap *ap, target_addr_t address, uint32_t *value)
Synchronous read of a word from memory or a system register.
struct adiv5_ap * dap_get_ap(struct adiv5_dap *dap, uint64_t ap_num)
int dap_put_ap(struct adiv5_ap *ap)
int adiv5_jim_mem_ap_spot_configure(struct adiv5_mem_ap_spot *cfg, struct jim_getopt_info *goi)
int mem_ap_write_atomic_u32(struct adiv5_ap *ap, target_addr_t address, uint32_t value)
Synchronous write of a word to memory or a system register.
This defines formats and data structures used to talk to ADIv5 entities.
static int dap_run(struct adiv5_dap *dap)
Perform all queued DAP operations, and clear any errors posted in the CTRL_STAT register when they ar...
static int cti_find_reg_offset(const char *name)
int arm_cti_clear_channel(struct arm_cti *self, uint32_t channel)
int arm_cti_ack_events(struct arm_cti *self, uint32_t event)
int arm_cti_write_reg(struct arm_cti *self, unsigned int reg, uint32_t value)
static int cti_configure(struct jim_getopt_info *goi, struct arm_cti *cti)
COMMAND_HANDLER(handle_cti_dump)
static int jim_cti_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
int cti_register_commands(struct command_context *cmd_ctx)
int arm_cti_gate_channel(struct arm_cti *self, uint32_t channel)
int arm_cti_set_channel(struct arm_cti *self, uint32_t channel)
static const struct command_registration cti_subcommand_handlers[]
int arm_cti_pulse_channel(struct arm_cti *self, uint32_t channel)
static const struct command_registration cti_instance_command_handlers[]
static int cti_create(struct jim_getopt_info *goi)
static LIST_HEAD(all_cti)
int arm_cti_enable(struct arm_cti *self, bool enable)
int arm_cti_cleanup_all(void)
const char * arm_cti_name(struct arm_cti *self)
static int arm_cti_mod_reg_bits(struct arm_cti *self, unsigned int reg, uint32_t mask, uint32_t value)
static const struct @63 cti_names[]
int arm_cti_read_reg(struct arm_cti *self, unsigned int reg, uint32_t *p_value)
struct arm_cti * cti_instance_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
int arm_cti_ungate_channel(struct arm_cti *self, uint32_t channel)
static const struct command_registration cti_command_handlers[]
struct command_context * current_command_context(Jim_Interp *interp)
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...
static int register_commands_with_data(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds, void *data)
Register one or more commands, as register_commands(), plus specify a pointer to command private data...
#define COMMAND_PARSE_ON_OFF(in, out)
parses an on/off command argument
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_DATA
Use this macro to access the invoked command handler's data pointer, rather than accessing the variab...
#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.
#define ERROR_COMMAND_ARGUMENT_INVALID
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
int jim_getopt_setup(struct jim_getopt_info *p, Jim_Interp *interp, int argc, Jim_Obj *const *argv)
GetOpt - how to.
int jim_getopt_obj(struct jim_getopt_info *goi, Jim_Obj **puthere)
Remove argv[0] from the list.
static void list_add_tail(struct list_head *new, struct list_head *head)
#define list_for_each_entry_safe(p, n, h, field)
#define list_for_each_entry(p, h, field)
#define LOG_ERROR(expr ...)
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
This represents an ARM Debug Interface (v5) Access Port (AP).
struct adiv5_dap * dap
DAP this AP belongs to.
struct adiv5_mem_ap_spot spot
const struct command_registration * chain
If non-NULL, the commands in chain will be registered in the same context and scope of this registrat...
const char * usage
a string listing the options and arguments, required or optional
A TCL -ish GetOpt like code.
#define ERROR_TARGET_TIMEOUT
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.