watchpoint_t -> struct watchpoint
[fw/openocd] / src / target / xscale.c
index 0dc18f0baf2503454692b4b6e7003bc96224ddcc..a04bf429541906032d4fb23d7762b5b61faae073 100644 (file)
@@ -64,7 +64,7 @@ static int xscale_restore_context(target_t *);
 static int xscale_get_reg(reg_t *reg);
 static int xscale_set_reg(reg_t *reg, uint8_t *buf);
 static int xscale_set_breakpoint(struct target_s *, breakpoint_t *);
-static int xscale_set_watchpoint(struct target_s *, watchpoint_t *);
+static int xscale_set_watchpoint(struct target_s *, struct watchpoint *);
 static int xscale_unset_breakpoint(struct target_s *, breakpoint_t *);
 static int xscale_read_trace(target_t *);
 
@@ -156,14 +156,14 @@ static int xscale_verify_pointer(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int xscale_jtag_set_instr(jtag_tap_t *tap, uint32_t new_instr)
+static int xscale_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr)
 {
        if (tap == NULL)
                return ERROR_FAIL;
 
        if (buf_get_u32(tap->cur_instr, 0, tap->ir_length) != new_instr)
        {
-               scan_field_t field;
+               struct scan_field field;
                uint8_t scratch[4];
 
                memset(&field, 0, sizeof field);
@@ -182,7 +182,7 @@ static int xscale_read_dcsr(target_t *target)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
        int retval;
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0 = 0x0;
        uint8_t field0_check_value = 0x2;
        uint8_t field0_check_mask = 0x7;
@@ -258,7 +258,7 @@ static int xscale_receive(target_t *target, uint32_t *buffer, int num_words)
 
        int retval = ERROR_OK;
        tap_state_t path[3];
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t *field0 = malloc(num_words * 1);
        uint8_t field0_check_value = 0x2;
        uint8_t field0_check_mask = 0x6;
@@ -362,7 +362,7 @@ static int xscale_read_tx(target_t *target, int consume)
        tap_state_t noconsume_path[6];
        int retval;
        struct timeval timeout, now;
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0_in = 0x0;
        uint8_t field0_check_value = 0x2;
        uint8_t field0_check_mask = 0x6;
@@ -458,7 +458,7 @@ static int xscale_write_rx(target_t *target)
        struct xscale_common_s *xscale = target_to_xscale(target);
        int retval;
        struct timeval timeout, now;
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0_out = 0x0;
        uint8_t field0_in = 0x0;
        uint8_t field0_check_value = 0x2;
@@ -614,7 +614,7 @@ static int xscale_write_dcsr(target_t *target, int hold_rst, int ext_dbg_brk)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
        int retval;
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0 = 0x0;
        uint8_t field0_check_value = 0x2;
        uint8_t field0_check_mask = 0x7;
@@ -686,7 +686,7 @@ static int xscale_load_ic(target_t *target, uint32_t va, uint32_t buffer[8])
        uint8_t packet[4];
        uint8_t cmd;
        int word;
-       scan_field_t fields[2];
+       struct scan_field fields[2];
 
        LOG_DEBUG("loading miniIC at 0x%8.8" PRIx32 "", va);
 
@@ -740,7 +740,7 @@ static int xscale_invalidate_ic_line(target_t *target, uint32_t va)
 {
        uint8_t packet[4];
        uint8_t cmd;
-       scan_field_t fields[2];
+       struct scan_field fields[2];
 
        jtag_set_end_state(TAP_IDLE);
        xscale_jtag_set_instr(target->tap, XSCALE_LDIC);
@@ -1163,7 +1163,7 @@ static int xscale_disable_single_step(struct target_s *target)
 
 static void xscale_enable_watchpoints(struct target_s *target)
 {
-       watchpoint_t *watchpoint = target->watchpoints;
+       struct watchpoint *watchpoint = target->watchpoints;
 
        while (watchpoint)
        {
@@ -2226,7 +2226,7 @@ static int xscale_remove_breakpoint(struct target_s *target, breakpoint_t *break
 }
 
 static int xscale_set_watchpoint(struct target_s *target,
-               watchpoint_t *watchpoint)
+               struct watchpoint *watchpoint)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
        uint8_t enable = 0;
@@ -2282,7 +2282,7 @@ static int xscale_set_watchpoint(struct target_s *target,
 }
 
 static int xscale_add_watchpoint(struct target_s *target,
-               watchpoint_t *watchpoint)
+               struct watchpoint *watchpoint)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
 
@@ -2308,7 +2308,7 @@ static int xscale_add_watchpoint(struct target_s *target,
 }
 
 static int xscale_unset_watchpoint(struct target_s *target,
-               watchpoint_t *watchpoint)
+               struct watchpoint *watchpoint)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
        reg_t *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
@@ -2343,7 +2343,7 @@ static int xscale_unset_watchpoint(struct target_s *target,
        return ERROR_OK;
 }
 
-static int xscale_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint)
+static int xscale_remove_watchpoint(struct target_s *target, struct watchpoint *watchpoint)
 {
        struct xscale_common_s *xscale = target_to_xscale(target);
 
@@ -2868,7 +2868,7 @@ static int xscale_init_target(struct command_context_s *cmd_ctx,
 }
 
 static int xscale_init_arch_info(target_t *target,
-               xscale_common_t *xscale, jtag_tap_t *tap, const char *variant)
+               xscale_common_t *xscale, struct jtag_tap *tap, const char *variant)
 {
        armv4_5_common_t *armv4_5;
        uint32_t high_reset_branch, low_reset_branch;
@@ -2989,9 +2989,7 @@ static int xscale_target_create(struct target_s *target, Jim_Interp *interp)
                        target->variant);
 }
 
