OpenOCD
arm_cti.c File Reference
Include dependency graph for arm_cti.c:

Go to the source code of this file.

Data Structures

struct  arm_cti
 

Functions

int arm_cti_ack_events (struct arm_cti *self, uint32_t event)
 
int arm_cti_cleanup_all (void)
 
int arm_cti_clear_channel (struct arm_cti *self, uint32_t channel)
 
int arm_cti_enable (struct arm_cti *self, bool enable)
 
int arm_cti_gate_channel (struct arm_cti *self, uint32_t channel)
 
static int arm_cti_mod_reg_bits (struct arm_cti *self, unsigned int reg, uint32_t mask, uint32_t value)
 
const char * arm_cti_name (struct arm_cti *self)
 
int arm_cti_pulse_channel (struct arm_cti *self, uint32_t channel)
 
int arm_cti_read_reg (struct arm_cti *self, unsigned int reg, uint32_t *p_value)
 
int arm_cti_set_channel (struct arm_cti *self, uint32_t channel)
 
int arm_cti_ungate_channel (struct arm_cti *self, uint32_t channel)
 
int arm_cti_write_reg (struct arm_cti *self, unsigned int reg, uint32_t value)
 
 COMMAND_HANDLER (handle_cti_ack)
 
 COMMAND_HANDLER (handle_cti_channel)
 
 COMMAND_HANDLER (handle_cti_dump)
 
 COMMAND_HANDLER (handle_cti_enable)
 
 COMMAND_HANDLER (handle_cti_read)
 
 COMMAND_HANDLER (handle_cti_testmode)
 
 COMMAND_HANDLER (handle_cti_write)
 
static int cti_configure (struct jim_getopt_info *goi, struct arm_cti *cti)
 
static int cti_create (struct jim_getopt_info *goi)
 
static int cti_find_reg_offset (const char *name)
 
struct arm_cticti_instance_by_jim_obj (Jim_Interp *interp, Jim_Obj *o)
 
int cti_register_commands (struct command_context *cmd_ctx)
 
