cdcacm: More naming fixes for various functions

This commit is contained in:
dragonmux 2022-08-10 09:58:02 +01:00 committed by Piotr Esden-Tempski
parent 49d21b0f44
commit 983a541cab
3 changed files with 9 additions and 10 deletions

View File

@ -52,7 +52,7 @@ static int configured;
static bool gdb_uart_dtr = true;
static void cdcacm_set_modem_state(usbd_device *dev, uint16_t iface, uint8_t ep);
static void usb_serial_set_state(usbd_device *dev, uint16_t iface, uint8_t ep);
static enum usbd_request_return_codes gdb_uart_control_request(usbd_device *dev, struct usb_setup_data *req,
uint8_t **buf, uint16_t *const len, void (**complete)(usbd_device *dev, struct usb_setup_data *req))
@ -65,7 +65,7 @@ static enum usbd_request_return_codes gdb_uart_control_request(usbd_device *dev,
switch (req->bRequest) {
case USB_CDC_REQ_SET_CONTROL_LINE_STATE:
cdcacm_set_modem_state(dev, req->wIndex, CDCACM_GDB_ENDPOINT);
usb_serial_set_state(dev, req->wIndex, CDCACM_GDB_ENDPOINT);
gdb_uart_dtr = req->wValue & 1;
return USBD_REQ_HANDLED;
case USB_CDC_REQ_SET_LINE_CODING:
@ -86,7 +86,7 @@ static enum usbd_request_return_codes debug_uart_control_request(usbd_device *de
switch (req->bRequest) {
case USB_CDC_REQ_SET_CONTROL_LINE_STATE:
cdcacm_set_modem_state(dev, req->wIndex, CDCACM_UART_ENDPOINT);
usb_serial_set_state(dev, req->wIndex, CDCACM_UART_ENDPOINT);
#ifdef USBUSART_DTR_PIN
gpio_set_val(USBUSART_PORT, USBUSART_DTR_PIN, !(req->wValue & 1));
#endif
@ -113,7 +113,7 @@ bool gdb_uart_get_dtr(void)
return gdb_uart_dtr;
}
static void cdcacm_set_modem_state(usbd_device *dev, const uint16_t iface, const uint8_t ep)
void usb_serial_set_state(usbd_device *const dev, const uint16_t iface, const uint8_t ep)
{
uint8_t buf[10];
struct usb_cdc_notification *notif = (void*)buf;
@ -125,11 +125,10 @@ static void cdcacm_set_modem_state(usbd_device *dev, const uint16_t iface, const
notif->wLength = 2;
buf[8] = 3U;
buf[9] = 0U;
/* FIXME: Remove magic numbers */
usbd_ep_write_packet(dev, ep, buf, sizeof(buf));
}
void cdcacm_set_config(usbd_device *dev, uint16_t wValue)
void usb_serial_set_config(usbd_device *dev, uint16_t wValue)
{
configured = wValue;
@ -169,6 +168,6 @@ void cdcacm_set_config(usbd_device *dev, uint16_t wValue)
/* Notify the host that DCD is asserted.
* Allows the use of /dev/tty* devices on *BSD/MacOS
*/
cdcacm_set_modem_state(dev, GDB_IF_NO, CDCACM_GDB_ENDPOINT);
cdcacm_set_modem_state(dev, UART_IF_NO, CDCACM_UART_ENDPOINT);
usb_serial_set_state(dev, GDB_IF_NO, CDCACM_GDB_ENDPOINT);
usb_serial_set_state(dev, UART_IF_NO, CDCACM_UART_ENDPOINT);
}

View File

@ -31,7 +31,7 @@
#include <stdbool.h>
#include "usb.h"
void cdcacm_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. */
int cdcacm_get_config(void);

View File

@ -39,7 +39,7 @@ void blackmagic_usb_init(void)
usbdev = usbd_init(&USB_DRIVER, &dev_desc, &config, usb_strings, sizeof(usb_strings) / sizeof(char *),
usbd_control_buffer, sizeof(usbd_control_buffer));
usbd_register_set_config_callback(usbdev, cdcacm_set_config);
usbd_register_set_config_callback(usbdev, usb_serial_set_config);
usbd_register_set_config_callback(usbdev, dfu_set_config);
nvic_set_priority(USB_IRQ, IRQ_PRI_USB);