aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/tcl.c
diff options
context:
space:
mode:
authorSimon Qian <simonqian.openocd@gmail.com>2012-03-17 15:21:59 +0800
committerSpencer Oliver <spen@spen-soft.co.uk>2012-04-10 12:14:00 +0000
commit7743e0fb4390d09c315ce9c6edbb2c3ba6b8c2d9 (patch)
treefcd0917e249482eff2ddbe4b246a1f29a504d93a /src/jtag/tcl.c
parenta2935397b48ce2a1bbb8e49258b340479e0b9c8e (diff)
downloadriscv-openocd-7743e0fb4390d09c315ce9c6edbb2c3ba6b8c2d9.zip
riscv-openocd-7743e0fb4390d09c315ce9c6edbb2c3ba6b8c2d9.tar.gz
riscv-openocd-7743e0fb4390d09c315ce9c6edbb2c3ba6b8c2d9.tar.bz2
topic: add reset functions for SWD
Add swd_init_reset and swd_add_reset. Add adapter_assert_reset and adapter_deassert_reset, and call them instead of JTAG reset functions. Change-Id: Ib2551c6fbb45513e0ae0dc331cfe3ee3f922298a Signed-off-by: Simon Qian <simonqian.openocd@gmail.com> Reviewed-on: http://openocd.zylin.com/526 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/jtag/tcl.c')
-rw-r--r--src/jtag/tcl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index c74df5e..b279b1f 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -33,6 +33,7 @@
#endif
#include "jtag.h"
+#include "swd.h"
#include "minidriver.h"
#include "interface.h"
#include "interfaces.h"
@@ -672,6 +673,7 @@ static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
+ int e = ERROR_OK;
Jim_GetOptInfo goi;
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
if (goi.argc != 0) {
@@ -679,7 +681,11 @@ static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const
return JIM_ERR;
}
struct command_context *context = current_command_context(interp);
- int e = jtag_init_reset(context);
+ if (transport_is_jtag())
+ e = jtag_init_reset(context);
+ else if (transport_is_swd())
+ e = swd_init_reset(context);
+
if (e != ERROR_OK) {
Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);