diff --git a/include/shell/jtag.h b/include/shell/jtag.h new file mode 100644 index 0000000..596b05c --- /dev/null +++ b/include/shell/jtag.h @@ -0,0 +1,3 @@ +#pragma once + +int shell_jtag(struct console *con, size_t argc, const char **argv); diff --git a/source/shell/jtag.c b/source/shell/jtag.c new file mode 100644 index 0000000..be4b32b --- /dev/null +++ b/source/shell/jtag.c @@ -0,0 +1,28 @@ +#include +#include +#include + +#include + +#include + +int shell_jtag(struct console *con, size_t argc, const char **argv) +{ + int state = 0; + + (void)con; + + if (argc >= 2) { + state = (strcmp(argv[1], "on") == 0); + } + + if (state) { + gpio_primary_remap(AFIO_MAPR_SWJ_CFG_FULL_SWJ, + AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1); + } else { + gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, + AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1); + } + + return 0; +}