platform: Renamed cdcacm_init -> blackmagic_usb_init

This commit is contained in:
dragonmux 2022-08-10 05:55:20 +01:00 committed by Piotr Esden-Tempski
parent 105f6a3dce
commit 82bca86806
12 changed files with 15 additions and 18 deletions

View File

@ -69,7 +69,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
usbuart_init(); usbuart_init();
cdcacm_init(); blackmagic_usb_init();
} }
void platform_nrst_set_val(bool assert) void platform_nrst_set_val(bool assert)

View File

@ -108,7 +108,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
usbuart_init(); usbuart_init();
cdcacm_init(); blackmagic_usb_init();
// https://github.com/libopencm3/libopencm3/pull/1256#issuecomment-779424001 // https://github.com/libopencm3/libopencm3/pull/1256#issuecomment-779424001
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS | OTG_GCCFG_PWRDWN; OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS | OTG_GCCFG_PWRDWN;

View File

@ -572,17 +572,14 @@ static void cdcacm_set_config(usbd_device *dev, uint16_t wValue)
} }
/* We need a special large control buffer for this device: */ /* We need a special large control buffer for this device: */
uint8_t usbd_control_buffer[256]; static uint8_t usbd_control_buffer[256];
void cdcacm_init(void) void blackmagic_usb_init(void)
{ {
void exti15_10_isr(void);
serial_no_read(serial_no); serial_no_read(serial_no);
usbdev = usbd_init(&USB_DRIVER, &dev_desc, &config, usb_strings, usbdev = usbd_init(&USB_DRIVER, &dev_desc, &config, usb_strings, sizeof(usb_strings) / sizeof(char *),
sizeof(usb_strings)/sizeof(char *), usbd_control_buffer, sizeof(usbd_control_buffer));
usbd_control_buffer, sizeof(usbd_control_buffer));
usbd_register_set_config_callback(usbdev, cdcacm_set_config); usbd_register_set_config_callback(usbdev, cdcacm_set_config);

View File

@ -36,7 +36,7 @@
#define CDCACM_UART_ENDPOINT 3 #define CDCACM_UART_ENDPOINT 3
#define TRACE_ENDPOINT 5 #define TRACE_ENDPOINT 5
void cdcacm_init(void); void blackmagic_usb_init(void);
/* Returns current usb configuration, or 0 if not configured. */ /* Returns current usb configuration, or 0 if not configured. */
int cdcacm_get_config(void); int cdcacm_get_config(void);
int cdcacm_get_dtr(void); int cdcacm_get_dtr(void);

View File

@ -84,7 +84,7 @@ void platform_init(void)
gpio_set_output_options(NRST_PORT, GPIO_OTYPE_OD, gpio_set_output_options(NRST_PORT, GPIO_OTYPE_OD,
GPIO_OSPEED_2MHZ, NRST_PIN); GPIO_OSPEED_2MHZ, NRST_PIN);
platform_timing_init(); platform_timing_init();
cdcacm_init(); blackmagic_usb_init();
usbuart_init(); usbuart_init();
} }

View File

@ -88,7 +88,7 @@ void platform_init(void)
/* Set up USB Pins and alternate function*/ /* Set up USB Pins and alternate function*/
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12); gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
gpio_set_af(GPIOA, GPIO_AF14, GPIO11 | GPIO12); gpio_set_af(GPIOA, GPIO_AF14, GPIO11 | GPIO12);
cdcacm_init(); blackmagic_usb_init();
usbuart_init(); usbuart_init();
} }

View File

@ -107,7 +107,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
usbuart_init(); usbuart_init();
cdcacm_init(); blackmagic_usb_init();
} }
void platform_nrst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }

View File

@ -77,7 +77,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
usbuart_init(); usbuart_init();
cdcacm_init(); blackmagic_usb_init();
} }
void platform_nrst_set_val(bool assert) { (void)assert; } void platform_nrst_set_val(bool assert) { (void)assert; }

View File

@ -81,7 +81,7 @@ void platform_init(void)
__asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop"); __asm__("nop");
gpio_mode_setup(GPIOD_BASE, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO4|GPIO5); gpio_mode_setup(GPIOD_BASE, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO4|GPIO5);
usbuart_init(); usbuart_init();
cdcacm_init(); blackmagic_usb_init();
usb_enable_interrupts(USB_INT_RESET | USB_INT_DISCON | usb_enable_interrupts(USB_INT_RESET | USB_INT_DISCON |
USB_INT_RESUME | USB_INT_SUSPEND, 0xff, 0xff); USB_INT_RESUME | USB_INT_SUSPEND, 0xff, 0xff);

View File

@ -223,7 +223,7 @@ void platform_init(void)
SCB_VTOR = (uint32_t)&vector_table; SCB_VTOR = (uint32_t)&vector_table;
platform_timing_init(); platform_timing_init();
cdcacm_init(); blackmagic_usb_init();
/* On hardware version 1 and 2, UART and SWD share connector pins. /* On hardware version 1 and 2, UART and SWD share connector pins.
* Don't enable UART if we're being debugged. */ * Don't enable UART if we're being debugged. */

View File

@ -80,7 +80,7 @@ void platform_init(void)
platform_timing_init(); platform_timing_init();
if (rev > 1) /* Reconnect USB */ if (rev > 1) /* Reconnect USB */
gpio_set(GPIOA, GPIO15); gpio_set(GPIOA, GPIO15);
cdcacm_init(); blackmagic_usb_init();
#ifdef SWIM_AS_UART #ifdef SWIM_AS_UART
gpio_primary_remap(AFIO_MAPR_SWJ_CFG_FULL_SWJ, gpio_primary_remap(AFIO_MAPR_SWJ_CFG_FULL_SWJ,

View File

@ -109,7 +109,7 @@ void platform_init(void)
SCB_VTOR = (uint32_t)&vector_table; SCB_VTOR = (uint32_t)&vector_table;
platform_timing_init(); platform_timing_init();
cdcacm_init(); blackmagic_usb_init();
usbuart_init(); usbuart_init();
} }