static int jim_cti_create (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_cti_names (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static LIST_HEAD (all_cti)
 

Variables

static const struct command_registration cti_command_handlers []
 
static const struct command_registration cti_instance_command_handlers []
 
struct {
   const char *   label
 
   uint32_t   offset
 
   uint32_t *   p_val
 
cti_names []
 
static uint32_t cti_regs [28]
 
static const struct command_registration cti_subcommand_handlers []
 

Function Documentation

◆ arm_cti_ack_events()

int arm_cti_ack_events ( struct arm_cti self,
uint32_t  event 
)

◆ arm_cti_cleanup_all()

int arm_cti_cleanup_all ( void  )

Definition at line 210 of file arm_cti.c.

References arm_cti::ap, dap_put_ap(), ERROR_OK, lh(), list_for_each_entry_safe, and arm_cti::name.

Referenced by openocd_main().

◆ arm_cti_clear_channel()

int arm_cti_clear_channel ( struct arm_cti self,
uint32_t  channel 
)

Definition at line 152 of file arm_cti.c.

References arm_cti_write_reg(), CTI_APPCLEAR, CTI_CHNL, and ERROR_COMMAND_ARGUMENT_INVALID.

Referenced by COMMAND_HANDLER().

◆ arm_cti_enable()

int arm_cti_enable ( struct arm_cti self,
bool  enable 
)

Definition at line 74 of file arm_cti.c.

References CTI_CTR, and mem_ap_write_atomic_u32().

Referenced by aarch64_init_debug_access(), and COMMAND_HANDLER().

◆ arm_cti_gate_channel()

int arm_cti_gate_channel ( struct arm_cti self,
uint32_t  channel 
)

◆ arm_cti_mod_reg_bits()

static int arm_cti_mod_reg_bits ( struct arm_cti self,
unsigned int  reg,
uint32_t  mask,
uint32_t  value 
)
static

◆ arm_cti_name()

const char* arm_cti_name ( struct arm_cti self)

Definition at line 30 of file arm_cti.c.

Referenced by aarch64_jim_configure().

◆ arm_cti_pulse_channel()

int arm_cti_pulse_channel ( struct arm_cti self,
uint32_t  channel 
)

◆ arm_cti_read_reg()

int arm_cti_read_reg ( struct arm_cti self,
unsigned int  reg,
uint32_t *  p_value 
)

Definition at line 128 of file arm_cti.c.

References ERROR_COMMAND_ARGUMENT_INVALID, and mem_ap_read_atomic_u32().

Referenced by COMMAND_HANDLER().

◆ arm_cti_set_channel()

int arm_cti_set_channel ( struct arm_cti self,
uint32_t  channel 
)

Definition at line 144 of file arm_cti.c.

References arm_cti_write_reg(), CTI_APPSET, CTI_CHNL, and ERROR_COMMAND_ARGUMENT_INVALID.

Referenced by COMMAND_HANDLER().

◆ arm_cti_ungate_channel()

int arm_cti_ungate_channel ( struct arm_cti self,
uint32_t  channel 
)

◆ arm_cti_write_reg()

int arm_cti_write_reg ( struct arm_cti self,
unsigned int  reg,
uint32_t  value 
)

◆ COMMAND_HANDLER() [1/7]

COMMAND_HANDLER ( handle_cti_ack  )

◆ COMMAND_HANDLER() [2/7]

◆ COMMAND_HANDLER() [3/7]

COMMAND_HANDLER ( handle_cti_dump  )

◆ COMMAND_HANDLER() [4/7]

COMMAND_HANDLER ( handle_cti_enable  )

◆ COMMAND_HANDLER() [5/7]

COMMAND_HANDLER ( handle_cti_read  )

◆ COMMAND_HANDLER() [6/7]

COMMAND_HANDLER ( handle_cti_testmode  )

◆ COMMAND_HANDLER() [7/7]

COMMAND_HANDLER ( handle_cti_write  )

◆ cti_configure()

static int cti_configure ( struct jim_getopt_info goi,
struct arm_cti cti 
)
static

◆ cti_create()

◆ cti_find_reg_offset()

static int cti_find_reg_offset ( const char *  name)
static

Definition at line 197 of file arm_cti.c.

References ARRAY_SIZE, cti_names, label, LOG_ERROR, name, and offset.

Referenced by COMMAND_HANDLER().

◆ cti_instance_by_jim_obj()

struct arm_cti* cti_instance_by_jim_obj ( Jim_Interp *  interp,
Jim_Obj *  o 
)

Definition at line 35 of file arm_cti.c.

References lh(), list_for_each_entry, arm_cti::name, name, and NULL.

Referenced by aarch64_jim_configure().

◆ cti_register_commands()

int cti_register_commands ( struct command_context cmd_ctx)

Definition at line 574 of file arm_cti.c.

Referenced by setup_command_handler().

◆ jim_cti_create()

static int jim_cti_create ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_cti_names()

static int jim_cti_names ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 528 of file arm_cti.c.

◆ LIST_HEAD()

static LIST_HEAD ( all_cti  )
static

Variable Documentation

◆ cti_command_handlers

const struct command_registration cti_command_handlers[]
static
Initial value:
= {
{
.name = "cti",
.mode = COMMAND_CONFIG,
.help = "CTI commands",
.usage = "",
},
}
static const struct command_registration cti_subcommand_handlers[]
Definition: arm_cti.c:545
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_CONFIG
Definition: command.h:41
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:235

Definition at line 528 of file arm_cti.c.

◆ cti_instance_command_handlers

const struct command_registration cti_instance_command_handlers[]
static

Definition at line 333 of file arm_cti.c.

Referenced by cti_create().

◆ 

const { ... } cti_names[]
Initial value:
= {
{ CTI_CTR, "CTR", &cti_regs[0] },
{ CTI_GATE, "GATE", &cti_regs[1] },
{ CTI_INEN0, "INEN0", &cti_regs[2] },
{ CTI_INEN1, "INEN1", &cti_regs[3] },
{ CTI_INEN2, "INEN2", &cti_regs[4] },
{ CTI_INEN3, "INEN3", &cti_regs[5] },
{ CTI_INEN4, "INEN4", &cti_regs[6] },
{ CTI_INEN5, "INEN5", &cti_regs[7] },
{ CTI_INEN6, "INEN6", &cti_regs[8] },
{ CTI_INEN7, "INEN7", &cti_regs[9] },
{ CTI_INEN8, "INEN8", &cti_regs[10] },
{ CTI_OUTEN0, "OUTEN0", &cti_regs[11] },
{ CTI_OUTEN1, "OUTEN1", &cti_regs[12] },
{ CTI_OUTEN2, "OUTEN2", &cti_regs[13] },
{ CTI_OUTEN3, "OUTEN3", &cti_regs[14] },
{ CTI_OUTEN4, "OUTEN4", &cti_regs[15] },
{ CTI_OUTEN5, "OUTEN5", &cti_regs[16] },
{ CTI_OUTEN6, "OUTEN6", &cti_regs[17] },
{ CTI_OUTEN7, "OUTEN7", &cti_regs[18] },
{ CTI_OUTEN8, "OUTEN8", &cti_regs[19] },
{ CTI_TRIN_STATUS, "TRIN", &cti_regs[20] },
{ CTI_TROUT_STATUS, "TROUT", &cti_regs[21] },
{ CTI_CHIN_STATUS, "CHIN", &cti_regs[22] },
{ CTI_CHOU_STATUS, "CHOUT", &cti_regs[23] },
{ CTI_APPSET, "APPSET", &cti_regs[24] },
{ CTI_APPCLEAR, "APPCLR", &cti_regs[25] },
{ CTI_APPPULSE, "APPPULSE", &cti_regs[26] },
{ CTI_INACK, "INACK", &cti_regs[27] },
}
static uint32_t cti_regs[28]
Definition: arm_cti.c:160
#define CTI_OUTEN3
Definition: arm_cti.h:30
#define CTI_OUTEN6
Definition: arm_cti.h:33
#define CTI_INACK
Definition: arm_cti.h:13
#define CTI_INEN8
Definition: arm_cti.h:25
#define CTI_APPSET
Definition: arm_cti.h:14
#define CTI_INEN1
Definition: arm_cti.h:18
#define CTI_INEN4
Definition: arm_cti.h:21
#define CTI_OUTEN4
Definition: arm_cti.h:31
#define CTI_INEN3
Definition: arm_cti.h:20
#define CTI_INEN5
Definition: arm_cti.h:22
#define CTI_TROUT_STATUS
Definition: arm_cti.h:38
#define CTI_GATE
Definition: arm_cti.h:41
#define CTI_OUTEN2
Definition: arm_cti.h:29
#define CTI_APPPULSE
Definition: arm_cti.h:16
#define CTI_CTR
Definition: arm_cti.h:12
#define CTI_INEN7
Definition: arm_cti.h:24
#define CTI_INEN0
Definition: arm_cti.h:17
#define CTI_CHIN_STATUS
Definition: arm_cti.h:39
#define CTI_OUTEN8
Definition: arm_cti.h:35
#define CTI_OUTEN0
Definition: arm_cti.h:27
#define CTI_TRIN_STATUS
Definition: arm_cti.h:37
#define CTI_OUTEN7
Definition: arm_cti.h:34
#define CTI_CHOU_STATUS
Definition: arm_cti.h:40
#define CTI_INEN2
Definition: arm_cti.h:19
#define CTI_APPCLEAR
Definition: arm_cti.h:15
#define CTI_OUTEN5
Definition: arm_cti.h:32
#define CTI_OUTEN1
Definition: arm_cti.h:28
#define CTI_INEN6
Definition: arm_cti.h:23

Referenced by COMMAND_HANDLER(), and cti_find_reg_offset().

◆ cti_regs

uint32_t cti_regs[28]
static

Definition at line 160 of file arm_cti.c.

◆ cti_subcommand_handlers

const struct command_registration cti_subcommand_handlers[]
static
Initial value:
= {
{
.name = "create",
.mode = COMMAND_ANY,
.jim_handler = jim_cti_create,
.usage = "name '-chain-position' name [options ...]",
.help = "Creates a new CTI object",
},
{
.name = "names",
.mode = COMMAND_ANY,
.jim_handler = jim_cti_names,
.usage = "",
.help = "Lists all registered CTI objects by name",
},
}
static int jim_cti_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Definition: arm_cti.c:528
static int jim_cti_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Definition: arm_cti.c:516
@ COMMAND_ANY
Definition: command.h:42

Definition at line 528 of file arm_cti.c.

◆ label

const char* label

◆ offset

uint32_t offset

Definition at line 163 of file arm_cti.c.

Referenced by COMMAND_HANDLER(), and cti_find_reg_offset().

◆ p_val

uint32_t* p_val

Definition at line 165 of file arm_cti.c.

Referenced by COMMAND_HANDLER().