Skip to content

Commit

Permalink
Add hd option for jtag and 3-wire mode
Browse files Browse the repository at this point in the history
Fix issue #161
  • Loading branch information
bvernoux committed Feb 4, 2024
1 parent b06dce6 commit a6019f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/hydrabus/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,11 @@ t_token tokens_mode_jtag[] = {
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
.help = "Read byte (repeat with :<num>)"
},
{
T_HD,
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
.help = "Read byte (repeat with :<num>) and print hexdump"
},
{
T_WRITE,
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
Expand Down Expand Up @@ -1569,6 +1574,11 @@ t_token tokens_mode_threewire[] = {
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
.help = "Read byte (repeat with :<num>)"
},
{
T_HD,
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
.help = "Read byte (repeat with :<num>) and print hexdump"
},
{
T_WRITE,
.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
Expand Down
2 changes: 1 addition & 1 deletion src/hydrabus/hydrabus_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static int hydrabus_mode_hexdump(t_hydra_console *con, t_tokenline_parsed *p,
to_rx = (count-bytes_read);
}

if(con->mode->exec->read != NULL) {
if(con->mode->exec->dump != NULL) {
mode_status = con->mode->exec->dump(con, p_proto->buffer_rx, to_rx);
}
if (mode_status == HYDRABUS_MODE_STATUS_OK) {
Expand Down
13 changes: 13 additions & 0 deletions src/hydrabus/hydrabus_mode_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,18 @@ static uint32_t read(t_hydra_console *con, uint8_t *rx_data, uint8_t nb_data)
return BSP_OK;
}

static uint32_t dump(t_hydra_console *con, uint8_t *rx_data, uint8_t nb_data)
{
uint8_t i;

i = 0;
while(i < nb_data) {
rx_data[i] = jtag_read_u8(con);
i++;
}
return BSP_OK;
}

static void cleanup(t_hydra_console *con)
{
jtag_pin_deinit(con);
Expand Down Expand Up @@ -990,6 +1002,7 @@ const mode_exec_t mode_jtag_exec = {
.exec = &exec,
.write = &write,
.read = &read,
.dump = &dump,
.cleanup = &cleanup,
.get_prompt = &get_prompt,
.clkl = &clkl,
Expand Down

0 comments on commit a6019f4

Please sign in to comment.