X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftarget%2Farm_adi_v5.h;h=ad2ba5f230e5120d4fa14845c04465f288341acf;hb=86173cdbddde781b19ac630602f2d450a59b32b5;hp=99e557570664cb9921a8e787447dcd79230b2145;hpb=a644bc11a56b32b68688ebc65b56f5d166ab2e2d;p=fw%2Fopenocd diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 99e557570..ad2ba5f23 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -27,8 +27,8 @@ #include "register.h" #include "arm_jtag.h" -#define SWJDP_IR_DPACC 0xA -#define SWJDP_IR_APACC 0xB +#define DAP_IR_DPACC 0xA +#define DAP_IR_APACC 0xB #define DPAP_WRITE 0 #define DPAP_READ 1 @@ -94,22 +94,33 @@ typedef struct swjdp_common_s u32 ap_csw_value; u32 ap_tar_value; /* information about current pending SWjDP-AHBAP transaction */ - u8 trans_mode; - u8 trans_rw; - u8 ack; + uint8_t trans_mode; + uint8_t trans_rw; + uint8_t ack; + /* extra tck clocks for memory bus access */ + u32 memaccess_tck; + /* Size of TAR autoincrement block, ARM ADI Specification requires at least 10 bits */ + u32 tar_autoincr_block; + } swjdp_common_t; +/* Accessor function for currently selected DAP-AP number */ +static inline uint8_t dap_ap_get_select(swjdp_common_t *swjdp) +{ + return (uint8_t)( swjdp ->apsel >> 24); +} + /* Internal functions used in the module, partial transactions, use with caution */ -extern int dap_dp_write_reg(swjdp_common_t *swjdp, u32 value, u8 reg_addr); -/* extern int swjdp_write_apacc(swjdp_common_t *swjdp, u32 value, u8 reg_addr); */ -extern int dap_dp_read_reg(swjdp_common_t *swjdp, u32 *value, u8 reg_addr); -/* extern int swjdp_read_apacc(swjdp_common_t *swjdp, u32 *value, u8 reg_addr); */ +extern int dap_dp_write_reg(swjdp_common_t *swjdp, u32 value, uint8_t reg_addr); +/* extern int swjdp_write_apacc(swjdp_common_t *swjdp, u32 value, uint8_t reg_addr); */ +extern int dap_dp_read_reg(swjdp_common_t *swjdp, u32 *value, uint8_t reg_addr); +/* extern int swjdp_read_apacc(swjdp_common_t *swjdp, u32 *value, uint8_t reg_addr); */ extern int dap_setup_accessport(swjdp_common_t *swjdp, u32 csw, u32 tar); -extern int dap_ap_select(swjdp_common_t *swjdp,u8 apsel); +extern int dap_ap_select(swjdp_common_t *swjdp,uint8_t apsel); -extern int dap_ap_write_reg(swjdp_common_t *swjdp, u32 reg_addr, u8* out_value_buf); +extern int dap_ap_write_reg(swjdp_common_t *swjdp, u32 reg_addr, uint8_t* out_value_buf); extern int dap_ap_write_reg_u32(swjdp_common_t *swjdp, u32 reg_addr, u32 value); -extern int dap_ap_read_reg(swjdp_common_t *swjdp, u32 reg_addr, u8 *in_value_buf); +extern int dap_ap_read_reg(swjdp_common_t *swjdp, u32 reg_addr, uint8_t *in_value_buf); extern int dap_ap_read_reg_u32(swjdp_common_t *swjdp, u32 reg_addr, u32 *value); /* External interface, partial operations must be completed with swjdp_transaction_endcheck() */ @@ -124,12 +135,12 @@ extern int mem_ap_read_atomic_u32(swjdp_common_t *swjdp, u32 address, u32 *value extern int mem_ap_write_atomic_u32(swjdp_common_t *swjdp, u32 address, u32 value); /* MEM-AP memory mapped bus block transfers */ -extern int mem_ap_read_buf_u8(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); -extern int mem_ap_read_buf_u16(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); -extern int mem_ap_read_buf_u32(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); -extern int mem_ap_write_buf_u8(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); -extern int mem_ap_write_buf_u16(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); -extern int mem_ap_write_buf_u32(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address); +extern int mem_ap_read_buf_u8(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); +extern int mem_ap_read_buf_u16(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); +extern int mem_ap_read_buf_u32(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); +extern int mem_ap_write_buf_u8(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); +extern int mem_ap_write_buf_u16(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); +extern int mem_ap_write_buf_u32(swjdp_common_t *swjdp, uint8_t *buffer, int count, u32 address); /* Initialisation of the debug system, power domains and registers */ extern int ahbap_debugport_init(swjdp_common_t *swjdp); @@ -141,4 +152,6 @@ extern int handle_dap_info_command(struct command_context_s *cmd_ctx, char *cmd, extern int handle_dap_apsel_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); extern int handle_dap_apid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); extern int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +extern int handle_dap_memaccess_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); + #endif