aboutsummaryrefslogtreecommitdiff
path: root/src/target/openrisc/or1k_du.h
diff options
context:
space:
mode:
authorFranck Jullien <franck.jullien@gmail.com>2013-08-08 23:45:47 +0200
committerSpencer Oliver <spen@spen-soft.co.uk>2013-09-26 09:52:56 +0000
commit4e79b48e2c7e535ef21178a69788c15b571c72ff (patch)
treea3f340d856d4272e3545158ecdc3b32c9a910c73 /src/target/openrisc/or1k_du.h
parentd19fafc8bdb30974e70bfc5a6ce63e7578b6e3b2 (diff)
Add new target type: OpenRISC
Add support for OpenRISC target. This implementation supports the adv_debug_sys debug unit core. The mohor dbg_if is not supported. Support for mohor TAP core and Altera Virtual JTAG core are also provided. Change-Id: I3b1cfab1bbb28e497c4fca6ed1bd3a4362609b72 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1547 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/target/openrisc/or1k_du.h')
-rw-r--r--src/target/openrisc/or1k_du.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/target/openrisc/or1k_du.h b/src/target/openrisc/or1k_du.h
new file mode 100644
index 00000000..564241d8
--- /dev/null
+++ b/src/target/openrisc/or1k_du.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * Copyright (C) 2013 Franck Jullien *
+ * elec4fun@gmail.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef OR1K_DU
+#define OR1K_DU
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CPU_STALL 0
+#define CPU_UNSTALL 1
+
+#define CPU_RESET 0
+#define CPU_NOT_RESET 1
+
+int or1k_du_adv_register(void);
+
+/* Linear list over all available or1k debug unit */
+extern struct list_head du_list;
+
+struct or1k_du {
+ const char *name;
+ struct list_head list;
+ int options;
+
+ int (*or1k_jtag_init)(struct or1k_jtag *jtag_info);
+
+ int (*or1k_is_cpu_running)(struct or1k_jtag *jtag_info, int *running);
+
+ int (*or1k_cpu_stall)(struct or1k_jtag *jtag_info, int action);
+
+ int (*or1k_cpu_reset)(struct or1k_jtag *jtag_info, int action);
+
+ int (*or1k_jtag_read_cpu)(struct or1k_jtag *jtag_info,
+ uint32_t addr, int count, uint32_t *value);
+
+ int (*or1k_jtag_write_cpu)(struct or1k_jtag *jtag_info,
+ uint32_t addr, int count, const uint32_t *value);
+
+ int (*or1k_jtag_read_memory)(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size,
+ int count, uint8_t *buffer);
+
+ int (*or1k_jtag_write_memory)(struct or1k_jtag *jtag_info, uint32_t addr, uint32_t size,
+ int count, const uint8_t *buffer);
+};
+
+static inline struct or1k_du *or1k_jtag_to_du(struct or1k_jtag *jtag_info)
+{
+ return (struct or1k_du *)jtag_info->du_core;
+}
+
+static inline struct or1k_du *or1k_to_du(struct or1k_common *or1k)
+{
+ struct or1k_jtag *jtag = &or1k->jtag;
+ return (struct or1k_du *)jtag->du_core;
+}
+
+#endif
+