Skip to content

Commit a6019f4

Browse files
committed
Add hd option for jtag and 3-wire mode
Fix issue #161
1 parent b06dce6 commit a6019f4

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/hydrabus/commands.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,11 @@ t_token tokens_mode_jtag[] = {
11631163
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
11641164
.help = "Read byte (repeat with :<num>)"
11651165
},
1166+
{
1167+
T_HD,
1168+
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
1169+
.help = "Read byte (repeat with :<num>) and print hexdump"
1170+
},
11661171
{
11671172
T_WRITE,
11681173
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
@@ -1569,6 +1574,11 @@ t_token tokens_mode_threewire[] = {
15691574
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
15701575
.help = "Read byte (repeat with :<num>)"
15711576
},
1577+
{
1578+
T_HD,
1579+
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
1580+
.help = "Read byte (repeat with :<num>) and print hexdump"
1581+
},
15721582
{
15731583
T_WRITE,
15741584
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,

src/hydrabus/hydrabus_mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static int hydrabus_mode_hexdump(t_hydra_console *con, t_tokenline_parsed *p,
488488
to_rx = (count-bytes_read);
489489
}
490490

491-
if(con->mode->exec->read != NULL) {
491+
if(con->mode->exec->dump != NULL) {
492492
mode_status = con->mode->exec->dump(con, p_proto->buffer_rx, to_rx);
493493
}
494494
if (mode_status == HYDRABUS_MODE_STATUS_OK) {

src/hydrabus/hydrabus_mode_jtag.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,18 @@ static uint32_t read(t_hydra_console *con, uint8_t *rx_data, uint8_t nb_data)
959959
return BSP_OK;
960960
}
961961

962+
static uint32_t dump(t_hydra_console *con, uint8_t *rx_data, uint8_t nb_data)
963+
{
964+
uint8_t i;
965+
966+
i = 0;
967+
while(i < nb_data) {
968+
rx_data[i] = jtag_read_u8(con);
969+
i++;
970+
}
971+
return BSP_OK;
972+
}
973+
962974
static void cleanup(t_hydra_console *con)
963975
{
964976
jtag_pin_deinit(con);
@@ -990,6 +1002,7 @@ const mode_exec_t mode_jtag_exec = {
9901002
.exec = &exec,
9911003
.write = &write,
9921004
.read = &read,
1005+
.dump = &dump,
9931006
.cleanup = &cleanup,
9941007
.get_prompt = &get_prompt,
9951008
.clkl = &clkl,

0 commit comments

Comments
 (0)