Discussion:
[UrJTAG-dev] Bug in src/tap/cable/gpio.c GPIO 4 not allowed
Jan Willeke
2015-09-25 19:31:49 UTC
Permalink
Hallo

the gpio driver does not accept gpio number 4. here comes the fix.

regards Jan

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");

------------------------------------------------------------------------------
Loading...