@@ -87,6 +87,14 @@ void usb_stall(uint8_t epnr)
void usb_configure_ep(uint8_t epnr, uint8_t type, uint32_t size)
{
+ switch (at32f4_series) {
+ case AT32F403:
+ /* Double-buffer hardware implementation is incompatible. */
+ if (type == EPT_DBLBUF)
+ type = EPT_BULK;
+ break;
+ }
+
drv->configure_ep(epnr, type, size);
}
@@ -12,10 +12,15 @@
void hw_usb_init(void)
usbd.init();
+ /* Indicate we are connected by pulling up D+. */
+ gpio_configure_pin(gpioa, 0, GPO_pushpull(_2MHz, HIGH));
void hw_usb_deinit(void)
+ gpio_configure_pin(gpioa, 0, GPI_floating);
usbd.deinit();
@@ -47,14 +47,10 @@ static void usbd_init(void)
/* Clear IRQ state. */
usb->istr = 0;
-
- /* Indicate we are connected by pulling up D+. */
- gpio_configure_pin(gpioa, 0, GPO_pushpull(_2MHz, HIGH));
static void usbd_deinit(void)
- gpio_configure_pin(gpioa, 0, GPI_floating);
rcc->apb1enr &= ~RCC_APB1ENR_USBEN;