X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Ftarget%2Fdsp563xx.c;h=9563eea98b719cad44edda17b35037dde5d95ff1;hb=4cc359794420dbe0aedba38bde0ee4d871cdb354;hp=9e2f6093986cead169e5124470ff74ad5f156170;hpb=85a4136d0baccf5c3b8f717710584f7faed0ca30;p=openocd.git diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c index 9e2f609398..9563eea98b 100644 --- a/src/target/dsp563xx.c +++ b/src/target/dsp563xx.c @@ -21,7 +21,7 @@ #include "config.h" #endif -#include +#include #include "target.h" #include "target_type.h" @@ -46,30 +46,11 @@ #define JTAG_INSTR_BYPASS 0x0F /* forward declarations */ -int dsp563xx_target_create(struct target *target, Jim_Interp * interp); -int dsp563xx_init_target(struct command_context *cmd_ctx, struct target *target); - -int dsp563xx_arch_state(struct target *target); -int dsp563xx_poll(struct target *target); -int dsp563xx_halt(struct target *target); -int dsp563xx_resume(struct target *target, int current, uint32_t address, - int handle_breakpoints, int debug_execution); -int dsp563xx_step(struct target *target, int current, uint32_t address, - int handle_breakpoints); - -int dsp563xx_assert_reset(struct target *target); -int dsp563xx_deassert_reset(struct target *target); -int dsp563xx_soft_reset_halt(struct target *target); +static int dsp563xx_write_ir_u8(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out, + int ir_len, int rti); /* IR and DR functions */ -int dsp563xx_jtag_sendinstr(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out); -int dsp563xx_jtag_senddat(struct jtag_tap *tap, uint32_t * dr_in, uint32_t dr_out, - int len); - -int dsp563xx_read_memory_p(struct target *target, uint32_t address, uint32_t size, - uint32_t count, uint8_t * buffer); -int dsp563xx_write_memory_p(struct target *target, uint32_t address, uint32_t size, - uint32_t count, uint8_t * buffer); +static int dsp563xx_jtag_sendinstr(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out); #define ASM_REG_R_R0 0x607000 #define ASM_REG_R_R1 0x617000 @@ -246,7 +227,30 @@ static const struct /* *INDENT-ON* */ }; -int dsp563xx_read_core_reg(struct target *target, int num) +static int dsp563xx_get_gdb_reg_list(struct target *target, struct reg **reg_list[], + int *reg_list_size) +{ + struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); + int i; + + if (target->state != TARGET_HALTED) + { + return ERROR_TARGET_NOT_HALTED; + } + + *reg_list_size = DSP563XX_NUMCOREREGS; + *reg_list = malloc(sizeof(struct reg *) * (*reg_list_size)); + + for (i = 0; i < DSP563XX_NUMCOREREGS; i++) + { + (*reg_list)[i] = &dsp563xx->core_cache->reg_list[i]; + } + + return ERROR_OK; + +} + +static int dsp563xx_read_core_reg(struct target *target, int num) { uint32_t reg_value; struct dsp563xx_core_reg *dsp563xx_core_reg; @@ -264,7 +268,7 @@ int dsp563xx_read_core_reg(struct target *target, int num) return ERROR_OK; } -int dsp563xx_write_core_reg(struct target *target, int num) +static int dsp563xx_write_core_reg(struct target *target, int num) { uint32_t reg_value; struct dsp563xx_core_reg *dsp563xx_core_reg; @@ -282,7 +286,7 @@ int dsp563xx_write_core_reg(struct target *target, int num) return ERROR_OK; } -int dsp563xx_target_create(struct target *target, Jim_Interp * interp) +static int dsp563xx_target_create(struct target *target, Jim_Interp * interp) { struct dsp563xx_common *dsp563xx = calloc(1, sizeof(struct dsp563xx_common)); @@ -294,7 +298,7 @@ int dsp563xx_target_create(struct target *target, Jim_Interp * interp) return ERROR_OK; } -int dsp563xx_get_core_reg(struct reg *reg) +static int dsp563xx_get_core_reg(struct reg *reg) { int retval = 0; @@ -314,7 +318,7 @@ int dsp563xx_get_core_reg(struct reg *reg) return retval; } -int dsp563xx_set_core_reg(struct reg *reg, uint8_t * buf) +static int dsp563xx_set_core_reg(struct reg *reg, uint8_t * buf) { LOG_DEBUG("%s", __FUNCTION__); @@ -334,7 +338,7 @@ int dsp563xx_set_core_reg(struct reg *reg, uint8_t * buf) return ERROR_OK; } -int dsp563xx_save_context(struct target *target) +static int dsp563xx_save_context(struct target *target) { int i; uint32_t data = 0; @@ -365,7 +369,7 @@ int dsp563xx_save_context(struct target *target) return ERROR_OK; } -int dsp563xx_restore_context(struct target *target) +static int dsp563xx_restore_context(struct target *target) { int i; struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); @@ -393,7 +397,7 @@ static const struct reg_arch_type dsp563xx_reg_type = { .set = dsp563xx_set_core_reg, }; -int dsp563xx_init_target(struct command_context *cmd_ctx, struct target *target) +static int dsp563xx_init_target(struct command_context *cmd_ctx, struct target *target) { /* get pointers to arch-specific information */ struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); @@ -436,13 +440,13 @@ int dsp563xx_init_target(struct command_context *cmd_ctx, struct target *target) return ERROR_OK; } -int dsp563xx_arch_state(struct target *target) +static int dsp563xx_arch_state(struct target *target) { LOG_DEBUG("%s", __FUNCTION__); return ERROR_OK; } -int dsp563xx_jtag_status(struct target *target, uint8_t * status) +static int dsp563xx_jtag_status(struct target *target, uint8_t * status) { uint8_t ir_in; @@ -456,7 +460,7 @@ int dsp563xx_jtag_status(struct target *target, uint8_t * status) return ERROR_OK; } -int dsp563xx_jtag_debug_request(struct target *target) +static int dsp563xx_jtag_debug_request(struct target *target) { uint8_t ir_in = 0; uint32_t retry = 0; @@ -483,7 +487,7 @@ int dsp563xx_jtag_debug_request(struct target *target) return ERROR_OK; } -int dsp563xx_poll(struct target *target) +static int dsp563xx_poll(struct target *target) { uint8_t jtag_status; uint32_t once_status; @@ -514,7 +518,7 @@ int dsp563xx_poll(struct target *target) return ERROR_OK; } -int dsp563xx_halt(struct target *target) +static int dsp563xx_halt(struct target *target) { uint8_t jtag_status; uint32_t once_status; @@ -559,7 +563,7 @@ int dsp563xx_halt(struct target *target) #define DSP563XX_ASM_CMD_JUMP 0x0AF080 -int dsp563xx_resume(struct target *target, int current, uint32_t address, +static int dsp563xx_resume(struct target *target, int current, uint32_t address, int handle_breakpoints, int debug_execution) { struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); @@ -593,7 +597,7 @@ int dsp563xx_resume(struct target *target, int current, uint32_t address, return ERROR_OK; } -int dsp563xx_step(struct target *target, int current, uint32_t address, +static int dsp563xx_step(struct target *target, int current, uint32_t address, int handle_breakpoints) { uint32_t once_status; @@ -685,7 +689,7 @@ int dsp563xx_step(struct target *target, int current, uint32_t address, return ERROR_OK; } -int dsp563xx_assert_reset(struct target *target) +static int dsp563xx_assert_reset(struct target *target) { target->state = TARGET_RESET; @@ -693,7 +697,7 @@ int dsp563xx_assert_reset(struct target *target) return ERROR_OK; } -int dsp563xx_deassert_reset(struct target *target) +static int dsp563xx_deassert_reset(struct target *target) { target->state = TARGET_RUNNING; @@ -701,7 +705,7 @@ int dsp563xx_deassert_reset(struct target *target) return ERROR_OK; } -int dsp563xx_soft_reset_halt(struct target *target) +static int dsp563xx_soft_reset_halt(struct target *target) { LOG_DEBUG("%s", __FUNCTION__); return ERROR_OK; @@ -729,7 +733,7 @@ int dsp563xx_soft_reset_halt(struct target *target) * 076190 movem r0,p:(r1) * */ -int dsp563xx_read_memory_p(struct target *target, uint32_t address, +static int dsp563xx_read_memory_p(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t * buffer) { uint32_t i, x; @@ -770,7 +774,7 @@ int dsp563xx_read_memory_p(struct target *target, uint32_t address, return ERROR_OK; } -int dsp563xx_write_memory_p(struct target *target, uint32_t address, uint32_t size, +static int dsp563xx_write_memory_p(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t * buffer) { uint32_t i, x; @@ -813,19 +817,13 @@ int dsp563xx_write_memory_p(struct target *target, uint32_t address, uint32_t si return ERROR_OK; } -int dsp563xx_jtag_senddat(struct jtag_tap *tap, uint32_t * dr_in, uint32_t dr_out, - int len) -{ - return dsp563xx_write_dr_u32(tap, dr_in, dr_out, len, 1); -} - -int dsp563xx_jtag_sendinstr(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out) +static int dsp563xx_jtag_sendinstr(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out) { return dsp563xx_write_ir_u8(tap, ir_in, ir_out, DSP563XX_JTAG_INS_LEN, 1); } /* IR and DR functions */ -int dsp563xx_write_ir(struct jtag_tap *tap, uint8_t * ir_in, uint8_t * ir_out, +static int dsp563xx_write_ir(struct jtag_tap *tap, uint8_t * ir_in, uint8_t * ir_out, int ir_len, int rti) { if (NULL == tap) @@ -840,20 +838,13 @@ int dsp563xx_write_ir(struct jtag_tap *tap, uint8_t * ir_in, uint8_t * ir_out, } { - struct scan_field field[1]; - - field[0].tap = tap; - field[0].num_bits = tap->ir_length; - field[0].out_value = ir_out; - field[0].in_value = ir_in; - jtag_add_plain_ir_scan(ARRAY_SIZE(field), field, - jtag_set_end_state(TAP_IDLE)); + jtag_add_plain_ir_scan(tap->ir_length, ir_out, ir_in, TAP_IDLE); } return ERROR_OK; } -int dsp563xx_write_dr(struct jtag_tap *tap, uint8_t * dr_in, uint8_t * dr_out, +static int dsp563xx_write_dr(struct jtag_tap *tap, uint8_t * dr_in, uint8_t * dr_out, int dr_len, int rti) { if (NULL == tap) @@ -863,20 +854,13 @@ int dsp563xx_write_dr(struct jtag_tap *tap, uint8_t * dr_in, uint8_t * dr_out, } { - struct scan_field field[1]; - - field[0].tap = tap; - field[0].num_bits = dr_len; - field[0].out_value = dr_out; - field[0].in_value = dr_in; - jtag_add_plain_dr_scan(ARRAY_SIZE(field), field, - jtag_set_end_state(TAP_IDLE)); + jtag_add_plain_dr_scan(dr_len, dr_out, dr_in, TAP_IDLE); } return ERROR_OK; } -int dsp563xx_write_ir_u8(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out, +static int dsp563xx_write_ir_u8(struct jtag_tap *tap, uint8_t * ir_in, uint8_t ir_out, int ir_len, int rti) { if (ir_len > 8) @@ -904,48 +888,6 @@ int dsp563xx_write_dr_u8(struct jtag_tap *tap, uint8_t * dr_in, uint8_t dr_out, return ERROR_OK; } -int dsp563xx_write_ir_u16(struct jtag_tap *tap, uint16_t * ir_in, uint16_t ir_out, - int ir_len, int rti) -{ - if (ir_len > 16) - { - LOG_ERROR("ir_len overflow, maxium is 16"); - return ERROR_FAIL; - } - - dsp563xx_write_ir(tap, (uint8_t *) ir_in, (uint8_t *) & ir_out, ir_len, rti); - - return ERROR_OK; -} - -int dsp563xx_write_dr_u16(struct jtag_tap *tap, uint16_t * dr_in, uint16_t dr_out, - int dr_len, int rti) -{ - if (dr_len > 16) - { - LOG_ERROR("dr_len overflow, maxium is 16"); - return ERROR_FAIL; - } - - dsp563xx_write_dr(tap, (uint8_t *) dr_in, (uint8_t *) & dr_out, dr_len, rti); - - return ERROR_OK; -} - -int dsp563xx_write_ir_u32(struct jtag_tap *tap, uint32_t * ir_in, uint32_t ir_out, - int ir_len, int rti) -{ - if (ir_len > 32) - { - LOG_ERROR("ir_len overflow, maxium is 32"); - return ERROR_FAIL; - } - - dsp563xx_write_ir(tap, (uint8_t *) ir_in, (uint8_t *) & ir_out, ir_len, rti); - - return ERROR_OK; -} - int dsp563xx_write_dr_u32(struct jtag_tap *tap, uint32_t * dr_in, uint32_t dr_out, int dr_len, int rti) { @@ -974,6 +916,8 @@ struct target_type dsp563xx_target = { .target_request_data = NULL, + .get_gdb_reg_list = dsp563xx_get_gdb_reg_list, + .halt = dsp563xx_halt, .resume = dsp563xx_resume, .step = dsp563xx_step,