samd: convert_tdio requires enable/disable
This commit is contained in:
parent
c1b3d0c629
commit
cd325dfe52
@ -321,10 +321,15 @@ static bool cmd_debug_bmp(target *t, int argc, const char **argv)
|
||||
static bool cmd_convert_tdio(target *t, int argc, const char **argv)
|
||||
{
|
||||
(void)t;
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
usbuart_convert_tdio(0);
|
||||
uint8_t val;
|
||||
if (argc > 1) {
|
||||
val = (!strcmp(argv[1], "enable")) ? true : false;
|
||||
usbuart_convert_tdio(val);
|
||||
} else {
|
||||
gdb_outf("Convert_tdio: %s\n",(usbuart_convert_tdio_enabled()) ?
|
||||
"enabled" : "disabled");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -220,5 +220,6 @@ static inline int platform_hwversion(void)
|
||||
|
||||
void uart_pop(void);
|
||||
int usbuart_convert_tdio(uint32_t arg);
|
||||
int usbuart_convert_tdio_enabled(void);
|
||||
void print_serial(void);
|
||||
#endif
|
||||
|
@ -96,12 +96,15 @@ void usbuart_init(void)
|
||||
usart_enable_tx_interrupt(USART_NUM);
|
||||
}
|
||||
|
||||
static uint8_t convert_tdio_enabled;
|
||||
int usbuart_convert_tdio(uint32_t arg)
|
||||
{
|
||||
|
||||
(void) arg;
|
||||
|
||||
if (USART_NUM) {
|
||||
convert_tdio_enabled = arg;
|
||||
|
||||
if (!convert_tdio_enabled) {
|
||||
usart_disable(1);
|
||||
USART_NUM = 0;
|
||||
usbuart_init();
|
||||
@ -131,6 +134,11 @@ int usbuart_convert_tdio(uint32_t arg)
|
||||
|
||||
}
|
||||
|
||||
int usbuart_convert_tdio_enabled(void)
|
||||
{
|
||||
return convert_tdio_enabled;
|
||||
}
|
||||
|
||||
void usbuart_set_line_coding(struct usb_cdc_line_coding *coding)
|
||||
{
|
||||
uint8_t sbmode = (coding->bCharFormat == 2) ? 1 : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user