OpenOCD
nds32.h File Reference

Holds the interface to Andes cores. More...

Include dependency graph for nds32.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nds32
 Represents a generic Andes core. More...
 
struct  nds32_cache
 
struct  nds32_cpu_version
 
struct  nds32_edm
 
struct  nds32_edm_operation
 
struct  nds32_memory
 
struct  nds32_misc_config
 
struct  nds32_mmu_config
 
struct  nds32_reg
 

Macros

#define CHECK_RETVAL(action)
 
#define NDS32_COMMON_MAGIC   0xADE5ADE5U
 
#define NDS32_EDM_OPERATION_MAX_NUM   64
 
#define NDS32_STRUCT_STAT_SIZE   60
 
#define NDS32_STRUCT_TIMEVAL_SIZE   8
 

Enumerations

enum  nds32_debug_reason {
  NDS32_DEBUG_BREAK = 0 , NDS32_DEBUG_BREAK_16 , NDS32_DEBUG_INST_BREAK , NDS32_DEBUG_DATA_ADDR_WATCHPOINT_PRECISE ,
  NDS32_DEBUG_DATA_VALUE_WATCHPOINT_PRECISE , NDS32_DEBUG_DATA_VALUE_WATCHPOINT_IMPRECISE , NDS32_DEBUG_DEBUG_INTERRUPT , NDS32_DEBUG_HARDWARE_SINGLE_STEP ,
  NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE , NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE , NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP
}
 
enum  nds32_syscall_id {
  NDS32_SYSCALL_UNDEFINED = 0 , NDS32_SYSCALL_EXIT = 1 , NDS32_SYSCALL_OPEN = 2 , NDS32_SYSCALL_CLOSE = 3 ,
  NDS32_SYSCALL_READ = 4 , NDS32_SYSCALL_WRITE = 5 , NDS32_SYSCALL_LSEEK = 6 , NDS32_SYSCALL_UNLINK = 7 ,
  NDS32_SYSCALL_RENAME = 3001 , NDS32_SYSCALL_FSTAT = 10 , NDS32_SYSCALL_STAT = 15 , NDS32_SYSCALL_GETTIMEOFDAY = 19 ,
  NDS32_SYSCALL_ISATTY = 3002 , NDS32_SYSCALL_SYSTEM = 3003 , NDS32_SYSCALL_ERRNO = 6001
}
 

Functions

static bool is_nds32 (struct nds32 *nds32)
 
int nds32_add_software_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
int nds32_arch_state (struct target *target)
 
int nds32_assert_reset (struct target *target)
 
int nds32_cache_sync (struct target *target, target_addr_t address, uint32_t length)
 
int nds32_config (struct nds32 *nds32)
 
int nds32_edm_config (struct nds32 *nds32)
 
int nds32_examine_debug_reason (struct nds32 *nds32)
 
int nds32_full_context (struct nds32 *nds32)
 
