From 85dcb737749576d1c2946f3993b964c59974f38c Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 28 Apr 2022 18:00:30 +0700 Subject: [PATCH] more clean up --- lib/Pico-PIO-USB | 2 +- src/device/usbd.c | 3 +-- src/host/usbh.c | 9 +++++---- src/portable/raspberrypi/pio_usb/dcd_pio_usb.c | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Pico-PIO-USB b/lib/Pico-PIO-USB index aecced02e..6f76de3c0 160000 --- a/lib/Pico-PIO-USB +++ b/lib/Pico-PIO-USB @@ -1 +1 @@ -Subproject commit aecced02e756f3a35805cacdd9be25976b6dd978 +Subproject commit 6f76de3c0fb4679afc9f953cd4fec0637ebd2f15 diff --git a/src/device/usbd.c b/src/device/usbd.c index e545e8056..1dd1a352e 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -1071,8 +1071,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const //--------------------------------------------------------------------+ // DCD Event Handler //--------------------------------------------------------------------+ -TU_ATTR_FAST_FUNC -void dcd_event_handler(dcd_event_t const * event, bool in_isr) +TU_ATTR_FAST_FUNC void dcd_event_handler(dcd_event_t const * event, bool in_isr) { switch (event->event_id) { diff --git a/src/host/usbh.c b/src/host/usbh.c index 99ba964d2..74ffb5c38 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -1139,7 +1139,7 @@ enum { //ENUM_HUB_GET_STATUS_1, ENUM_HUB_CLEAR_RESET_1, ENUM_ADDR0_DEVICE_DESC, - ENUM_RESET_2, // 2nd reset before set address + ENUM_RESET_2, // 2nd reset before set address (not used) ENUM_HUB_GET_STATUS_2, ENUM_HUB_CLEAR_RESET_2, ENUM_SET_ADDR, @@ -1227,17 +1227,17 @@ static void process_enumeration(tuh_xfer_t* xfer) } break; +#if 0 case ENUM_RESET_2: + // XXX note used by now, but may be needed for some devices !? // Reset device again before Set Address - TU_LOG2("Port reset \r\n"); + TU_LOG2("Port reset2 \r\n"); if (_dev0.hub_addr == 0) { // connected directly to roothub -#if !CFG_TUH_RPI_PIO_USB // FIXME skip this reset for pio-usb hcd_port_reset( _dev0.rhport ); osal_task_delay(RESET_DELAY); hcd_port_reset_end(_dev0.rhport); -#endif // TODO: fall through to SET ADDRESS, refactor later } #if CFG_TUH_HUB @@ -1249,6 +1249,7 @@ static void process_enumeration(tuh_xfer_t* xfer) } #endif __attribute__((fallthrough)); +#endif case ENUM_SET_ADDR: enum_request_set_addr(); diff --git a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c index fb10087b5..1bc5594d8 100644 --- a/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c +++ b/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c @@ -135,6 +135,7 @@ void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr) { (void) rhport; endpoint_t *ep = pio_usb_device_get_endpoint_by_address(ep_addr); + ep->has_transfer = false; ep->stalled = true; }