16 #define TAPINS_PWRCTL 0x08
17 #define TAPINS_PWRSTAT 0x09
18 #define TAPINS_NARSEL 0x1C
19 #define TAPINS_IDCODE 0x1E
20 #define TAPINS_BYPASS 0x1F
22 #define TAPINS_PWRCTL_LEN 8
23 #define TAPINS_PWRSTAT_LEN 8
24 #define TAPINS_NARSEL_ADRLEN 8
25 #define TAPINS_NARSEL_DATALEN 32
26 #define TAPINS_IDCODE_LEN 32
27 #define TAPINS_BYPASS_LEN 1
40 uint8_t t[4] = { 0, 0, 0, 0 };
42 memset(&field, 0,
sizeof(field));
57 memset(&field, 0,
sizeof(field));
69 LOG_ERROR(
"Xtensa DM APB offset must be aligned to a %dKB multiple",
116 LOG_DEBUG(
"DM examine: search for APB-type MEM-AP...");
120 LOG_ERROR(
"Could not find MEM-AP to control the core");
136 LOG_ERROR(
"MEM-AP init failed: %d", retval);
164 uint8_t
dummy[4] = { 0, 0, 0, 0 };
180 uint8_t valdata[] = { value, value >> 8, value >> 16, value >> 24 };
206 uint8_t value_clr = (uint8_t)clear;
228 uint8_t value = (uint8_t)data;
236 uint8_t id_buf[
sizeof(uint32_t)];
249 uint8_t stat_buf[
sizeof(uint32_t)] = { 0, 0, 0, 0 };
250 uint8_t stath_buf[
sizeof(uint32_t)] = { 0, 0, 0, 0 };
269 uint8_t dsr_buf[
sizeof(uint32_t)];
318 uint8_t traxctl_buf[
sizeof(uint32_t)];
352 uint8_t traxstat_buf[
sizeof(uint32_t)];
364 uint8_t traxctl_buf[
sizeof(uint32_t)];
365 uint8_t memadrstart_buf[
sizeof(uint32_t)];
366 uint8_t memadrend_buf[
sizeof(uint32_t)];
367 uint8_t adr_buf[
sizeof(uint32_t)];
392 for (
unsigned int i = 0; i <
size / 4; i++)
404 uint8_t pmstat_buf[4];
405 uint32_t pmctrl = ((
config->tracelevel) << 4) +
423 uint8_t pmstat_buf[4];
424 uint8_t pmcount_buf[4];
438 out_result->
value = result;
int mem_ap_read_buf(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint32_t count, target_addr_t address)
int mem_ap_write_u32(struct adiv5_ap *ap, target_addr_t address, uint32_t value)
Asynchronous (queued) write of a word to memory or a system register.
int dap_find_get_ap(struct adiv5_dap *dap, enum ap_type type_to_find, struct adiv5_ap **ap_out)
struct adiv5_ap * dap_get_ap(struct adiv5_dap *dap, uint64_t ap_num)
int dap_put_ap(struct adiv5_ap *ap)
int mem_ap_init(struct adiv5_ap *ap)
Initialize a DAP.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static struct device_config config
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
Generate a DR SCAN using the fields passed to the function.
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
size_t size
Size of the control block search area.
uint32_t tar_autoincr_block
uint64_t ap_num
ADIv5: Number of this AP (0~255) ADIv6: Base address of this AP (4k aligned) TODO: to be more coheren...
uint32_t memaccess_tck
Configures how many extra tck clocks are added after starting a MEM-AP access before we try to read i...
This represents an ARM Debug Interface (v5) Debug Access Port (DAP).
int ir_length
size of instruction register
This structure defines a single scan field in the scan.
int num_bits
The number of bits this field specifies.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
struct adiv5_ap * debug_ap
void(* queue_tdi_idle)(struct target *target)
const struct xtensa_debug_ops * dbg_ops
const struct xtensa_power_ops * pwr_ops
void * queue_tdi_idle_arg
struct xtensa_power_status power_status
void(* queue_tdi_idle)(struct target *target)
const struct xtensa_power_ops * pwr_ops
struct xtensa_core_status core_status
void * queue_tdi_idle_arg
const struct xtensa_debug_ops * dbg_ops
struct adiv5_ap * debug_ap
int(* queue_reg_write)(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint32_t data)
register write.
int(* queue_reg_read)(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint8_t *data)
register read.
int(* queue_reg_read)(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint8_t *data, uint32_t clear)
register read.
static void xtensa_dm_add_set_ir(struct xtensa_debug_module *dm, uint8_t value)
int xtensa_dm_trace_status_read(struct xtensa_debug_module *dm, struct xtensa_trace_status *status)
static void xtensa_dm_add_dr_scan(struct xtensa_debug_module *dm, int len, const uint8_t *src, uint8_t *dest, tap_state_t endstate)
int xtensa_dm_queue_reg_read(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint8_t *value)
int xtensa_dm_queue_pwr_reg_write(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint32_t data)
int xtensa_dm_trace_start(struct xtensa_debug_module *dm, struct xtensa_trace_start_config *cfg)
int xtensa_dm_trace_stop(struct xtensa_debug_module *dm, bool pto_enable)
int xtensa_dm_device_id_read(struct xtensa_debug_module *dm)
int xtensa_dm_queue_pwr_reg_read(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint8_t *data, uint32_t clear)
static const struct xtensa_dm_reg_offsets xdm_regs[XDMREG_NUM]
int xtensa_dm_queue_reg_write(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint32_t value)
#define TAPINS_PWRSTAT_LEN
int xtensa_dm_power_status_read(struct xtensa_debug_module *dm, uint32_t clear)
int xtensa_dm_poll(struct xtensa_debug_module *dm)
static const struct xtensa_dm_pwr_reg_offsets xdm_pwr_regs[XDMREG_PWRNUM]
int xtensa_dm_perfmon_enable(struct xtensa_debug_module *dm, int counter_id, const struct xtensa_perfmon_config *config)
void xtensa_dm_deinit(struct xtensa_debug_module *dm)
#define TAPINS_NARSEL_DATALEN
int xtensa_dm_trace_config_read(struct xtensa_debug_module *dm, struct xtensa_trace_config *config)
int xtensa_dm_trace_data_read(struct xtensa_debug_module *dm, uint8_t *dest, uint32_t size)
int xtensa_dm_core_status_clear(struct xtensa_debug_module *dm, xtensa_dsr_t bits)
int xtensa_dm_core_status_read(struct xtensa_debug_module *dm)
int xtensa_dm_queue_enable(struct xtensa_debug_module *dm)
#define TAPINS_PWRCTL_LEN
int xtensa_dm_init(struct xtensa_debug_module *dm, const struct xtensa_debug_module_config *cfg)
int xtensa_dm_examine(struct xtensa_debug_module *dm)
int xtensa_dm_perfmon_dump(struct xtensa_debug_module *dm, int counter_id, struct xtensa_perfmon_result *out_result)
#define TAPINS_NARSEL_ADRLEN
#define XTENSA_DM_REG_OFFSETS
static void xtensa_dm_queue_tdi_idle(struct xtensa_debug_module *dm)
#define TRAXCTRL_SMPER_SHIFT
static int xtensa_dm_queue_execute(struct xtensa_debug_module *dm)
#define PCMATCHCTRL_PCML_SHIFT
#define XTENSA_DM_APB_ALIGN
#define XTENSA_STOPMASK_DISABLED
#define XTENSA_DM_PWR_REG_OFFSETS