stlink: Decrease delay with SWD turn around for native,stlink and swlink.

This commit is contained in:
Uwe Bonnes 2018-03-06 18:36:09 +01:00
parent 5548d54626
commit 97561fc5cc
3 changed files with 43 additions and 20 deletions

View File

@ -108,20 +108,27 @@
#define LED_IDLE_RUN LED_1
#define LED_ERROR LED_2
# define SWD_CR GPIO_CRL(SWDIO_PORT)
# define SWD_CR_MULT (1 << (4 << 2))
#define TMS_SET_MODE() do { \
gpio_set(TMS_DIR_PORT, TMS_DIR_PIN); \
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN); \
} while(0)
#define SWDIO_MODE_FLOAT() do { \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_INPUT, \
GPIO_CNF_INPUT_FLOAT, SWDIO_PIN); \
gpio_clear(SWDIO_DIR_PORT, SWDIO_DIR_PIN); \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x4 * SWD_CR_MULT); \
GPIO_BRR(SWDIO_DIR_PORT) = SWDIO_DIR_PIN; \
SWD_CR = cr; \
} while(0)
#define SWDIO_MODE_DRIVE() do { \
gpio_set(SWDIO_DIR_PORT, SWDIO_DIR_PIN); \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN); \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x1 * SWD_CR_MULT); \
GPIO_BSRR(SWDIO_DIR_PORT) = SWDIO_DIR_PIN; \
SWD_CR = cr; \
} while(0)
#define UART_PIN_SETUP() do { \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \

View File

@ -71,16 +71,24 @@
#define PLATFORM_HAS_TRACESWO 1
#define NUM_TRACE_PACKETS (128) /* This is an 8K buffer */
# define SWD_CR GPIO_CRH(SWDIO_PORT)
# define SWD_CR_MULT (1 << ((14 - 8) << 2))
#define TMS_SET_MODE() \
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN);
#define SWDIO_MODE_FLOAT() \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_INPUT, \
GPIO_CNF_INPUT_FLOAT, SWDIO_PIN);
#define SWDIO_MODE_DRIVE() \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN);
#define SWDIO_MODE_FLOAT() do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x4 * SWD_CR_MULT); \
SWD_CR = cr; \
} while(0)
#define SWDIO_MODE_DRIVE() do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x1 * SWD_CR_MULT); \
SWD_CR = cr; \
} while(0)
#define UART_PIN_SETUP() \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN);

View File

@ -58,16 +58,24 @@
#define LED_PORT_UART GPIOC
#define LED_UART GPIO14
# define SWD_CR GPIO_CRH(SWDIO_PORT)
# define SWD_CR_MULT (1 << ((13 - 8) << 2))
#define TMS_SET_MODE() \
gpio_set_mode(TMS_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, TMS_PIN);
#define SWDIO_MODE_FLOAT() \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_INPUT, \
GPIO_CNF_INPUT_FLOAT, SWDIO_PIN);
#define SWDIO_MODE_DRIVE() \
gpio_set_mode(SWDIO_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN);
#define SWDIO_MODE_FLOAT() do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x4 * SWD_CR_MULT); \
SWD_CR = cr; \
} while(0)
#define SWDIO_MODE_DRIVE() do { \
uint32_t cr = SWD_CR; \
cr &= ~(0xf * SWD_CR_MULT); \
cr |= (0x1 * SWD_CR_MULT); \
SWD_CR = cr; \
} while(0)
#define UART_PIN_SETUP() do { \
AFIO_MAPR |= AFIO_MAPR_USART1_REMAP; \
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \