Skip to content

Commit

Permalink
OpenOCD mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Baldanos committed Feb 5, 2016
1 parent a6c9697 commit f5350d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions hydrabus/hydrabus_bbio.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <ctype.h>

#include "bsp_spi.h"
#include "hydrabus_mode_jtag.h"

static void bbio_spi_init_proto_default(t_hydra_console *con)
{
Expand Down Expand Up @@ -183,6 +184,10 @@ int cmd_bbio(t_hydra_console *con)
cprint(con, "RAW1", 4);
//TODO
break;
case BBIO_JTAG:
cprint(con, "OCD1", 4);
openOCD(con);
break;
case BBIO_RESET_HW:
return TRUE;
default:
Expand Down
8 changes: 1 addition & 7 deletions hydrabus/hydrabus_mode_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ static uint8_t ocd_shift_u8(uint8_t tdi, uint8_t tms, uint8_t num_bits)
return tdo;
}

static void openOCD(t_hydra_console *con)
void openOCD(t_hydra_console *con)
{
mode_config_proto_t* proto = &con->mode->proto;

Expand All @@ -538,16 +538,10 @@ static void openOCD(t_hydra_console *con)
uint16_t num_sequences, i;
uint16_t offset, bits;

cprintf(con, "Interrupt by pressing user button.\r\n");
cprint(con, "\r\n", 2);

while (!USER_BUTTON) {
if(chnReadTimeout(con->sdu, &ocd_command, 1, 1)) {
switch(ocd_command) {
case CMD_OCD_UNKNOWN:
if(chSequentialStreamRead(con->sdu, g_sbuf, 19) == 19) {
cprintf(con, "BBIO1");
}
break;
case CMD_OCD_ENTER_OOCD:
cprintf(con, "OCD1");
Expand Down
2 changes: 2 additions & 0 deletions hydrabus/hydrabus_mode_jtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ enum {
FEATURE_SRST=0x08,
FEATURE_PULLUP=0x10
};

void openOCD(t_hydra_console *con);

0 comments on commit f5350d1

Please sign in to comment.