cdcacm: Renamed cdcacm_get_config() -> usb_get_config()
This commit is contained in:
parent
983a541cab
commit
bf6c146786
|
@ -103,7 +103,7 @@ static enum usbd_request_return_codes debug_uart_control_request(usbd_device *de
|
||||||
return USBD_REQ_NOTSUPP;
|
return USBD_REQ_NOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cdcacm_get_config(void)
|
int usb_get_config(void)
|
||||||
{
|
{
|
||||||
return configured;
|
return configured;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
void usb_serial_set_config(usbd_device *dev, uint16_t wValue);
|
void usb_serial_set_config(usbd_device *dev, uint16_t wValue);
|
||||||
/* Returns current usb configuration, or 0 if not configured. */
|
/* 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);
|
bool gdb_uart_get_dtr(void);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void gdb_if_putchar(unsigned char c, int flush)
|
||||||
if(flush || (count_in == CDCACM_PACKET_SIZE)) {
|
if(flush || (count_in == CDCACM_PACKET_SIZE)) {
|
||||||
/* Refuse to send if USB isn't configured, and
|
/* Refuse to send if USB isn't configured, and
|
||||||
* don't bother if nobody's listening */
|
* 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;
|
count_in = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void gdb_usb_out_cb(usbd_device *dev, uint8_t ep)
|
||||||
|
|
||||||
static void gdb_if_update_buf(void)
|
static void gdb_if_update_buf(void)
|
||||||
{
|
{
|
||||||
while (cdcacm_get_config() != 1);
|
while (usb_get_config() != 1);
|
||||||
#ifdef STM32F4
|
#ifdef STM32F4
|
||||||
__asm__ volatile("cpsid i; isb");
|
__asm__ volatile("cpsid i; isb");
|
||||||
if (count_new) {
|
if (count_new) {
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool rtt_nodata()
|
||||||
/* rtt target to host: write string */
|
/* rtt target to host: write string */
|
||||||
uint32_t rtt_write(const char *buf, uint32_t len)
|
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) {
|
for (uint32_t p = 0; p < len; p += CDCACM_PACKET_SIZE) {
|
||||||
uint32_t plen = MIN(CDCACM_PACKET_SIZE, len - p);
|
uint32_t plen = MIN(CDCACM_PACKET_SIZE, len - p);
|
||||||
while(usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, buf + p, plen) <= 0);
|
while(usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, buf + p, plen) <= 0);
|
||||||
|
|
|
@ -47,7 +47,7 @@ uint16_t traceswo_decode(usbd_device *usbd_dev, uint8_t addr,
|
||||||
if (swo_print) {
|
if (swo_print) {
|
||||||
swo_buf[swo_buf_len++]=ch;
|
swo_buf[swo_buf_len++]=ch;
|
||||||
if (swo_buf_len == sizeof(swo_buf)) {
|
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);
|
usbd_ep_write_packet(usbd_dev, addr, swo_buf, swo_buf_len);
|
||||||
swo_buf_len=0;
|
swo_buf_len=0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ static void usbuart_send_rx_packet(void)
|
||||||
|
|
||||||
/* Forcibly empty fifo if no USB endpoint.
|
/* Forcibly empty fifo if no USB endpoint.
|
||||||
* If fifo empty, nothing further to do. */
|
* 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
|
#ifdef USBUART_DEBUG
|
||||||
&& usb_dbg_in == usb_dbg_out
|
&& usb_dbg_in == usb_dbg_out
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,7 @@ void gdb_if_putchar(unsigned char c, int flush)
|
||||||
if(flush || (count_in == CDCACM_PACKET_SIZE)) {
|
if(flush || (count_in == CDCACM_PACKET_SIZE)) {
|
||||||
/* Refuse to send if USB isn't configured, and
|
/* Refuse to send if USB isn't configured, and
|
||||||
* don't bother if nobody's listening */
|
* 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;
|
count_in = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ unsigned char gdb_if_getchar(void)
|
||||||
if(!gdb_uart_get_dtr())
|
if(!gdb_uart_get_dtr())
|
||||||
return 0x04;
|
return 0x04;
|
||||||
|
|
||||||
while(cdcacm_get_config() != 1);
|
while(usb_get_config() != 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer_out[tail_out++ % sizeof(buffer_out)];
|
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())
|
if(!gdb_uart_get_dtr())
|
||||||
return 0x04;
|
return 0x04;
|
||||||
|
|
||||||
while(cdcacm_get_config() != 1);
|
while(usb_get_config() != 1);
|
||||||
} while(!platform_timeout_is_expired(&t) && head_out == tail_out);
|
} while(!platform_timeout_is_expired(&t) && head_out == tail_out);
|
||||||
|
|
||||||
if(head_out != tail_out)
|
if(head_out != tail_out)
|
||||||
|
|
|
@ -165,7 +165,7 @@ void USBUART_ISR(void)
|
||||||
|
|
||||||
if (flush) {
|
if (flush) {
|
||||||
/* forcibly empty fifo if no USB endpoint */
|
/* forcibly empty fifo if no USB endpoint */
|
||||||
if (cdcacm_get_config() != 1)
|
if (usb_get_config() != 1)
|
||||||
{
|
{
|
||||||
buf_rx_out = buf_rx_in;
|
buf_rx_out = buf_rx_in;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue