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

Go to the source code of this file.

Functions

 COMMAND_HANDLER (xscale_handle_analyze_trace_buffer_command)
 
 COMMAND_HANDLER (xscale_handle_cache_clean_address_command)
 
 COMMAND_HANDLER (xscale_handle_cache_info_command)
 
 COMMAND_HANDLER (xscale_handle_cp15)
 
 COMMAND_HANDLER (xscale_handle_debug_handler_command)
 
 COMMAND_HANDLER (xscale_handle_dump_trace_command)
 
 COMMAND_HANDLER (xscale_handle_idcache_command)
 
 COMMAND_HANDLER (xscale_handle_mmu_command)
 
 COMMAND_HANDLER (xscale_handle_trace_buffer_command)
 
 COMMAND_HANDLER (xscale_handle_trace_image_command)
 
 COMMAND_HANDLER (xscale_handle_vector_catch_command)
 
 COMMAND_HANDLER (xscale_handle_vector_table_command)
 
static unsigned int parity (unsigned int v)
 
static int xscale_add_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int xscale_add_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int xscale_analyze_trace (struct target *target, struct command_invocation *cmd)
 
static int xscale_arch_state (struct target *target)
 
static int xscale_assert_reset (struct target *target)
 
static void xscale_branch_address (struct xscale_trace_data *trace_data, int i, uint32_t *target)
 
static void xscale_build_reg_cache (struct target *target)
 
static int xscale_deassert_reset (struct target *target)
 
static int xscale_debug_entry (struct target *)
 
static void xscale_deinit_target (struct target *target)
 
static int xscale_disable_mmu_caches (struct target *target, int mmu, int d_u_cache, int i_cache)
 
static int xscale_disable_single_step (struct target *target)
 
static void xscale_display_instruction (struct target *target, uint32_t pc, struct arm_instruction *instruction, struct command_invocation *cmd)
 
static void xscale_enable_breakpoints (struct target *target)
 
static int xscale_enable_mmu_caches (struct target *target, int mmu, int d_u_cache, int i_cache)
 
static int xscale_enable_single_step (struct target *target, uint32_t next_pc)
 
static void xscale_enable_watchpoints (struct target *target)
 
static void xscale_free_reg_cache (struct target *target)
 
static void xscale_free_trace_data (struct xscale_common *xscale)
 
static int xscale_full_context (struct target *target)
 
static int xscale_get_reg (struct reg *reg)
 
static int xscale_get_ttb (struct target *target, uint32_t *result)
 
static void xscale_getbuf (jtag_callback_data_t arg)
 
static int xscale_halt (struct target *target)
 
static int xscale_init_arch_info (struct target *target, struct xscale_common *xscale, struct jtag_tap *tap)
 
static int xscale_init_target (struct command_context *cmd_ctx, struct target *target)
 
static int xscale_invalidate_ic_line (struct target *target, uint32_t va)
 
static int xscale_jtag_set_instr (struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state)
 
static int xscale_load_ic (struct target *target, uint32_t va, uint32_t buffer[8])
 
static int xscale_mmu (struct target *target, int *enabled)
 
static int xscale_poll (struct target *target)
 
static int xscale_read_core_reg (struct target *target, struct reg *r, int num, enum arm_mode mode)
 
static int xscale_read_dcsr (struct target *target)
 
static int xscale_read_instruction (struct target *target, uint32_t pc, struct arm_instruction *instruction)
 
static int xscale_read_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
static int xscale_read_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
static int xscale_read_trace (struct target *)
 
static int xscale_read_tx (struct target *target, int consume)
 
static int xscale_receive (struct target *target, uint32_t *buffer, int num_words)
 
static int xscale_remove_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
static int xscale_remove_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int xscale_restore_banked (struct target *)
 
static int xscale_resume (struct target *, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
static int xscale_send (struct target *target, const uint8_t *buffer, int count, int size)
 
static int xscale_send_u32 (struct target *target, uint32_t value)
 
static int xscale_set_breakpoint (struct target *, struct breakpoint *)
 
static int xscale_set_reg (struct reg *reg, uint8_t *buf)
 
static int xscale_set_reg_u32 (struct reg *reg, uint32_t value)
 
static int xscale_set_watchpoint (struct target *, struct watchpoint *)
 
static int xscale_step (struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
static int xscale_step_inner (struct target *target, int current, uint32_t address, int handle_breakpoints)
 
static int xscale_target_create (struct target *target, Jim_Interp *interp)
 
static int xscale_unset_breakpoint (struct target *, struct breakpoint *)
 
static int xscale_unset_watchpoint (struct target *target, struct watchpoint *watchpoint)
 
static int xscale_update_vectors (struct target *target)
 
static int xscale_verify_pointer (struct command_invocation *cmd, struct xscale_common *xscale)
 
static int xscale_virt2phys (struct target *target, target_addr_t virtual, target_addr_t *physical)
 
static int xscale_write_core_reg (struct target *target, struct reg *r, int num, enum arm_mode mode, uint8_t *value)
 
static int xscale_write_dcsr (struct target *target, int hold_rst, int ext_dbg_brk)
 
static int xscale_write_dcsr_sw (struct target *target, uint32_t value)
 
static int xscale_write_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
static int xscale_write_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
static int xscale_write_rx (struct target *target)
 

Variables

struct {
   unsigned   mask
 
   char   name [15]
 
vec_ids []
 
static const struct command_registration xscale_any_command_handlers []
 
static const struct command_registration xscale_command_handlers []
 
static const uint8_t xscale_debug_handler []
 
static const struct command_registration xscale_exec_command_handlers []
 
static const char xscale_not [] = "target is not an XScale"
 
static const struct xscale_reg xscale_reg_arch_info []
 
static const char *const xscale_reg_list []
 
static const struct reg_arch_type xscale_reg_type
 
struct target_type xscale_target
 

Function Documentation

◆ COMMAND_HANDLER() [1/12]

COMMAND_HANDLER ( xscale_handle_analyze_trace_buffer_command  )

◆ COMMAND_HANDLER() [2/12]

COMMAND_HANDLER ( xscale_handle_cache_clean_address_command  )

◆ COMMAND_HANDLER() [3/12]

◆ COMMAND_HANDLER() [4/12]

◆ COMMAND_HANDLER() [5/12]

COMMAND_HANDLER ( xscale_handle_debug_handler_command  )

◆ COMMAND_HANDLER() [6/12]

◆ COMMAND_HANDLER() [7/12]

◆ COMMAND_HANDLER() [8/12]

◆ COMMAND_HANDLER() [9/12]

◆ COMMAND_HANDLER() [10/12]

◆ COMMAND_HANDLER() [11/12]

◆ COMMAND_HANDLER() [12/12]

◆ parity()

static unsigned int parity ( unsigned int  v)
static

◆ xscale_add_breakpoint()

static int xscale_add_breakpoint ( struct target target,
struct breakpoint breakpoint 
)
static

◆ xscale_add_watchpoint()

◆ xscale_analyze_trace()

◆ xscale_arch_state()

◆ xscale_assert_reset()

◆ xscale_branch_address()

static void xscale_branch_address ( struct xscale_trace_data trace_data,
int  i,
uint32_t *  target 
)
inlinestatic

Definition at line 2631 of file xscale.c.

References xscale_trace_entry::data, and xscale_trace_data::entries.

Referenced by xscale_analyze_trace().

◆ xscale_build_reg_cache()

◆ xscale_deassert_reset()

◆ xscale_debug_entry()

◆ xscale_deinit_target()

static void xscale_deinit_target ( struct target target)
static

Definition at line 2917 of file xscale.c.

References target_to_xscale(), and xscale_free_reg_cache().

◆ xscale_disable_mmu_caches()

static int xscale_disable_mmu_caches ( struct target target,
int  mmu,
int  d_u_cache,
int  i_cache 
)
static

◆ xscale_disable_single_step()

static int xscale_disable_single_step ( struct target target)
static

◆ xscale_display_instruction()

static void xscale_display_instruction ( struct target target,
uint32_t  pc,
struct arm_instruction instruction,
struct command_invocation cmd 
)
inlinestatic

Definition at line 2644 of file xscale.c.

References cmd, command_print(), ERROR_OK, arm_instruction::text, and xscale_read_instruction().

Referenced by xscale_analyze_trace().

◆ xscale_enable_breakpoints()

static void xscale_enable_breakpoints ( struct target target)
static

Definition at line 1085 of file xscale.c.

References target::breakpoints, breakpoint::is_set, breakpoint::next, and xscale_set_breakpoint().

Referenced by xscale_resume().

◆ xscale_enable_mmu_caches()

static int xscale_enable_mmu_caches ( struct target target,
int  mmu,
int  d_u_cache,
int  i_cache 
)
static

◆ xscale_enable_single_step()

static int xscale_enable_single_step ( struct target target,
uint32_t  next_pc 
)
static

◆ xscale_enable_watchpoints()

static void xscale_enable_watchpoints ( struct target target)
static

Definition at line 1074 of file xscale.c.

References watchpoint::is_set, watchpoint::next, target::watchpoints, and xscale_set_watchpoint().

Referenced by xscale_resume().

◆ xscale_free_reg_cache()

static void xscale_free_reg_cache ( struct target target)
static

◆ xscale_free_trace_data()

static void xscale_free_trace_data ( struct xscale_common xscale)
static

◆ xscale_full_context()

◆ xscale_get_reg()

◆ xscale_get_ttb()

static int xscale_get_ttb ( struct target target,
uint32_t *  result 
)
static

◆ xscale_getbuf()

static void xscale_getbuf ( jtag_callback_data_t  arg)
static

Definition at line 222 of file xscale.c.

References buf_get_u32().

Referenced by xscale_receive().

◆ xscale_halt()

◆ xscale_init_arch_info()

static int xscale_init_arch_info ( struct target target,
struct xscale_common xscale,
struct jtag_tap tap 
)
static

Definition at line 2925 of file xscale.c.

References arm::arch_info, xscale_common::arm, xscale_common::arm_bkpt, ARM_CORE_TYPE_STD, arm_init_arch_info(), ARMV4_5_B, armv4_5_mmu_common::armv4_5_cache, xscale_common::armv4_5_mmu, ARMV5_BKPT, ARMV5_T_BKPT, xscale_trace::buffer_fill, xscale_common::cache_clean_address, xscale_common::common_magic, arm::core_type, armv4_5_cache_common::ctype, xscale_trace::data, xscale_common::dbr0_used, xscale_common::dbr1_used, xscale_common::dbr_available, armv4_5_mmu_common::disable_mmu_caches, armv4_5_mmu_common::enable_mmu_caches, ERROR_OK, xscale_common::external_debug_break, xscale_trace::fill_counter, arm::full_context, armv4_5_mmu_common::get_ttb, xscale_common::handler_address, armv4_5_mmu_common::has_tiny_pages, xscale_common::high_vectors, xscale_common::hold_rst, xscale_common::ibcr0_used, xscale_common::ibcr1_used, xscale_common::ibcr_available, xscale_trace::image, jtag_tap::ir_length, LOG_INFO, xscale_common::low_vectors, armv4_5_mmu_common::mmu_enabled, xscale_trace::mode, NULL, arm::read_core_reg, armv4_5_mmu_common::read_memory, xscale_common::static_high_vectors_set, xscale_common::static_low_vectors_set, target_name(), xscale_common::thumb_bkpt, xscale_common::trace, xscale_common::vector_catch, arm::write_core_reg, armv4_5_mmu_common::write_memory, XSCALE_COMMON_MAGIC, xscale_disable_mmu_caches(), xscale_enable_mmu_caches(), xscale_full_context(), xscale_get_ttb(), XSCALE_IXP4XX_PXA2XX, XSCALE_PXA3XX, xscale_read_core_reg(), xscale_read_memory(), XSCALE_TRACE_DISABLED, xscale_common::xscale_variant, xscale_write_core_reg(), and xscale_write_memory().

Referenced by xscale_target_create().

◆ xscale_init_target()

static int xscale_init_target ( struct command_context cmd_ctx,
struct target target 
)
static

Definition at line 2910 of file xscale.c.

References ERROR_OK, and xscale_build_reg_cache().

◆ xscale_invalidate_ic_line()

static int xscale_invalidate_ic_line ( struct target target,
uint32_t  va 
)
static

◆ xscale_jtag_set_instr()

◆ xscale_load_ic()

static int xscale_load_ic ( struct target target,
uint32_t  va,
uint32_t  buffer[8] 
)
static

◆ xscale_mmu()

static int xscale_mmu ( struct target target,
int *  enabled 
)
static

◆ xscale_poll()

◆ xscale_read_core_reg()

static int xscale_read_core_reg ( struct target target,
struct reg r,
int  num,
enum arm_mode  mode 
)
static
Todo:
add debug handler support for core register reads

Definition at line 1608 of file xscale.c.

References ERROR_OK, and LOG_ERROR.

Referenced by xscale_init_arch_info().

◆ xscale_read_dcsr()

◆ xscale_read_instruction()

◆ xscale_read_memory()

◆ xscale_read_phys_memory()

static int xscale_read_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)
static
Todo:
: provide a non-stub implementation of this routine.

Definition at line 1856 of file xscale.c.

References xscale_common::armv4_5_mmu, buffer, count, ERROR_FAIL, LOG_ERROR, armv4_5_mmu_common::mmu_enabled, size, target_name(), target_to_xscale(), and xscale_read_memory().

◆ xscale_read_trace()

◆ xscale_read_tx()

◆ xscale_receive()

◆ xscale_remove_breakpoint()

static int xscale_remove_breakpoint ( struct target target,
struct breakpoint breakpoint 
)
static

◆ xscale_remove_watchpoint()

static int xscale_remove_watchpoint ( struct target target,
struct watchpoint watchpoint 
)
static

◆ xscale_restore_banked()

◆ xscale_resume()

◆ xscale_send()

◆ xscale_send_u32()

◆ xscale_set_breakpoint()

◆ xscale_set_reg()

◆ xscale_set_reg_u32()

◆ xscale_set_watchpoint()

◆ xscale_step()

◆ xscale_step_inner()

◆ xscale_target_create()

static int xscale_target_create ( struct target target,
Jim_Interp *  interp 
)
static

◆ xscale_unset_breakpoint()

◆ xscale_unset_watchpoint()

◆ xscale_update_vectors()

◆ xscale_verify_pointer()

static int xscale_verify_pointer ( struct command_invocation cmd,
struct xscale_common xscale 
)
static

◆ xscale_virt2phys()

static int xscale_virt2phys ( struct target target,
target_addr_t  virtual,
target_addr_t physical 
)
static

◆ xscale_write_core_reg()

static int xscale_write_core_reg ( struct target target,
struct reg r,
int  num,
enum arm_mode  mode,
uint8_t *  value 
)
static
Todo:
add debug handler support for core register writes

Definition at line 1616 of file xscale.c.

References ERROR_OK, and LOG_ERROR.

Referenced by xscale_init_arch_info().

◆ xscale_write_dcsr()

◆ xscale_write_dcsr_sw()

static int xscale_write_dcsr_sw ( struct target target,
uint32_t  value 
)
static

◆ xscale_write_memory()

◆ xscale_write_phys_memory()

static int xscale_write_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)
static
Todo:
: provide a non-stub implementation of this routine.

Definition at line 1955 of file xscale.c.

References xscale_common::armv4_5_mmu, buffer, count, ERROR_FAIL, LOG_ERROR, armv4_5_mmu_common::mmu_enabled, size, target_name(), target_to_xscale(), and xscale_write_memory().

◆ xscale_write_rx()

Variable Documentation

◆ mask

unsigned mask

Definition at line 3218 of file xscale.c.

Referenced by COMMAND_HANDLER().

◆ name

char name[15]

Definition at line 3217 of file xscale.c.

Referenced by COMMAND_HANDLER().

◆ 

const { ... } vec_ids[]
Initial value:
= {
{ "fiq", DCSR_TF, },
{ "irq", DCSR_TI, },
{ "dabt", DCSR_TD, },
{ "pabt", DCSR_TA, },
{ "swi", DCSR_TS, },
{ "undef", DCSR_TU, },
{ "reset", DCSR_TR, },
}
#define DCSR_TD
Definition: xscale.h:171
#define DCSR_TS
Definition: xscale.h:169
#define DCSR_TF
Definition: xscale.h:173
#define DCSR_TA
Definition: xscale.h:170
#define DCSR_TR
Definition: xscale.h:167
#define DCSR_TI
Definition: xscale.h:172
#define DCSR_TU
Definition: xscale.h:168

Referenced by COMMAND_HANDLER().

◆ xscale_any_command_handlers

const struct command_registration xscale_any_command_handlers[]
static
Initial value:
= {
{
.name = "debug_handler",
.handler = xscale_handle_debug_handler_command,
.mode = COMMAND_ANY,
.help = "Change address used for debug handler.",
.usage = "<target> <address>",
},
{
.name = "cache_clean_address",
.handler = xscale_handle_cache_clean_address_command,
.mode = COMMAND_ANY,
.help = "Change address used for cleaning data cache.",
.usage = "address",
},
{
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_ANY
Definition: command.h:42
static const struct command_registration xscale_exec_command_handlers[]
Definition: xscale.c:3586

Definition at line 3506 of file xscale.c.

◆ xscale_command_handlers

const struct command_registration xscale_command_handlers[]
static
Initial value:
= {
{
},
{
.name = "xscale",
.mode = COMMAND_ANY,
.help = "xscale command group",
.usage = "",
},
}
const struct command_registration arm_command_handlers[]
Definition: armv4_5.c:1247
const char * name
Definition: command.h:235
static const struct command_registration xscale_any_command_handlers[]
Definition: xscale.c:3671

Definition at line 3506 of file xscale.c.

◆ xscale_debug_handler

const uint8_t xscale_debug_handler[]
static
Initial value:
= {
}

Definition at line 64 of file xscale.c.

Referenced by xscale_deassert_reset(), and xscale_target_create().

◆ xscale_exec_command_handlers

const struct command_registration xscale_exec_command_handlers[]
static

Definition at line 3506 of file xscale.c.

◆ xscale_not

const char xscale_not[] = "target is not an XScale"
static

Definition at line 128 of file xscale.c.

Referenced by xscale_verify_pointer(), and xscale_virt2phys().

◆ xscale_reg_arch_info

const struct xscale_reg xscale_reg_arch_info[]
static
Initial value:
= {
{-1, NULL},
{-1, NULL},
{-1, NULL},
}
#define NULL
Definition: usb.h:16
@ XSCALE_FSR
Definition: xscale.h:146
@ XSCALE_CHKPT1
Definition: xscale.h:157
@ XSCALE_IBCR1
Definition: xscale.h:151
@ XSCALE_FAR
Definition: xscale.h:147
@ XSCALE_DBCON
Definition: xscale.h:154
@ XSCALE_DAC
Definition: xscale.h:145
@ XSCALE_CTRL
Definition: xscale.h:142
@ XSCALE_TBREG
Definition: xscale.h:155
@ XSCALE_DBR1
Definition: xscale.h:153
@ XSCALE_CHKPT0
Definition: xscale.h:156
@ XSCALE_AUXCTRL
Definition: xscale.h:143
@ XSCALE_CPACCESS
Definition: xscale.h:149
@ XSCALE_MAINID
Definition: xscale.h:140
@ XSCALE_CACHETYPE
Definition: xscale.h:141
@ XSCALE_DBR0
Definition: xscale.h:152
@ XSCALE_TTB
Definition: xscale.h:144
@ XSCALE_IBCR0
Definition: xscale.h:150
@ XSCALE_PID
Definition: xscale.h:148
@ XSCALE_DCSR
Definition: xscale.h:158

Definition at line 68 of file xscale.c.

Referenced by xscale_build_reg_cache(), and xscale_free_reg_cache().

◆ xscale_reg_list

const char* const xscale_reg_list[]
static
Initial value:
= {
"XSCALE_MAINID",
"XSCALE_CACHETYPE",
"XSCALE_CTRL",
"XSCALE_AUXCTRL",
"XSCALE_TTB",
"XSCALE_DAC",
"XSCALE_FSR",
"XSCALE_FAR",
"XSCALE_PID",
"XSCALE_CPACCESS",
"XSCALE_IBCR0",
"XSCALE_IBCR1",
"XSCALE_DBR0",
"XSCALE_DBR1",
"XSCALE_DBCON",
"XSCALE_TBREG",
"XSCALE_CHKPT0",
"XSCALE_CHKPT1",
"XSCALE_DCSR",
"XSCALE_TX",
"XSCALE_RX",
"XSCALE_TXRXCTRL",
}

Definition at line 68 of file xscale.c.

Referenced by xscale_build_reg_cache().

◆ xscale_reg_type

const struct reg_arch_type xscale_reg_type
static
Initial value:
= {
}
static int xscale_set_reg(struct reg *reg, uint8_t *buf)
Definition: xscale.c:2423
static int xscale_get_reg(struct reg *reg)
Definition: xscale.c:2387

Definition at line 2655 of file xscale.c.

Referenced by xscale_build_reg_cache().

◆ xscale_target

struct target_type xscale_target

Definition at line 3506 of file xscale.c.