Skip to content

Commit

Permalink
Merge pull request #65 from Manawyrm/jtag-switch-case
Browse files Browse the repository at this point in the history
cmd: jtag: Fix build failure on GCC9

Signed-off-by: Andrew Jeffery <[email protected]>
  • Loading branch information
amboar authored Oct 17, 2024
2 parents e0f9ac2 + 0cab98a commit c80560d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/cmd/jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ static int run_openocd_bitbang_server(struct jtag *jtag, uint16_t port)
logi("New connection from %s\n", inet_ntoa(client_addr.sin_addr));

while (true) {
int rc;
uint8_t state;
uint8_t tdo;
uint8_t tdi;
uint8_t tms;
uint8_t tck;

char command = 0;
ssize_t n = read(client_fd, &command, 1);
if (n <= 0) {
Expand All @@ -93,8 +100,7 @@ static int run_openocd_bitbang_server(struct jtag *jtag, uint16_t port)
break;
/* Read state */
case 'R':
uint8_t tdo = 0;
int rc = jtag_bitbang_get(jtag, &tdo);
rc = jtag_bitbang_get(jtag, &tdo);
if (rc < 0) {
loge("jtag_bitbang_get() failed\n");
return 1;
Expand All @@ -115,11 +121,11 @@ static int run_openocd_bitbang_server(struct jtag *jtag, uint16_t port)
return 1;
/* Data requests */
case '0'...'7':
uint8_t state = command - '0';
state = command - '0';

uint8_t tdi = !!(state & 1);
uint8_t tms = !!(state & 2);
uint8_t tck = !!(state & 4);
tdi = !!(state & 1);
tms = !!(state & 2);
tck = !!(state & 4);

rc = jtag_bitbang_set(jtag, tck, tms, tdi);
if (rc < 0) {
Expand Down

0 comments on commit c80560d

Please sign in to comment.