From 1b4fe52ef02196fd16ea86d6488a96f3ff2d8ff8 Mon Sep 17 00:00:00 2001 From: John Pitney Date: Sat, 19 Nov 2016 10:18:54 -0600 Subject: [PATCH 1/4] Add RST and TST to gpio driver --- drivers/jtdev_gpio.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/jtdev_gpio.c b/drivers/jtdev_gpio.c index 680d170..3b9cfc9 100644 --- a/drivers/jtdev_gpio.c +++ b/drivers/jtdev_gpio.c @@ -42,11 +42,13 @@ enum { GPIO_TCK, GPIO_TMS, GPIO_TDO, + GPIO_RST, + GPIO_TST, GPIO_REQUIRED }; -unsigned int jtag_gpios[4]; -int fd_gpios[4]; +unsigned int jtag_gpios[6]; +int fd_gpios[6]; static int gpio_open () @@ -87,15 +89,17 @@ gpio_parse_config (const char *params) {"tms=",GPIO_TMS}, {"tdi=",GPIO_TDI}, {"tdo=",GPIO_TDO}, - {"tck=",GPIO_TCK} + {"tck=",GPIO_TCK}, + {"rst=",GPIO_RST}, + {"tst=",GPIO_TST} }; int i; - for( i = 0;i < 4; i++) { + for( i = 0;i < 6; i++) { char* help; help = strstr(params,ops[i].name); if (help) - jtag_gpios[ops[i].num] = atoi(help+4); + jtag_gpios[ops[i].num] = atoi(help+6); else return -1; printf("gpio %s %d\n", ops[i].name,jtag_gpios[ops[i].num]); @@ -164,12 +168,12 @@ static void jtgpio_tdi(struct jtdev *p, int out) static void jtgpio_rst(struct jtdev *p, int out) { - printf("jtag_reset\n"); + gpio_set_value_fd (fd_gpios[GPIO_RST], out); } static void jtgpio_tst(struct jtdev *p, int out) { - printf("jtag_test\n"); + gpio_set_value_fd (fd_gpios[GPIO_TST], out); } static int jtgpio_tdo_get(struct jtdev *p) From ff3af47c34b3babf6929c45e7b1c903472d1b558 Mon Sep 17 00:00:00 2001 From: John Pitney Date: Sat, 19 Nov 2016 13:46:43 -0600 Subject: [PATCH 2/4] Fix gpio configuration parsing --- Makefile | 2 +- drivers/jtdev_gpio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 054040d..42c157a 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ CC ?= gcc INSTALL = /usr/bin/install PREFIX ?= /usr/local -LDFLAGS ?= -s +# LDFLAGS ?= -s BINDIR = ${PREFIX}/bin/ MANDIR = ${PREFIX}/share/man/man1 diff --git a/drivers/jtdev_gpio.c b/drivers/jtdev_gpio.c index 3b9cfc9..b36cffa 100644 --- a/drivers/jtdev_gpio.c +++ b/drivers/jtdev_gpio.c @@ -99,7 +99,7 @@ gpio_parse_config (const char *params) char* help; help = strstr(params,ops[i].name); if (help) - jtag_gpios[ops[i].num] = atoi(help+6); + jtag_gpios[ops[i].num] = atoi(help+4); else return -1; printf("gpio %s %d\n", ops[i].name,jtag_gpios[ops[i].num]); From 929adda7107efa324e4fc747286efca5dbe14f41 Mon Sep 17 00:00:00 2001 From: John Pitney Date: Sat, 19 Nov 2016 13:48:32 -0600 Subject: [PATCH 3/4] Update man page to include reset and test pin mapping --- mspdebug.man | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mspdebug.man b/mspdebug.man index 2dbc909..575c3cd 100644 --- a/mspdebug.man +++ b/mspdebug.man @@ -203,7 +203,7 @@ Linux, ppi on FreeBSD and DragonFly BSD) must be specified via the Connect to system gpios. JTAG mode must be used, and only tty access is supported. Currently, this driver is only supported on Linux, FreeBSD and DragonFly BSD. The gpios to used must defined using -a string like "tdi=7 tdo=8 tms=9 tck=4" via the +a string like "tdi=7 tdo=8 tms=9 tck=4 rst=10 tst=11" via the \fB-d\fR option. (dont forget the quotes) .IP "\fBload-bsl\fR" From fa3557db51c5ee627498daec26b7b947d05f8397 Mon Sep 17 00:00:00 2001 From: John Pitney Date: Sat, 19 Nov 2016 13:49:40 -0600 Subject: [PATCH 4/4] Turn strip back on in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 42c157a..054040d 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ CC ?= gcc INSTALL = /usr/bin/install PREFIX ?= /usr/local -# LDFLAGS ?= -s +LDFLAGS ?= -s BINDIR = ${PREFIX}/bin/ MANDIR = ${PREFIX}/share/man/man1