You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
507 B
28 lines
507 B
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <libopencm3/stm32/gpio.h>
|
|
|
|
#include <console.h>
|
|
|
|
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;
|
|
}
|
|
|