#include #include #include #include "output.h" #include "jtaglib.h" #include "sr_global.h" #include "gpio_helpers.h" #include "mspdebug_wrapper.h" #include "con_usart.h" #include #define BLOCK_SIZE 512 /* bytes */ static void sr_delay_inst(void); static struct jtdev sr_jtdev; static struct jtdev sr_jtdev_default; enum sr_gpio_types { SR_GPIO_TCK, SR_GPIO_TMS, SR_GPIO_TDI, SR_GPIO_RST, SR_GPIO_TST, SR_GPIO_TDO, SR_NUM_GPIOS }; struct { GPIO_TypeDef *gpio; int pin; int mode; } gpios[SR_NUM_GPIOS] = { [SR_GPIO_TCK] = {GPIOE, 10, 1}, [SR_GPIO_TMS] = {GPIOE, 11, 1}, [SR_GPIO_TDI] = {GPIOE, 12, 1}, [SR_GPIO_RST] = {GPIOE, 9, 1}, [SR_GPIO_TST] = {GPIOE, 14, 1}, [SR_GPIO_TDO] = {GPIOE, 13, 0}, }; void sr_delay_inst() { for (int i=0; i<10; i++) asm volatile("nop"); } void mspd_jtag_init() { for (int i=0; iBSRR = 1<BSRR = 1< 0 && fmt[i-1] == '\n') usart_putc_nonblocking(&con_usart, '\r'); return rc; } static void sr_jtdev_power_on(struct jtdev *p) { UNUSED(p); /* ignore */ } static void sr_jtdev_connect(struct jtdev *p) { UNUSED(p); /* ignore */ } static void sr_jtdev_tck(struct jtdev *p, int out) { UNUSED(p); sr_gpio_write(SR_GPIO_TCK, out); } static void sr_jtdev_tms(struct jtdev *p, int out) { UNUSED(p); sr_gpio_write(SR_GPIO_TMS, out); } static void sr_jtdev_tdi(struct jtdev *p, int out) { UNUSED(p); sr_gpio_write(SR_GPIO_TDI, out); } static void sr_jtdev_tst(struct jtdev *p, int out) { UNUSED(p); sr_gpio_write(SR_GPIO_TST, out); } static int sr_jtdev_tdo_get(struct jtdev *p) { UNUSED(p); return !!(gpios[SR_GPIO_TDO].gpio->IDR & (1<ODR & (1<BSRR = 1<BSRR = 1<