-static int
-xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_debug_handler_command)
 {
        target_t *target = NULL;
        xscale_common_t *xscale;
@@ -3031,9 +3029,7 @@ xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int
-xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_cache_clean_address_command)
 {
        target_t *target = NULL;
        xscale_common_t *xscale;
@@ -3070,9 +3066,7 @@ xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int
-xscale_handle_cache_info_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_cache_info_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3121,8 +3115,7 @@ static int xscale_mmu(struct target_s *target, int *enabled)
        return ERROR_OK;
 }
 
-static int xscale_handle_mmu_command(command_context_t *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_mmu_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3134,7 +3127,7 @@ static int xscale_handle_mmu_command(command_context_t *cmd_ctx,
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
 
@@ -3157,8 +3150,7 @@ static int xscale_handle_mmu_command(command_context_t *cmd_ctx,
        return ERROR_OK;
 }
 
-static int xscale_handle_idcache_command(command_context_t *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_idcache_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3171,13 +3163,13 @@ static int xscale_handle_idcache_command(command_context_t *cmd_ctx,
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
 
-       if (strcmp(cmd, "icache") == 0)
+       if (strcmp(CMD_NAME, "icache") == 0)
                icache = 1;
-       else if (strcmp(cmd, "dcache") == 0)
+       else if (strcmp(CMD_NAME, "dcache") == 0)
                dcache = 1;
 
        if (argc >= 1)
@@ -3211,8 +3203,7 @@ static int xscale_handle_idcache_command(command_context_t *cmd_ctx,
        return ERROR_OK;
 }
 
-static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_vector_catch_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3239,8 +3230,7 @@ static int xscale_handle_vector_catch_command(command_context_t *cmd_ctx,
 }
 
 
-static int xscale_handle_vector_table_command(command_context_t *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_vector_table_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3298,9 +3288,7 @@ static int xscale_handle_vector_table_command(command_context_t *cmd_ctx,
 }
 
 
-static int
-xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_trace_buffer_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3314,7 +3302,7 @@ xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx,
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
 
@@ -3379,9 +3367,7 @@ xscale_handle_trace_buffer_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int
-xscale_handle_trace_image_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_trace_image_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3429,13 +3415,12 @@ xscale_handle_trace_image_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_dump_trace_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
        xscale_trace_data_t *trace_data;
-       fileio_t file;
+       struct fileio file;
        int retval;
 
        retval = xscale_verify_pointer(cmd_ctx, xscale);
@@ -3444,7 +3429,7 @@ static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx,
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
 
@@ -3487,9 +3472,7 @@ static int xscale_handle_dump_trace_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int
-xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_analyze_trace_buffer_command)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3504,8 +3487,7 @@ xscale_handle_analyze_trace_buffer_command(struct command_context_s *cmd_ctx,
        return ERROR_OK;
 }
 
-static int xscale_handle_cp15(command_context_t *cmd_ctx,
-               char *cmd, char **args, int argc)
+COMMAND_HANDLER(xscale_handle_cp15)
 {
        target_t *target = get_current_target(cmd_ctx);
        struct xscale_common_s *xscale = target_to_xscale(target);
@@ -3517,7 +3499,7 @@ static int xscale_handle_cp15(command_context_t *cmd_ctx,
 
        if (target->state != TARGET_HALTED)
        {
-               command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+               command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
                return ERROR_OK;
        }
        uint32_t reg_no = 0;