reg_t -> struct reg
[fw/openocd] / src / target / xscale.c
index 99453b440819d1be5d0216de24cbcad3eca1048a..e757271a37fb1a7a19442261af70d4d2fcffe1dc 100644 (file)
@@ -61,11 +61,11 @@ static int xscale_resume(struct target_s *, int current,
        uint32_t address, int handle_breakpoints, int debug_execution);
 static int xscale_debug_entry(target_t *);
 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_get_reg(struct reg *reg);
+static int xscale_set_reg(struct reg *reg, uint8_t *buf);
+static int xscale_set_breakpoint(struct target_s *, struct breakpoint *);
 static int xscale_set_watchpoint(struct target_s *, struct watchpoint *);
-static int xscale_unset_breakpoint(struct target_s *, breakpoint_t *);
+static int xscale_unset_breakpoint(struct target_s *, struct breakpoint *);
 static int xscale_read_trace(target_t *);
 
 
@@ -106,7 +106,7 @@ static char *const xscale_reg_list[] =
        "XSCALE_TXRXCTRL",
 };
 
-static const xscale_reg_t xscale_reg_arch_info[] =
+static const struct xscale_reg xscale_reg_arch_info[] =
 {
        {XSCALE_MAINID, NULL},
        {XSCALE_CACHETYPE, NULL},
@@ -135,7 +135,7 @@ static const xscale_reg_t xscale_reg_arch_info[] =
 static int xscale_reg_arch_type = -1;
 
 /* convenience wrapper to access XScale specific registers */
-static int xscale_set_reg_u32(reg_t *reg, uint32_t value)
+static int xscale_set_reg_u32(struct reg *reg, uint32_t value)
 {
        uint8_t buf[4];
 
@@ -1125,12 +1125,12 @@ static int xscale_halt(target_t *target)
 static int xscale_enable_single_step(struct target_s *target, uint32_t next_pc)
 {
        struct xscale_common *xscale = target_to_xscale(target);
-       reg_t *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0];
+       struct reg *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0];
        int retval;
 
        if (xscale->ibcr0_used)
        {
-               breakpoint_t *ibcr0_bp = breakpoint_find(target, buf_get_u32(ibcr0->value, 0, 32) & 0xfffffffe);
+               struct breakpoint *ibcr0_bp = breakpoint_find(target, buf_get_u32(ibcr0->value, 0, 32) & 0xfffffffe);
 
                if (ibcr0_bp)
                {
@@ -1152,7 +1152,7 @@ static int xscale_enable_single_step(struct target_s *target, uint32_t next_pc)
 static int xscale_disable_single_step(struct target_s *target)
 {
        struct xscale_common *xscale = target_to_xscale(target);
-       reg_t *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0];
+       struct reg *ibcr0 = &xscale->reg_cache->reg_list[XSCALE_IBCR0];
        int retval;
 
        if ((retval = xscale_set_reg_u32(ibcr0, 0x0)) != ERROR_OK)
@@ -1175,7 +1175,7 @@ static void xscale_enable_watchpoints(struct target_s *target)
 
 static void xscale_enable_breakpoints(struct target_s *target)
 {
-       breakpoint_t *breakpoint = target->breakpoints;
+       struct breakpoint *breakpoint = target->breakpoints;
 
        /* set any pending breakpoints */
        while (breakpoint)
@@ -1191,7 +1191,7 @@ static int xscale_resume(struct target_s *target, int current,
 {
        struct xscale_common *xscale = target_to_xscale(target);
        struct armv4_5_common_s *armv4_5 = &xscale->armv4_5_common;
-       breakpoint_t *breakpoint = target->breakpoints;
+       struct breakpoint *breakpoint = target->breakpoints;
        uint32_t current_pc;
        int retval;
        int i;
@@ -1423,7 +1423,7 @@ static int xscale_step(struct target_s *target, int current,
                uint32_t address, int handle_breakpoints)
 {
        struct armv4_5_common_s *armv4_5 = target_to_armv4_5(target);
-       breakpoint_t *breakpoint = target->breakpoints;
+       struct breakpoint *breakpoint = target->breakpoints;
 
        uint32_t current_pc;
        int retval;
@@ -1518,7 +1518,7 @@ static int xscale_assert_reset(target_t *target)
 static int xscale_deassert_reset(target_t *target)
 {
        struct xscale_common *xscale = target_to_xscale(target);
-       breakpoint_t *breakpoint = target->breakpoints;
+       struct breakpoint *breakpoint = target->breakpoints;
 
        LOG_DEBUG("-");
 
@@ -2046,7 +2046,7 @@ static void xscale_enable_mmu_caches(target_t *target, int mmu,
 }
 
 static int xscale_set_breakpoint(struct target_s *target,
-               breakpoint_t *breakpoint)
+               struct breakpoint *breakpoint)
 {
        int retval;
        struct xscale_common *xscale = target_to_xscale(target);
@@ -2119,7 +2119,7 @@ static int xscale_set_breakpoint(struct target_s *target,
 }
 
 static int xscale_add_breakpoint(struct target_s *target,
-               breakpoint_t *breakpoint)
+               struct breakpoint *breakpoint)
 {
        struct xscale_common *xscale = target_to_xscale(target);
 
@@ -2150,7 +2150,7 @@ static int xscale_add_breakpoint(struct target_s *target,
 }
 
 static int xscale_unset_breakpoint(struct target_s *target,
-               breakpoint_t *breakpoint)
+               struct breakpoint *breakpoint)
 {
        int retval;
        struct xscale_common *xscale = target_to_xscale(target);
@@ -2204,7 +2204,7 @@ static int xscale_unset_breakpoint(struct target_s *target,
        return ERROR_OK;
 }
 
-static int xscale_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
+static int xscale_remove_breakpoint(struct target_s *target, struct breakpoint *breakpoint)
 {
        struct xscale_common *xscale = target_to_xscale(target);
 
@@ -2230,7 +2230,7 @@ static int xscale_set_watchpoint(struct target_s *target,
 {
        struct xscale_common *xscale = target_to_xscale(target);
        uint8_t enable = 0;
-       reg_t *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
+       struct reg *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
        uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32);
 
        if (target->state != TARGET_HALTED)
@@ -2311,7 +2311,7 @@ static int xscale_unset_watchpoint(struct target_s *target,
                struct watchpoint *watchpoint)
 {
        struct xscale_common *xscale = target_to_xscale(target);
-       reg_t *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
+       struct reg *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON];
        uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32);
 
        if (target->state != TARGET_HALTED)
@@ -2363,9 +2363,9 @@ static int xscale_remove_watchpoint(struct target_s *target, struct watchpoint *
        return ERROR_OK;
 }
 
-static int xscale_get_reg(reg_t *reg)
+static int xscale_get_reg(struct reg *reg)
 {
-       xscale_reg_t *arch_info = reg->arch_info;
+       struct xscale_reg *arch_info = reg->arch_info;
        target_t *target = arch_info->target;
        struct xscale_common *xscale = target_to_xscale(target);
 
@@ -2408,9 +2408,9 @@ static int xscale_get_reg(reg_t *reg)
        return ERROR_OK;
 }
 
-static int xscale_set_reg(reg_t *reg, uint8_t* buf)
+static int xscale_set_reg(struct reg *reg, uint8_t* buf)
 {
-       xscale_reg_t *arch_info = reg->arch_info;
+       struct xscale_reg *arch_info = reg->arch_info;
        target_t *target = arch_info->target;
        struct xscale_common *xscale = target_to_xscale(target);
        uint32_t value = buf_get_u32(buf, 0, 32);
@@ -2455,8 +2455,8 @@ static int xscale_set_reg(reg_t *reg, uint8_t* buf)
 static int xscale_write_dcsr_sw(target_t *target, uint32_t value)
 {
        struct xscale_common *xscale = target_to_xscale(target);
-       reg_t *dcsr = &xscale->reg_cache->reg_list[XSCALE_DCSR];
-       xscale_reg_t *dcsr_arch_info = dcsr->arch_info;
+       struct reg *dcsr = &xscale->reg_cache->reg_list[XSCALE_DCSR];
+       struct xscale_reg *dcsr_arch_info = dcsr->arch_info;
 
        /* send CP write request (command 0x41) */
        xscale_send_u32(target, 0x41);
@@ -2534,7 +2534,7 @@ static int xscale_read_trace(target_t *target)
        (*trace_data_p)->chkpt0 = trace_buffer[256];
        (*trace_data_p)->chkpt1 = trace_buffer[257];
        (*trace_data_p)->last_instruction = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32);
-       (*trace_data_p)->entries = malloc(sizeof(xscale_trace_entry_t) * (256 - j));
+       (*trace_data_p)->entries = malloc(sizeof(struct xscale_trace_entry) * (256 - j));
        (*trace_data_p)->depth = 256 - j;
 
        for (i = j; i < 256; i++)
@@ -2550,7 +2550,7 @@ static int xscale_read_trace(target_t *target)
 }
 
 static int xscale_read_instruction(target_t *target,
-               arm_instruction_t *instruction)
+               struct arm_instruction *instruction)
 {
        struct xscale_common *xscale = target_to_xscale(target);
        int i;
@@ -2723,7 +2723,7 @@ static int xscale_analyze_trace(target_t *target, command_context_t *cmd_ctx)
                        if (xscale->trace.pc_ok)
                        {
                                int executed = (trace_data->entries[i].data & 0xf) + rollover * 16;
-                               arm_instruction_t instruction;
+                               struct arm_instruction instruction;
 
                                if ((exception == 6) || (exception == 7))
                                {
@@ -2795,7 +2795,7 @@ static int xscale_analyze_trace(target_t *target, command_context_t *cmd_ctx)
 
                for (; xscale->trace.current_pc < trace_data->last_instruction; xscale->trace.current_pc += (xscale->trace.core_state == ARMV4_5_STATE_ARM) ? 4 : 2)
                {
-                       arm_instruction_t instruction;
+                       struct arm_instruction instruction;
                        if ((retval = xscale_read_instruction(target, &instruction)) != ERROR_OK)
                        {
                                /* can't continue tracing with no image available */
@@ -2822,9 +2822,9 @@ static void xscale_build_reg_cache(target_t *target)
        struct xscale_common *xscale = target_to_xscale(target);
        struct armv4_5_common_s *armv4_5 = &xscale->armv4_5_common;
        struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache);
-       xscale_reg_t *arch_info = malloc(sizeof(xscale_reg_arch_info));
+       struct xscale_reg *arch_info = malloc(sizeof(xscale_reg_arch_info));
        int i;
-       int num_regs = sizeof(xscale_reg_arch_info) / sizeof(xscale_reg_t);
+       int num_regs = sizeof(xscale_reg_arch_info) / sizeof(struct xscale_reg);
 
        (*cache_p) = armv4_5_build_reg_cache(target, armv4_5);
        armv4_5->core_cache = (*cache_p);
@@ -2839,7 +2839,7 @@ static void xscale_build_reg_cache(target_t *target)
        /* fill in values for the xscale reg cache */
        (*cache_p)->name = "XScale registers";
        (*cache_p)->next = NULL;
-       (*cache_p)->reg_list = malloc(num_regs * sizeof(reg_t));
+       (*cache_p)->reg_list = malloc(num_regs * sizeof(struct reg));
        (*cache_p)->num_regs = num_regs;
 
        for (i = 0; i < num_regs; i++)
@@ -2870,7 +2870,7 @@ static int xscale_init_target(struct command_context_s *cmd_ctx,
 static int xscale_init_arch_info(target_t *target,
                struct xscale_common *xscale, struct jtag_tap *tap, const char *variant)
 {
-       armv4_5_common_t *armv4_5;
+       struct arm *armv4_5;
        uint32_t high_reset_branch, low_reset_branch;
        int i;
 
@@ -3390,7 +3390,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
                command_print(cmd_ctx, "previously loaded image found and closed");
        }
 
-       xscale->trace.image = malloc(sizeof(image_t));
+       xscale->trace.image = malloc(sizeof(struct image));
        xscale->trace.image->base_address_set = 0;
        xscale->trace.image->start_address_set = 0;
 
@@ -3503,7 +3503,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
                return ERROR_OK;
        }
        uint32_t reg_no = 0;
-       reg_t *reg = NULL;
+       struct reg *reg = NULL;
        if (argc > 0)
        {
                COMMAND_PARSE_NUMBER(u32, args[0], reg_no);
@@ -3606,7 +3606,7 @@ static int xscale_register_commands(struct command_context_s *cmd_ctx)
        return ERROR_OK;
 }
 
-target_type_t xscale_target =
+struct target_type xscale_target =
 {
        .name = "xscale",