int nds32_gdb_fileio_end (struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 
int nds32_gdb_fileio_write_memory (struct nds32 *nds32, uint32_t address, uint32_t size, const uint8_t *buffer)
 
int nds32_get_gdb_fileio_info (struct target *target, struct gdb_fileio_info *fileio_info)
 
int nds32_get_gdb_reg_list (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 get all register list More...
 
int nds32_get_mapped_reg (struct nds32 *nds32, unsigned regnum, uint32_t *value)
 
int nds32_halt (struct target *target)
 
int nds32_init (struct nds32 *nds32)
 
int nds32_init_arch_info (struct target *target, struct nds32 *nds32)
 
int nds32_init_memory_info (struct nds32 *nds32)
 
int nds32_init_register_table (struct nds32 *nds32)
 
int nds32_login (struct nds32 *nds32)
 
int nds32_mmu (struct target *target, int *enabled)
 
uint32_t nds32_nextpc (struct nds32 *nds32, int current, uint32_t address)
 
int nds32_poll (struct target *target)
 
int nds32_profiling (struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 
static bool nds32_reach_max_interrupt_level (struct nds32 *nds32)
 
int nds32_read_buffer (struct target *target, uint32_t address, uint32_t size, uint8_t *buffer)
 
int nds32_read_memory (struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
int nds32_read_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
int nds32_remove_software_breakpoint (struct target *target, struct breakpoint *breakpoint)
 
int nds32_reset_halt (struct nds32 *nds32)
 
int nds32_restore_context (struct target *target)
 Restore the processor context on an Andes target. More...
 
int nds32_resume (struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
int nds32_set_mapped_reg (struct nds32 *nds32, unsigned regnum, uint32_t value)
 set register internally More...
 
int nds32_step (struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
int nds32_target_state (struct nds32 *nds32, enum target_state *state)
 
int nds32_virtual_to_physical (struct target *target, target_addr_t address, target_addr_t *physical)
 
int nds32_write_buffer (struct target *target, uint32_t address, uint32_t size, const uint8_t *buffer)
 
int nds32_write_memory (struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
int nds32_write_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
static struct aice_port_starget_to_aice (struct target *target)
 
static struct nds32target_to_nds32 (struct target *target)
 Convert target handle to generic Andes target state handle. More...
 

Variables

const char * nds32_debug_type_name [11]
 

Detailed Description

Holds the interface to Andes cores.

Definition in file nds32.h.

Macro Definition Documentation

◆ CHECK_RETVAL

#define CHECK_RETVAL (   action)
Value:
do { \
int __retval = (action); \
if (__retval != ERROR_OK) { \
LOG_DEBUG("error while calling \"%s\"", \
# action); \
return __retval; \
} \
} while (0)
#define ERROR_OK
Definition: log.h:155

Definition at line 22 of file nds32.h.

◆ NDS32_COMMON_MAGIC

#define NDS32_COMMON_MAGIC   0xADE5ADE5U

Definition at line 74 of file nds32.h.

◆ NDS32_EDM_OPERATION_MAX_NUM

#define NDS32_EDM_OPERATION_MAX_NUM   64

Definition at line 20 of file nds32.h.

◆ NDS32_STRUCT_STAT_SIZE

#define NDS32_STRUCT_STAT_SIZE   60

Definition at line 53 of file nds32.h.

◆ NDS32_STRUCT_TIMEVAL_SIZE

#define NDS32_STRUCT_TIMEVAL_SIZE   8

Definition at line 54 of file nds32.h.

Enumeration Type Documentation

◆ nds32_debug_reason

Enumerator
NDS32_DEBUG_BREAK 
NDS32_DEBUG_BREAK_16 
NDS32_DEBUG_INST_BREAK 
NDS32_DEBUG_DATA_ADDR_WATCHPOINT_PRECISE 
NDS32_DEBUG_DATA_VALUE_WATCHPOINT_PRECISE 
NDS32_DEBUG_DATA_VALUE_WATCHPOINT_IMPRECISE 
NDS32_DEBUG_DEBUG_INTERRUPT 
NDS32_DEBUG_HARDWARE_SINGLE_STEP 
NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE 
NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE 
NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP 

Definition at line 39 of file nds32.h.

◆ nds32_syscall_id

Enumerator
NDS32_SYSCALL_UNDEFINED 
NDS32_SYSCALL_EXIT 
NDS32_SYSCALL_OPEN 
NDS32_SYSCALL_CLOSE 
NDS32_SYSCALL_READ 
NDS32_SYSCALL_WRITE 
NDS32_SYSCALL_LSEEK 
NDS32_SYSCALL_UNLINK 
NDS32_SYSCALL_RENAME 
NDS32_SYSCALL_FSTAT 
NDS32_SYSCALL_STAT 
NDS32_SYSCALL_GETTIMEOFDAY 
NDS32_SYSCALL_ISATTY 
NDS32_SYSCALL_SYSTEM 
NDS32_SYSCALL_ERRNO 

Definition at line 56 of file nds32.h.

Function Documentation

◆ is_nds32()

static bool is_nds32 ( struct nds32 nds32)
inlinestatic

Definition at line 435 of file nds32.h.

References nds32::common_magic, and NDS32_COMMON_MAGIC.

Referenced by COMMAND_HANDLER().

◆ nds32_add_software_breakpoint()

◆ nds32_arch_state()

◆ nds32_assert_reset()

◆ nds32_cache_sync()

◆ nds32_config()

◆ nds32_edm_config()

◆ nds32_examine_debug_reason()

◆ nds32_full_context()

◆ nds32_gdb_fileio_end()

int nds32_gdb_fileio_end ( struct target target,
int  retcode,
int  fileio_errno,
bool  ctrl_c 
)

◆ nds32_gdb_fileio_write_memory()

int nds32_gdb_fileio_write_memory ( struct nds32 nds32,
uint32_t  address,
uint32_t  size,
const uint8_t *  buffer 
)

◆ nds32_get_gdb_fileio_info()

◆ nds32_get_gdb_reg_list()

int nds32_get_gdb_reg_list ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)

get all register list

Definition at line 596 of file nds32.c.

References ERROR_FAIL, nds32_get_all_reg_list(), nds32_get_general_reg_list(), REG_CLASS_ALL, REG_CLASS_GENERAL, and target_to_nds32().

◆ nds32_get_mapped_reg()

◆ nds32_halt()

◆ nds32_init()

◆ nds32_init_arch_info()

◆ nds32_init_memory_info()

int nds32_init_memory_info ( struct nds32 nds32)

◆ nds32_init_register_table()

int nds32_init_register_table ( struct nds32 nds32)

Definition at line 1424 of file nds32.c.

References ERROR_OK, and nds32_init_must_have_registers().

Referenced by nds32_init_arch_info().

◆ nds32_login()

◆ nds32_mmu()

◆ nds32_nextpc()

uint32_t nds32_nextpc ( struct nds32 nds32,
int  current,
uint32_t  address 
)

Definition at line 1740 of file nds32.c.

References nds32_get_mapped_reg(), nds32_set_mapped_reg(), and PC.

Referenced by nds32_resume(), and nds32_step().

◆ nds32_poll()

◆ nds32_profiling()

int nds32_profiling ( struct target target,
uint32_t *  samples,
uint32_t  max_num_samples,
uint32_t *  num_samples,
uint32_t  seconds 
)

◆ nds32_reach_max_interrupt_level()

static bool nds32_reach_max_interrupt_level ( struct nds32 nds32)
inlinestatic

◆ nds32_read_buffer()

◆ nds32_read_memory()

int nds32_read_memory ( struct target target,
uint32_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)

Definition at line 804 of file nds32.c.

References aice_read_mem_unit(), buffer, count, size, and target_to_aice().

Referenced by nds32_v2_read_memory(), and nds32_v3_read_memory().

◆ nds32_read_phys_memory()

int nds32_read_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)

◆ nds32_remove_software_breakpoint()

◆ nds32_reset_halt()

int nds32_reset_halt ( struct nds32 nds32)

◆ nds32_restore_context()

int nds32_restore_context ( struct target target)

Restore the processor context on an Andes target.

The full processor context is analyzed to see if any of the registers are dirty on this end, but have a valid new value. If this is the case, the processor is changed to the appropriate mode and the new register values are written out to the processor. If there happens to be a dirty register with an invalid value, an error will be logged.

Parameters
targetPointer to the Andes target to have its context restored
Returns
Error status if the target is not halted.

Definition at line 1510 of file nds32.c.

References aice_write_reg_64(), aice_write_register(), reg::arch_info, buf_get_u32(), buf_get_u64(), nds32::core_cache, reg::dirty, ERROR_OK, ERROR_TARGET_NOT_HALTED, FD0, FD31, LOG_DEBUG, LOG_WARNING, reg::name, nds32_reg::num, reg_cache::num_regs, reg_cache::reg_list, target::state, TARGET_HALTED, target_to_aice(), target_to_nds32(), reg::valid, nds32_reg::value, and reg::value.

Referenced by nds32_v2_leave_debug_state(), and nds32_v3_leave_debug_state().

◆ nds32_resume()

◆ nds32_set_mapped_reg()

◆ nds32_step()

◆ nds32_target_state()

◆ nds32_virtual_to_physical()

int nds32_virtual_to_physical ( struct target target,
target_addr_t  address,
target_addr_t physical 
)

◆ nds32_write_buffer()

◆ nds32_write_memory()

int nds32_write_memory ( struct target target,
uint32_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)

Definition at line 913 of file nds32.c.

References aice_write_mem_unit(), buffer, count, size, and target_to_aice().

Referenced by nds32_v3_write_memory().

◆ nds32_write_phys_memory()

int nds32_write_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)

◆ target_to_aice()

static struct aice_port_s* target_to_aice ( struct target target)
inlinestatic

Definition at line 429 of file nds32.h.

References jtag_tap::priv, and target::tap.

Referenced by COMMAND_HANDLER(), jim_nds32_multi_write(), jim_nds32_read_edm_sr(), jim_nds32_write_edm_sr(), nds32_assert_reset(), nds32_cache_sync(), nds32_edm_config(), nds32_gdb_attach(), nds32_gdb_detach(), nds32_get_core_reg(), nds32_get_core_reg_64(), nds32_halt(), nds32_login(), nds32_poll(), nds32_probe_tlb(), nds32_profiling(), nds32_read_buffer(), nds32_read_memory(), nds32_read_phys_memory(), nds32_reset_halt(), nds32_restore_context(), nds32_resume(), nds32_select_memory_mode(), nds32_set_core_reg(), nds32_soft_reset_halt(), nds32_step(), nds32_step_without_watchpoint(), nds32_target_state(), nds32_update_psw(), nds32_v2_activate_hardware_breakpoint(), nds32_v2_activate_hardware_watchpoint(), nds32_v2_check_interrupt_stack(), nds32_v2_deactivate_hardware_breakpoint(), nds32_v2_deactivate_hardware_watchpoint(), nds32_v2_examine(), nds32_v2_get_debug_reason(), nds32_v2_get_exception_address(), nds32_v2_restore_interrupt_stack(), nds32_v3_activate_hardware_breakpoint(), nds32_v3_activate_hardware_watchpoint(), nds32_v3_deactivate_hardware_breakpoint(), nds32_v3_deactivate_hardware_watchpoint(), nds32_v3_deassert_reset(), nds32_v3_examine(), nds32_v3_get_debug_reason(), nds32_v3_get_exception_address(), nds32_v3_leave_debug_state(), nds32_v3_read_buffer(), nds32_v3_read_memory(), nds32_v3_write_buffer(), nds32_v3m_activate_hardware_breakpoint(), nds32_v3m_activate_hardware_watchpoint(), nds32_v3m_deactivate_hardware_breakpoint(), nds32_v3m_deactivate_hardware_watchpoint(), nds32_v3m_examine(), nds32_write_buffer(), nds32_write_memory(), and nds32_write_phys_memory().

◆ target_to_nds32()

Variable Documentation

◆ nds32_debug_type_name

const char* nds32_debug_type_name[11]
extern

Definition at line 22 of file nds32.c.

Referenced by nds32_examine_debug_reason().