Buspirate: fix shadow

__archive__
Michal Demin 2010-07-10 10:08:18 +02:00 committed by Øyvind Harboe
parent 450aaad1e9
commit 51d9b56861
1 changed files with 14 additions and 14 deletions

View File

@ -633,24 +633,24 @@ static void buspirate_tap_make_space(int scans, int bits)
static void buspirate_tap_append(int tms, int tdi) static void buspirate_tap_append(int tms, int tdi)
{ {
int index; int chain_index;
buspirate_tap_make_space(0, 1); buspirate_tap_make_space(0, 1);
index = tap_chain_index / 8; chain_index = tap_chain_index / 8;
if (index < BUSPIRATE_BUFFER_SIZE) { if (chain_index < BUSPIRATE_BUFFER_SIZE) {
int bit_index = tap_chain_index % 8; int bit_index = tap_chain_index % 8;
uint8_t bit = 1 << bit_index; uint8_t bit = 1 << bit_index;
if (tms) if (tms)
tms_chain[index] |= bit; tms_chain[chain_index] |= bit;
else else
tms_chain[index] &= ~bit; tms_chain[chain_index] &= ~bit;
if (tdi) if (tdi)
tdi_chain[index] |= bit; tdi_chain[chain_index] |= bit;
else else
tdi_chain[index] &= ~bit; tdi_chain[chain_index] &= ~bit;
tap_chain_index++; tap_chain_index++;
} else } else
@ -832,13 +832,13 @@ static void buspirate_jtag_get_adcs(int fd)
((float)c)/155.1515, ((float)d)/155.1515); ((float)c)/155.1515, ((float)d)/155.1515);
} }
static unsigned char buspirate_jtag_command(int buspirate_fd, static unsigned char buspirate_jtag_command(int fd,
char *cmd, int cmdlen) char *cmd, int cmdlen)
{ {
int res; int res;
int len = 0; int len = 0;
res = buspirate_serial_write(buspirate_fd, cmd, cmdlen); res = buspirate_serial_write(fd, cmd, cmdlen);
if ((cmd[0] == CMD_UART_SPEED) if ((cmd[0] == CMD_UART_SPEED)
|| (cmd[0] == CMD_PORT_MODE) || (cmd[0] == CMD_PORT_MODE)
@ -857,7 +857,7 @@ static unsigned char buspirate_jtag_command(int buspirate_fd,
default: default:
LOG_INFO("Wrong !"); LOG_INFO("Wrong !");
} }
res = buspirate_serial_read(buspirate_fd, cmd, len); res = buspirate_serial_read(fd, cmd, len);
if (res > 0) if (res > 0)
return (unsigned char)cmd[1]; return (unsigned char)cmd[1];
else else
@ -874,8 +874,8 @@ static int buspirate_serial_setspeed(int fd, speed_t speed)
struct termios t_opt; struct termios t_opt;
/* set the serial port parameters */ /* set the serial port parameters */
fcntl(buspirate_fd, F_SETFL, 0); fcntl(fd, F_SETFL, 0);
tcgetattr(buspirate_fd, &t_opt); tcgetattr(fd, &t_opt);
cfsetispeed(&t_opt, speed); cfsetispeed(&t_opt, speed);
cfsetospeed(&t_opt, speed); cfsetospeed(&t_opt, speed);
t_opt.c_cflag |= (CLOCAL | CREAD); t_opt.c_cflag |= (CLOCAL | CREAD);
@ -888,8 +888,8 @@ static int buspirate_serial_setspeed(int fd, speed_t speed)
t_opt.c_oflag &= ~OPOST; t_opt.c_oflag &= ~OPOST;
t_opt.c_cc[VMIN] = 0; t_opt.c_cc[VMIN] = 0;
t_opt.c_cc[VTIME] = 10; t_opt.c_cc[VTIME] = 10;
tcflush(buspirate_fd, TCIFLUSH); tcflush(fd, TCIFLUSH);
tcsetattr(buspirate_fd, TCSANOW, &t_opt); tcsetattr(fd, TCSANOW, &t_opt);
return 0; return 0;
} }