diff --git a/src/platforms/common/cdcacm.c b/src/platforms/common/cdcacm.c index 2367f0e..75c2a5d 100644 --- a/src/platforms/common/cdcacm.c +++ b/src/platforms/common/cdcacm.c @@ -103,7 +103,7 @@ static enum usbd_request_return_codes debug_uart_control_request(usbd_device *de return USBD_REQ_NOTSUPP; } -int cdcacm_get_config(void) +int usb_get_config(void) { return configured; } diff --git a/src/platforms/common/cdcacm.h b/src/platforms/common/cdcacm.h index 1c857bb..d59a662 100644 --- a/src/platforms/common/cdcacm.h +++ b/src/platforms/common/cdcacm.h @@ -33,7 +33,7 @@ void usb_serial_set_config(usbd_device *dev, uint16_t wValue); /* Returns current usb configuration, or 0 if not configured. */ -int cdcacm_get_config(void); +int usb_get_config(void); bool gdb_uart_get_dtr(void); diff --git a/src/platforms/stm32/gdb_if.c b/src/platforms/stm32/gdb_if.c index ff7cd5f..fc87267 100644 --- a/src/platforms/stm32/gdb_if.c +++ b/src/platforms/stm32/gdb_if.c @@ -45,7 +45,7 @@ void gdb_if_putchar(unsigned char c, int flush) if(flush || (count_in == CDCACM_PACKET_SIZE)) { /* Refuse to send if USB isn't configured, and * don't bother if nobody's listening */ - if((cdcacm_get_config() != 1) || !gdb_uart_get_dtr()) { + if((usb_get_config() != 1) || !gdb_uart_get_dtr()) { count_in = 0; return; } @@ -82,7 +82,7 @@ void gdb_usb_out_cb(usbd_device *dev, uint8_t ep) static void gdb_if_update_buf(void) { - while (cdcacm_get_config() != 1); + while (usb_get_config() != 1); #ifdef STM32F4 __asm__ volatile("cpsid i; isb"); if (count_new) { diff --git a/src/platforms/stm32/rtt_if.c b/src/platforms/stm32/rtt_if.c index 0816ce7..3f3be5e 100644 --- a/src/platforms/stm32/rtt_if.c +++ b/src/platforms/stm32/rtt_if.c @@ -121,7 +121,7 @@ bool rtt_nodata() /* rtt target to host: write string */ uint32_t rtt_write(const char *buf, uint32_t len) { - if (len != 0 && usbdev && cdcacm_get_config() && gdb_uart_get_dtr()) { + if (len != 0 && usbdev && usb_get_config() && gdb_uart_get_dtr()) { for (uint32_t p = 0; p < len; p += CDCACM_PACKET_SIZE) { uint32_t plen = MIN(CDCACM_PACKET_SIZE, len - p); while(usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, buf + p, plen) <= 0); diff --git a/src/platforms/stm32/traceswodecode.c b/src/platforms/stm32/traceswodecode.c index 24ae2ff..3086e2d 100644 --- a/src/platforms/stm32/traceswodecode.c +++ b/src/platforms/stm32/traceswodecode.c @@ -47,7 +47,7 @@ uint16_t traceswo_decode(usbd_device *usbd_dev, uint8_t addr, if (swo_print) { swo_buf[swo_buf_len++]=ch; if (swo_buf_len == sizeof(swo_buf)) { - if (cdcacm_get_config() && gdb_uart_get_dtr()) /* silently drop if usb not ready */ + if (usb_get_config() && gdb_uart_get_dtr()) /* silently drop if usb not ready */ usbd_ep_write_packet(usbd_dev, addr, swo_buf, swo_buf_len); swo_buf_len=0; } diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index 4a8ae6d..9c2f2c3 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -358,7 +358,7 @@ static void usbuart_send_rx_packet(void) /* Forcibly empty fifo if no USB endpoint. * If fifo empty, nothing further to do. */ - if (cdcacm_get_config() != 1 || (buf_rx_in == buf_rx_out + if (usb_get_config() != 1 || (buf_rx_in == buf_rx_out #ifdef USBUART_DEBUG && usb_dbg_in == usb_dbg_out #endif diff --git a/src/platforms/tm4c/gdb_if.c b/src/platforms/tm4c/gdb_if.c index 8694e7d..d363b59 100644 --- a/src/platforms/tm4c/gdb_if.c +++ b/src/platforms/tm4c/gdb_if.c @@ -40,7 +40,7 @@ void gdb_if_putchar(unsigned char c, int flush) if(flush || (count_in == CDCACM_PACKET_SIZE)) { /* Refuse to send if USB isn't configured, and * don't bother if nobody's listening */ - if((cdcacm_get_config() != 1) || !gdb_uart_get_dtr()) { + if((usb_get_config() != 1) || !gdb_uart_get_dtr()) { count_in = 0; return; } @@ -76,7 +76,7 @@ unsigned char gdb_if_getchar(void) if(!gdb_uart_get_dtr()) return 0x04; - while(cdcacm_get_config() != 1); + while(usb_get_config() != 1); } return buffer_out[tail_out++ % sizeof(buffer_out)]; @@ -92,7 +92,7 @@ unsigned char gdb_if_getchar_to(int timeout) if(!gdb_uart_get_dtr()) return 0x04; - while(cdcacm_get_config() != 1); + while(usb_get_config() != 1); } while(!platform_timeout_is_expired(&t) && head_out == tail_out); if(head_out != tail_out) diff --git a/src/platforms/tm4c/usbuart.c b/src/platforms/tm4c/usbuart.c index e0ee624..647037f 100644 --- a/src/platforms/tm4c/usbuart.c +++ b/src/platforms/tm4c/usbuart.c @@ -165,7 +165,7 @@ void USBUART_ISR(void) if (flush) { /* forcibly empty fifo if no USB endpoint */ - if (cdcacm_get_config() != 1) + if (usb_get_config() != 1) { buf_rx_out = buf_rx_in; return;