uint32_t far_reg;
} arm720t_common_t;
+static inline struct arm720t_common_s *
+target_to_arm720(struct target_s *target)
+{
+ return container_of(target->arch_info, struct arm720t_common_s,
+ arm7tdmi_common.arm7_9_common.armv4_5_common);
+}
+
#endif /* ARM720T_H */
} arm7_9_common_t;
+static inline struct arm7_9_common_s *
+target_to_arm7_9(struct target_s *target)
+{
+ return container_of(target->arch_info, struct arm7_9_common_s,
+ armv4_5_common);
+}
+
int arm7_9_register_commands(struct command_context_s *cmd_ctx);
int arm7_9_poll(target_t *target);
int preserve_cache;
} arm920t_common_t;
+static inline struct arm920t_common_s *
+target_to_arm920(struct target_s *target)
+{
+ return container_of(target->arch_info, struct arm920t_common_s,
+ arm9tdmi_common.arm7_9_common.armv4_5_common);
+}
+
typedef struct arm920t_cache_line_s
{
uint32_t cam;
uint32_t d_far;
} arm926ejs_common_t;
+static inline struct arm926ejs_common_s *
+target_to_arm926(struct target_s *target)
+{
+ return container_of(target->arch_info, struct arm926ejs_common_s,
+ arm9tdmi_common.arm7_9_common.armv4_5_common);
+}
+
+
extern int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, jtag_tap_t *tap);
extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx);
extern int arm926ejs_arch_state(struct target_s *target);
uint32_t cp15_control_reg;
} arm966e_common_t;
+static inline struct arm966e_common_s *
+target_to_arm966(struct target_s *target)
+{
+ return container_of(target->arch_info, struct arm966e_common_s,
+ arm9tdmi_common.arm7_9_common.armv4_5_common);
+}
+
extern int arm966e_init_arch_info(target_t *target, arm966e_common_t *arm966e, jtag_tap_t *tap);
extern int arm966e_register_commands(struct command_context_s *cmd_ctx);
extern int arm966e_write_cp15(target_t *target, int reg_addr, uint32_t value);
void *arch_info;
} armv4_5_common_t;
+static inline struct armv4_5_common_s *
+target_to_armv4_5(struct target_s *target)
+{
+ return target->arch_info;
+}
+
typedef struct armv4_5_algorithm_s
{
int common_magic;
} armv7a_common_t;
+static inline struct armv7a_common_s *
+target_to_armv7a(struct target_s *target)
+{
+ return container_of(target->arch_info, struct armv7a_common_s,
+ armv4_5_common);
+}
+
typedef struct armv7a_algorithm_s
{
int common_magic;
void *arch_info;
} armv7m_common_t;
+static inline struct armv7m_common_s *
+target_to_armv7m(struct target_s *target)
+{
+ return target->arch_info;
+}
+
typedef struct armv7m_algorithm_s
{
int common_magic;
void *arch_info;
} cortex_a8_common_t;
+static inline struct cortex_a8_common_s *
+target_to_cortex_a8(struct target_s *target)
+{
+ return container_of(target->arch_info, struct cortex_a8_common_s,
+ armv7a_common.armv4_5_common);
+}
+
extern int cortex_a8_init_arch_info(target_t *target, cortex_a8_common_t *cortex_a8, jtag_tap_t *tap);
int cortex_a8_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
int cortex_a8_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
void *arch_info;
} cortex_m3_common_t;
+static inline struct cortex_m3_common_s *
+target_to_cm3(struct target_s *target)
+{
+ return container_of(target->arch_info,
+ struct cortex_m3_common_s, armv7m);
+}
+
#endif /* CORTEX_M3_H */
#ifndef TARGET_H
#define TARGET_H
+#include <stddef.h>
+
#include "breakpoints.h"
#include "algorithm.h"
#include "command.h"
struct trace_s;
struct command_context_s;
+
+/**
+ * Cast a member of a structure out to the containing structure.
+ * @param ptr The pointer to the member.
+ * @param type The type of the container struct this is embedded in.
+ * @param member The name of the member within the struct.
+ *
+ * This is a mechanism which is used throughout the Linux kernel.
+ */
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
/*
* TARGET_UNKNOWN = 0: we don't know anything about the target yet
* TARGET_RUNNING = 1: the target is executing user code
int fast_memory_access;
} xscale_common_t;
+static inline struct xscale_common_s *
+target_to_xscale(struct target_s *target)
+{
+ return container_of(target->arch_info, struct xscale_common_s,
+ armv4_5_common);
+}
+
typedef struct xscale_reg_s
{
int dbg_handler_number;