Skip to content

Commit 2d4c959

Browse files
committed
Implement new proposal for DJTAG2: read commands do not terminate the command stream.
1 parent 35d3a51 commit 2d4c959

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ cmake ..
2727
make
2828
```
2929

30-
If everything success you should have a `dirtyJtag.uf2` file you can directly upload to the Pi Pico.
30+
If everything succeeds you should have a `dirtyJtag.uf2` file that you can directly upload to the Pi Pico.

cmd.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void cmd_setvoltage(const uint8_t *commands);
139139
*/
140140
static void cmd_gotobootloader(void);
141141

142-
uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf) {
142+
void cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf) {
143143
uint8_t *commands= (uint8_t*)rxbuf;
144144

145145
while (*commands != CMD_STOP) {
@@ -158,7 +158,7 @@ uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_
158158
case CMD_XFER|EXTEND_LENGTH:
159159
case CMD_XFER|NO_READ|EXTEND_LENGTH:
160160
cmd_xfer(jtag, commands, *commands & EXTEND_LENGTH, *commands & NO_READ, tx_buf);
161-
return !!(*commands & NO_READ);
161+
return;
162162
break;
163163

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

169169
case CMD_GETSIG:
170170
cmd_getsig(jtag);
171-
return 0;
172171
break;
173172

174173
case CMD_CLK:
175174
cmd_clk(jtag, commands, !!(*commands & READOUT));
176-
if (*commands & READOUT)
177-
{
178-
return 0;
179-
}
180-
else
181-
{
182-
commands += 2;
183-
}
175+
commands += 2;
184176
break;
185177

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

195187
default:
196-
return 1; /* Unsupported command, halt */
188+
return; /* Unsupported command, halt */
197189
break;
198190
}
199191

200192
commands++;
201193
}
202194

203-
return 1;
195+
return;
204196
}
205197

206198
static void cmd_info() {

cmd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
* @param transfer Received packet
2727
* @return Command needs to send data back to host
2828
*/
29-
uint8_t cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf);
29+
void cmd_handle(pio_jtag_inst_t* jtag, uint8_t* rxbuf, uint32_t count, uint8_t* tx_buf);

0 commit comments

Comments
 (0)