cable_gpio: bugfix - gpio cabel fails for pin number 4

GPIO_REQUIRED is 4, thus no jtag pin can be number 4 because 4 is invalid.

Signed-off-by: Jan Willeke <will...@smartmote.de>

---
 urjtag/src/tap/cable/gpio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/urjtag/src/tap/cable/gpio.c b/urjtag/src/tap/cable/gpio.c
index 41117f9..0878e24 100644
--- a/urjtag/src/tap/cable/gpio.c
+++ b/urjtag/src/tap/cable/gpio.c
@@ -42,7 +42,7 @@
 #define GPIO_PATH "/sys/class/gpio/"
 #define GPIO_EXPORT_PATH GPIO_PATH "export"
 #define GPIO_UNEXPORT_PATH GPIO_PATH "unexport"
-
+#define GPIO_UNSET -1
 /* pin mapping */
 enum {
 GPIO_TDI = 0,
@@ -216,10 +216,10 @@ gpio_connect (urj_cable_t *cable, const urj_param_t 
*params[])
 return URJ_STATUS_FAIL;
 }

- cable_params->jtag_gpios[GPIO_TDI] = GPIO_REQUIRED;
- cable_params->jtag_gpios[GPIO_TDO] = GPIO_REQUIRED;
- cable_params->jtag_gpios[GPIO_TMS] = GPIO_REQUIRED;
- cable_params->jtag_gpios[GPIO_TCK] = GPIO_REQUIRED;
+ cable_params->jtag_gpios[GPIO_TDI] = GPIO_UNSET;
+ cable_params->jtag_gpios[GPIO_TDO] = GPIO_UNSET;
+ cable_params->jtag_gpios[GPIO_TMS] = GPIO_UNSET;
+ cable_params->jtag_gpios[GPIO_TCK] = GPIO_UNSET;
 if (params != NULL)
 /* parse arguments beyond the cable name */
 for (i = 0; params[i] != NULL; i++)
@@ -253,7 +253,7 @@ gpio_connect (urj_cable_t *cable, const urj_param_t 
*params[])
 */

 for (i = GPIO_TDI; i <= GPIO_TDO; i++)
- if (cable_params->jtag_gpios[i] == GPIO_REQUIRED)
+ if (cable_params->jtag_gpios[i] == GPIO_UNSET)
 {
 urj_error_set (URJ_ERROR_SYNTAX, _("missing required gpios\n"));
 gpio_help (URJ_ERROR_SYNTAX, "gpio");
-- 
2.1.4

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
UrJTAG-development mailing list
UrJTAG-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to