76 uint32_t val = enable ? 1 : 0;
94 if ((tmp & event) == 0)
162 static const struct {
346 else if (!strcmp(
CMD_ARGV[1],
"ungate"))
348 else if (!strcmp(
CMD_ARGV[1],
"pulse"))
350 else if (!strcmp(
CMD_ARGV[1],
"set"))
352 else if (!strcmp(
CMD_ARGV[1],
"clear"))
355 command_print(
CMD,
"Possible channel operations: gate|ungate|set|clear|pulse");
369 .handler = handle_cti_dump,
370 .help =
"dump CTI registers",
376 .handler = handle_cti_enable,
377 .help =
"enable or disable the CTI",
378 .usage =
"'on'|'off'",
383 .handler = handle_cti_testmode,
384 .help =
"enable or disable integration test mode",
385 .usage =
"'on'|'off'",
390 .handler = handle_cti_write,
391 .help =
"write to a CTI register",
392 .usage =
"register_name value",
397 .handler = handle_cti_read,
398 .help =
"read a CTI register",
399 .usage =
"register_name",
404 .handler = handle_cti_ack,
405 .help =
"acknowledge a CTI event",
411 .handler = handle_cti_channel,
412 .help =
"do an operation on one CTI channel, possible operations: "
413 "gate, ungate, set, clear and pulse",
414 .usage =
"channel_number operation",
422 while (goi->
argc > 0) {
425 if (e == JIM_CONTINUE)
426 Jim_SetResultFormatted(goi->
interp,
"unknown option '%s'",
427 Jim_String(goi->
argv[0]));
434 Jim_SetResultString(goi->
interp,
"-dap required when creating CTI", -1);
453 Jim_WrongNumArgs(goi->
interp, 1, goi->
argv,
"?name? ..options...");
459 cmd = Jim_GetCommand(goi->
interp, new_cmd, JIM_NONE);
461 cp = Jim_GetString(new_cmd,
NULL);
462 Jim_SetResultFormatted(goi->
interp,
"Command: %s Exists", cp);
467 cti = calloc(1,
sizeof(*cti));
481 cp = Jim_GetString(new_cmd,
NULL);
482 cti->
name = strdup(cp);
495 .help =
"cti instance command group",
497 .chain = cti_subcommands,
509 Jim_SetResultString(goi->
interp,
"Cannot get AP", -1);
522 "<name> [<cti_options> ...]");
533 Jim_WrongNumArgs(interp, 1, argv,
"Too many parameters");
536 Jim_SetResult(interp, Jim_NewListObj(interp,
NULL, 0));
538 Jim_ListAppendElement(interp, Jim_GetResult(interp),
539 Jim_NewStringObj(interp, obj->
name, -1));
550 .usage =
"name '-chain-position' name [options ...]",
551 .help =
"Creates a new CTI object",
558 .help =
"Lists all registered CTI objects by name",
567 .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)
static const struct @59 cti_names[]
static int jim_cti_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
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)
static uint32_t cti_regs[28]
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)
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)
list_add_tail - add a new entry
#define list_for_each_entry(pos, head, member)
list_for_each_entry - iterate over list of given type
#define list_for_each_entry_safe(pos, n, head, member)
list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
#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.