]> git.sur5r.net Git - openocd/commitdiff
ARM11: implement provider for new DPM interface
authorDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 24 Nov 2009 08:14:06 +0000 (00:14 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 24 Nov 2009 08:14:06 +0000 (00:14 -0800)
This is a very thin layer over some of the current ARM11
debug TAP utilities.  The layer isn't yet hooked up.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm11.h
src/target/arm11_dbgtap.c
src/target/arm11_dbgtap.h

index d40faa4faa68dd1cedc97fc0fa7b38a0af2a1577..a67c33710b7d297853bd390f6aaf6c82f8d5aa72 100644 (file)
@@ -24,6 +24,7 @@
 #define ARM11_H
 
 #include "armv4_5.h"
+#include "arm_dpm.h"
 
 /* TEMPORARY -- till we switch to the shared infrastructure */
 #define ARM11_REGCACHE_COUNT           20
@@ -59,6 +60,9 @@ struct arm11_common
        struct arm      arm;
        struct target * target;         /**< Reference back to the owner */
 
+       /** Debug module state. */
+       struct arm_dpm dpm;
+
        /** \name Processor type detection */
        /*@{*/
 
index c8d5902fbcdf448fb2704623157de77145f928b5..b5b02ef9382b4f9e00502fdf98c90d4bcdd9f295 100644 (file)
@@ -951,3 +951,76 @@ int arm11_read_memory_word(struct arm11_common * arm11, uint32_t address, uint32
        return arm11_run_instr_data_finish(arm11);
 }
 
+
+/************************************************************************/
+
+/*
+ * ARM11 provider for the OpenOCD implementation of the standard
+ * architectural ARM v6/v7 "Debug Programmer's Model" (DPM).
+ */
+
+static inline struct arm11_common *dpm_to_arm11(struct arm_dpm *dpm)
+{
+       return container_of(dpm, struct arm11_common, dpm);
+}
+
+static int arm11_dpm_prepare(struct arm_dpm *dpm)
+{
+       struct arm11_common *arm11 = dpm_to_arm11(dpm);
+
+       arm11 = container_of(dpm->arm, struct arm11_common, arm);
+
+       return arm11_run_instr_data_prepare(dpm_to_arm11(dpm));
+}
+
+static int arm11_dpm_finish(struct arm_dpm *dpm)
+{
+       return arm11_run_instr_data_finish(dpm_to_arm11(dpm));
+}
+
+static int arm11_dpm_instr_write_data_dcc(struct arm_dpm *dpm,
+               uint32_t opcode, uint32_t data)
+{
+       return arm11_run_instr_data_to_core(dpm_to_arm11(dpm),
+                       opcode, &data, 1);
+}
+
+static int arm11_dpm_instr_write_data_r0(struct arm_dpm *dpm,
+               uint32_t opcode, uint32_t data)
+{
+       return arm11_run_instr_data_to_core_via_r0(dpm_to_arm11(dpm),
+                       opcode, data);
+}
+
+static int arm11_dpm_instr_read_data_dcc(struct arm_dpm *dpm,
+               uint32_t opcode, uint32_t *data)
+{
+       return arm11_run_instr_data_from_core(dpm_to_arm11(dpm),
+                       opcode, data, 1);
+}
+
+static int arm11_dpm_instr_read_data_r0(struct arm_dpm *dpm,
+               uint32_t opcode, uint32_t *data)
+{
+       return arm11_run_instr_data_from_core_via_r0(dpm_to_arm11(dpm),
+                       opcode, data);
+}
+
+
+void arm11_dpm_init(struct arm11_common *arm11, uint32_t didr)
+{
+       struct arm_dpm *dpm = &arm11->dpm;
+
+       dpm->arm = &arm11->arm;
+
+       dpm->didr = didr;
+
+       dpm->prepare = arm11_dpm_prepare;
+       dpm->finish = arm11_dpm_finish;
+
+       dpm->instr_write_data_dcc = arm11_dpm_instr_write_data_dcc;
+       dpm->instr_write_data_r0 = arm11_dpm_instr_write_data_r0;
+
+       dpm->instr_read_data_dcc = arm11_dpm_instr_read_data_dcc;
+       dpm->instr_read_data_r0 = arm11_dpm_instr_read_data_r0;
+}
index b85a138cfa220837692a800b2cbe792a77bb7300..8b6a2065552835935bc6d4d98f7681b00829870a 100644 (file)
@@ -60,4 +60,7 @@ void arm11_sc7_set_vcr(struct arm11_common *arm11, uint32_t value);
 int arm11_read_memory_word(struct arm11_common *arm11,
                uint32_t address, uint32_t *result);
 
+/* Set up high-level debug module utilities */
+void arm11_dpm_init(struct arm11_common *arm11, uint32_t didr);
+
 #endif // ARM11_DBGTAP_H