ARM9TDMI: remove now-needless "struct arm9tdmi"

And move the rest of the vector_catch stuff into the C file;
it's not part of the module interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
__archive__
David Brownell 2009-11-17 01:09:50 -08:00
parent 812ab89f58
commit 0181296f61
9 changed files with 45 additions and 72 deletions

View File

@ -62,7 +62,7 @@ static int arm920t_read_cp15_physical(struct target *target,
uint8_t reg_addr_buf = reg_addr & 0x3f; uint8_t reg_addr_buf = reg_addr & 0x3f;
uint8_t nr_w_buf = 0; uint8_t nr_w_buf = 0;
jtag_info = &arm920t->arm9tdmi_common.arm7_9_common.jtag_info; jtag_info = &arm920t->arm7_9_common.jtag_info;
jtag_set_end_state(TAP_IDLE); jtag_set_end_state(TAP_IDLE);
arm_jtag_scann(jtag_info, 0xf); arm_jtag_scann(jtag_info, 0xf);
@ -115,7 +115,7 @@ static int arm920t_write_cp15_physical(struct target *target,
uint8_t nr_w_buf = 1; uint8_t nr_w_buf = 1;
uint8_t value_buf[4]; uint8_t value_buf[4];
jtag_info = &arm920t->arm9tdmi_common.arm7_9_common.jtag_info; jtag_info = &arm920t->arm7_9_common.jtag_info;
buf_set_u32(value_buf, 0, 32, value); buf_set_u32(value_buf, 0, 32, value);
@ -164,7 +164,7 @@ static int arm920t_execute_cp15(struct target *target, uint32_t cp15_opcode,
uint8_t nr_w_buf = 0; uint8_t nr_w_buf = 0;
uint8_t cp15_opcode_buf[4]; uint8_t cp15_opcode_buf[4];
jtag_info = &arm920t->arm9tdmi_common.arm7_9_common.jtag_info; jtag_info = &arm920t->arm7_9_common.jtag_info;
jtag_set_end_state(TAP_IDLE); jtag_set_end_state(TAP_IDLE);
arm_jtag_scann(jtag_info, 0xf); arm_jtag_scann(jtag_info, 0xf);
@ -444,7 +444,7 @@ int arm920t_arch_state(struct target *target)
return ERROR_TARGET_INVALID; return ERROR_TARGET_INVALID;
} }
armv4_5 = &arm920t->arm9tdmi_common.arm7_9_common.armv4_5_common; armv4_5 = &arm920t->arm7_9_common.armv4_5_common;
LOG_USER("target halted in %s state due to %s, current mode: %s\n" LOG_USER("target halted in %s state due to %s, current mode: %s\n"
"cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "\n" "cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "\n"
@ -623,12 +623,10 @@ int arm920t_soft_reset_halt(struct target *target)
int arm920t_init_arch_info(struct target *target, struct arm920t_common *arm920t, struct jtag_tap *tap) int arm920t_init_arch_info(struct target *target, struct arm920t_common *arm920t, struct jtag_tap *tap)
{ {
struct arm9tdmi_common *arm9tdmi = &arm920t->arm9tdmi_common; struct arm7_9_common *arm7_9 = &arm920t->arm7_9_common;
struct arm7_9_common *arm7_9 = &arm9tdmi->arm7_9_common;
/* initialize arm9tdmi specific info (including arm7_9 and armv4_5) /* initialize arm7/arm9 specific info (including armv4_5) */
*/ arm9tdmi_init_arch_info(target, arm7_9, tap);
arm9tdmi_init_arch_info(target, arm9tdmi, tap);
arm920t->common_magic = ARM920T_COMMON_MAGIC; arm920t->common_magic = ARM920T_COMMON_MAGIC;

View File

@ -27,7 +27,7 @@
struct arm920t_common struct arm920t_common
{ {
struct arm9tdmi_common arm9tdmi_common; struct arm7_9_common arm7_9_common;
uint32_t common_magic; uint32_t common_magic;
struct armv4_5_mmu_common armv4_5_mmu; struct armv4_5_mmu_common armv4_5_mmu;
uint32_t cp15_control_reg; uint32_t cp15_control_reg;
@ -42,7 +42,7 @@ static inline struct arm920t_common *
target_to_arm920(struct target *target) target_to_arm920(struct target *target)
{ {
return container_of(target->arch_info, struct arm920t_common, return container_of(target->arch_info, struct arm920t_common,
arm9tdmi_common.arm7_9_common.armv4_5_common); arm7_9_common.armv4_5_common);
} }
struct arm920t_cache_line struct arm920t_cache_line

View File

@ -502,7 +502,7 @@ int arm926ejs_arch_state(struct target *target)
return ERROR_TARGET_INVALID; return ERROR_TARGET_INVALID;
} }
armv4_5 = &arm926ejs->arm9tdmi_common.arm7_9_common.armv4_5_common; armv4_5 = &arm926ejs->arm7_9_common.armv4_5_common;
LOG_USER("target halted in %s state due to %s, current mode: %s\n" LOG_USER("target halted in %s state due to %s, current mode: %s\n"
"cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "\n" "cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "\n"
@ -670,12 +670,10 @@ static int arm926ejs_read_phys_memory(struct target *target,
int arm926ejs_init_arch_info(struct target *target, struct arm926ejs_common *arm926ejs, int arm926ejs_init_arch_info(struct target *target, struct arm926ejs_common *arm926ejs,
struct jtag_tap *tap) struct jtag_tap *tap)
{ {
struct arm9tdmi_common *arm9tdmi = &arm926ejs->arm9tdmi_common; struct arm7_9_common *arm7_9 = &arm926ejs->arm7_9_common;
struct arm7_9_common *arm7_9 = &arm9tdmi->arm7_9_common;
/* initialize arm9tdmi specific info (including arm7_9 and armv4_5) /* initialize arm7/arm9 specific info (including armv4_5) */
*/ arm9tdmi_init_arch_info(target, arm7_9, tap);
arm9tdmi_init_arch_info(target, arm9tdmi, tap);
arm926ejs->common_magic = ARM926EJS_COMMON_MAGIC; arm926ejs->common_magic = ARM926EJS_COMMON_MAGIC;

View File

@ -27,7 +27,7 @@
struct arm926ejs_common struct arm926ejs_common
{ {
struct arm9tdmi_common arm9tdmi_common; struct arm7_9_common arm7_9_common;
uint32_t common_magic; uint32_t common_magic;
struct armv4_5_mmu_common armv4_5_mmu; struct armv4_5_mmu_common armv4_5_mmu;
int (*read_cp15)(struct target *target, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value); int (*read_cp15)(struct target *target, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value);
@ -42,7 +42,7 @@ static inline struct arm926ejs_common *
target_to_arm926(struct target *target) target_to_arm926(struct target *target)
{ {
return container_of(target->arch_info, struct arm926ejs_common, return container_of(target->arch_info, struct arm926ejs_common,
arm9tdmi_common.arm7_9_common.armv4_5_common); arm7_9_common.armv4_5_common);
} }

View File

@ -34,10 +34,10 @@
int arm966e_init_arch_info(struct target *target, struct arm966e_common *arm966e, struct jtag_tap *tap) int arm966e_init_arch_info(struct target *target, struct arm966e_common *arm966e, struct jtag_tap *tap)
{ {
struct arm9tdmi_common *arm9tdmi = &arm966e->arm9tdmi_common; struct arm7_9_common *arm7_9 = &arm966e->arm7_9_common;
struct arm7_9_common *arm7_9 = &arm9tdmi->arm7_9_common;
arm9tdmi_init_arch_info(target, arm9tdmi, tap); /* initialize arm7/arm9 specific info (including armv4_5) */
arm9tdmi_init_arch_info(target, arm7_9, tap);
arm966e->common_magic = ARM966E_COMMON_MAGIC; arm966e->common_magic = ARM966E_COMMON_MAGIC;

View File

@ -29,7 +29,7 @@
struct arm966e_common struct arm966e_common
{ {
struct arm9tdmi_common arm9tdmi_common; struct arm7_9_common arm7_9_common;
int common_magic; int common_magic;
uint32_t cp15_control_reg; uint32_t cp15_control_reg;
}; };
@ -38,7 +38,7 @@ static inline struct arm966e_common *
target_to_arm966(struct target *target) target_to_arm966(struct target *target)
{ {
return container_of(target->arch_info, struct arm966e_common, return container_of(target->arch_info, struct arm966e_common,
arm9tdmi_common.arm7_9_common.armv4_5_common); arm7_9_common.armv4_5_common);
} }
int arm966e_init_arch_info(struct target *target, int arm966e_init_arch_info(struct target *target,

View File

@ -46,8 +46,22 @@
#define _DEBUG_INSTRUCTION_EXECUTION_ #define _DEBUG_INSTRUCTION_EXECUTION_
#endif #endif
static const struct arm9tdmi_vector arm9tdmi_vectors[] = enum arm9tdmi_vector_bit
{ {
ARM9TDMI_RESET_VECTOR = 0x01,
ARM9TDMI_UNDEF_VECTOR = 0x02,
ARM9TDMI_SWI_VECTOR = 0x04,
ARM9TDMI_PABT_VECTOR = 0x08,
ARM9TDMI_DABT_VECTOR = 0x10,
/* BIT(5) reserved -- must be zero */
ARM9TDMI_IRQ_VECTOR = 0x40,
ARM9TDMI_FIQ_VECTOR = 0x80,
};
static const struct arm9tdmi_vector {
char *name;
uint32_t value;
} arm9tdmi_vectors[] = {
{"reset", ARM9TDMI_RESET_VECTOR}, {"reset", ARM9TDMI_RESET_VECTOR},
{"undef", ARM9TDMI_UNDEF_VECTOR}, {"undef", ARM9TDMI_UNDEF_VECTOR},
{"swi", ARM9TDMI_SWI_VECTOR}, {"swi", ARM9TDMI_SWI_VECTOR},
@ -750,14 +764,9 @@ int arm9tdmi_init_target(struct command_context *cmd_ctx,
return ERROR_OK; return ERROR_OK;
} }
int arm9tdmi_init_arch_info(struct target *target, struct arm9tdmi_common *arm9tdmi, struct jtag_tap *tap) int arm9tdmi_init_arch_info(struct target *target,
struct arm7_9_common *arm7_9, struct jtag_tap *tap)
{ {
struct arm *armv4_5;
struct arm7_9_common *arm7_9;
arm7_9 = &arm9tdmi->arm7_9_common;
armv4_5 = &arm7_9->armv4_5_common;
/* prepare JTAG information for the new target */ /* prepare JTAG information for the new target */
arm7_9->jtag_info.tap = tap; arm7_9->jtag_info.tap = tap;
arm7_9->jtag_info.scann_size = 5; arm7_9->jtag_info.scann_size = 5;
@ -812,10 +821,10 @@ int arm9tdmi_init_arch_info(struct target *target, struct arm9tdmi_common *arm9t
static int arm9tdmi_target_create(struct target *target, Jim_Interp *interp) static int arm9tdmi_target_create(struct target *target, Jim_Interp *interp)
{ {
struct arm9tdmi_common *arm9tdmi = calloc(1,sizeof(struct arm9tdmi_common)); struct arm7_9_common *arm7_9 = calloc(1,sizeof(struct arm7_9_common));
arm9tdmi_init_arch_info(target, arm9tdmi, target->tap); arm9tdmi_init_arch_info(target, arm7_9, target->tap);
arm9tdmi->arm7_9_common.armv4_5_common.is_armv4 = true; arm7_9->armv4_5_common.is_armv4 = true;
return ERROR_OK; return ERROR_OK;
} }

View File

@ -25,36 +25,10 @@
#include "embeddedice.h" #include "embeddedice.h"
/* FIXME we don't really need a separate arm9tdmi struct any more...
* remove it, the arm7/arm9 common struct suffices.
*/
struct arm9tdmi_common
{
struct arm7_9_common arm7_9_common;
};
struct arm9tdmi_vector
{
char *name;
uint32_t value;
};
enum arm9tdmi_vector_bit
{
ARM9TDMI_RESET_VECTOR = 0x01,
ARM9TDMI_UNDEF_VECTOR = 0x02,
ARM9TDMI_SWI_VECTOR = 0x04,
ARM9TDMI_PABT_VECTOR = 0x08,
ARM9TDMI_DABT_VECTOR = 0x10,
/* BIT(5) reserved -- must be zero */
ARM9TDMI_IRQ_VECTOR = 0x40,
ARM9TDMI_FIQ_VECTOR = 0x80,
};
int arm9tdmi_init_target(struct command_context *cmd_ctx, int arm9tdmi_init_target(struct command_context *cmd_ctx,
struct target *target); struct target *target);
int arm9tdmi_init_arch_info(struct target *target, int arm9tdmi_init_arch_info(struct target *target,
struct arm9tdmi_common *arm9tdmi, struct jtag_tap *tap); struct arm7_9_common *arm7_9, struct jtag_tap *tap);
int arm9tdmi_register_commands(struct command_context *cmd_ctx); int arm9tdmi_register_commands(struct command_context *cmd_ctx);
int arm9tdmi_clock_out(struct arm_jtag *jtag_info, int arm9tdmi_clock_out(struct arm_jtag *jtag_info,

View File

@ -256,12 +256,8 @@ static void fa526_branch_resume_thumb(struct target *target)
} }
static int fa526_init_arch_info_2(struct target *target, static int fa526_init_arch_info_2(struct target *target,
struct arm9tdmi_common *arm9tdmi, struct jtag_tap *tap) struct arm7_9_common *arm7_9, struct jtag_tap *tap)
{ {
struct arm7_9_common *arm7_9;
arm7_9 = &arm9tdmi->arm7_9_common;
/* prepare JTAG information for the new target */ /* prepare JTAG information for the new target */
arm7_9->jtag_info.tap = tap; arm7_9->jtag_info.tap = tap;
arm7_9->jtag_info.scann_size = 5; arm7_9->jtag_info.scann_size = 5;
@ -317,12 +313,10 @@ static int fa526_init_arch_info_2(struct target *target,
static int fa526_init_arch_info(struct target *target, static int fa526_init_arch_info(struct target *target,
struct arm920t_common *arm920t, struct jtag_tap *tap) struct arm920t_common *arm920t, struct jtag_tap *tap)
{ {
struct arm9tdmi_common *arm9tdmi = &arm920t->arm9tdmi_common; struct arm7_9_common *arm7_9 = &arm920t->arm7_9_common;
struct arm7_9_common *arm7_9 = &arm9tdmi->arm7_9_common;
/* initialize arm9tdmi specific info (including arm7_9 and armv4_5) /* initialize arm7/arm9 specific info (including armv4_5) */
*/ fa526_init_arch_info_2(target, arm7_9, tap);
fa526_init_arch_info_2(target, arm9tdmi, tap);
arm920t->common_magic = ARM920T_COMMON_MAGIC; arm920t->common_magic = ARM920T_COMMON_MAGIC;