cdcacm: Renamed cdcacm_get_config() -> usb_get_config()

This commit is contained in:
dragonmux 2022-08-10 10:03:39 +01:00 committed by Piotr Esden-Tempski
parent 983a541cab
commit bf6c146786
8 changed files with 11 additions and 11 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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;