Add RST and TST to gpio driver

This commit is contained in:
John Pitney 2016-11-19 10:18:54 -06:00
parent 7159a261b7
commit 1b4fe52ef0
1 changed files with 11 additions and 7 deletions

View File

@ -42,11 +42,13 @@ enum {
GPIO_TCK, GPIO_TCK,
GPIO_TMS, GPIO_TMS,
GPIO_TDO, GPIO_TDO,
GPIO_RST,
GPIO_TST,
GPIO_REQUIRED GPIO_REQUIRED
}; };
unsigned int jtag_gpios[4]; unsigned int jtag_gpios[6];
int fd_gpios[4]; int fd_gpios[6];
static int static int
gpio_open () gpio_open ()
@ -87,15 +89,17 @@ gpio_parse_config (const char *params)
{"tms=",GPIO_TMS}, {"tms=",GPIO_TMS},
{"tdi=",GPIO_TDI}, {"tdi=",GPIO_TDI},
{"tdo=",GPIO_TDO}, {"tdo=",GPIO_TDO},
{"tck=",GPIO_TCK} {"tck=",GPIO_TCK},
{"rst=",GPIO_RST},
{"tst=",GPIO_TST}
}; };
int i; int i;
for( i = 0;i < 4; i++) { for( i = 0;i < 6; i++) {
char* help; char* help;
help = strstr(params,ops[i].name); help = strstr(params,ops[i].name);
if (help) if (help)
jtag_gpios[ops[i].num] = atoi(help+4); jtag_gpios[ops[i].num] = atoi(help+6);
else else
return -1; return -1;
printf("gpio %s %d\n", ops[i].name,jtag_gpios[ops[i].num]); 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) 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) 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) static int jtgpio_tdo_get(struct jtdev *p)