Skip to content

Commit

Permalink
Implement new proposal for DJTAG2: read commands do not terminate the…
Browse files Browse the repository at this point in the history
… command stream.
  • Loading branch information
phdussud committed Jul 6, 2021
1 parent 35d3a51 commit 2d4c959
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ cmake ..
make
```

If everything success you should have a `dirtyJtag.uf2` file you can directly upload to the Pi Pico.
If everything succeeds you should have a `dirtyJtag.uf2` file that you can directly upload to the Pi Pico.
18 changes: 5 additions & 13 deletions cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void cmd_setvoltage(const uint8_t *commands);
*/
static void cmd_gotobootloader(void);

uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf) {
void cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf) {
uint8_t *commands= (uint8_t*)rxbuf;

while (*commands != CMD_STOP) {
Expand All @@ -158,7 +158,7 @@ uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_
case CMD_XFER|EXTEND_LENGTH:
case CMD_XFER|NO_READ|EXTEND_LENGTH:
cmd_xfer(jtag, commands, *commands & EXTEND_LENGTH, *commands & NO_READ, tx_buf);
return !!(*commands & NO_READ);
return;
break;

case CMD_SETSIG:
Expand All @@ -168,19 +168,11 @@ uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_

case CMD_GETSIG:
cmd_getsig(jtag);
return 0;
break;

case CMD_CLK:
cmd_clk(jtag, commands, !!(*commands & READOUT));
if (*commands & READOUT)
{
return 0;
}
else
{
commands += 2;
}
commands += 2;
break;

case CMD_SETVOLTAGE:
Expand All @@ -193,14 +185,14 @@ uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_
break;

default:
return 1; /* Unsupported command, halt */
return; /* Unsupported command, halt */
break;
}

commands++;
}

return 1;
return;
}

static void cmd_info() {
Expand Down
2 changes: 1 addition & 1 deletion cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
* @param transfer Received packet
* @return Command needs to send data back to host
*/
uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf);
void cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf);

0 comments on commit 2d4c959

Please sign in to comment.