use static urb for ep0
This commit is contained in:
@@ -308,6 +308,7 @@ static void usbh_hubport_release(struct usbh_hubport *child)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
child->config.config_desc.bNumInterfaces = 0;
|
child->config.config_desc.bNumInterfaces = 0;
|
||||||
|
usbh_kill_urb(&child->ep0_urb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +601,7 @@ static void usbh_hub_events(struct usbh_hub *hub)
|
|||||||
USB_LOG_INFO("New %s device on Hub %u, Port %u connected\r\n", speed_table[speed], hub->index, port + 1);
|
USB_LOG_INFO("New %s device on Hub %u, Port %u connected\r\n", speed_table[speed], hub->index, port + 1);
|
||||||
|
|
||||||
/* create disposable thread to enumerate device on current hport, do not block hub thread */
|
/* create disposable thread to enumerate device on current hport, do not block hub thread */
|
||||||
child->thread = usb_osal_thread_create("usbh_enum", CONFIG_USBHOST_PSC_STACKSIZE, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hubport_enumerate_thread, (void *)child);
|
usb_osal_thread_create("usbh_enum", CONFIG_USBHOST_PSC_STACKSIZE, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hubport_enumerate_thread, (void *)child);
|
||||||
} else {
|
} else {
|
||||||
child = &hub->child[port];
|
child = &hub->child[port];
|
||||||
/** release child sources */
|
/** release child sources */
|
||||||
|
|||||||
@@ -672,16 +672,13 @@ int usbh_control_transfer(struct usbh_hubport *hport, struct usb_setup_packet *s
|
|||||||
struct usbh_urb *urb;
|
struct usbh_urb *urb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
urb = usb_malloc(sizeof(struct usbh_urb));
|
urb = &hport->ep0_urb;
|
||||||
memset(urb, 0, sizeof(struct usbh_urb));
|
|
||||||
|
|
||||||
usbh_control_urb_fill(urb, hport, setup, buffer, setup->wLength, CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT, NULL, NULL);
|
usbh_control_urb_fill(urb, hport, setup, buffer, setup->wLength, CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT, NULL, NULL);
|
||||||
|
|
||||||
ret = usbh_submit_urb(urb);
|
ret = usbh_submit_urb(urb);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = urb->actual_length;
|
ret = urb->actual_length;
|
||||||
}
|
}
|
||||||
usb_free(urb);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ struct usbh_hubport {
|
|||||||
uint8_t port; /* Hub port index */
|
uint8_t port; /* Hub port index */
|
||||||
uint8_t dev_addr; /* device address */
|
uint8_t dev_addr; /* device address */
|
||||||
uint8_t speed; /* device speed */
|
uint8_t speed; /* device speed */
|
||||||
struct usb_endpoint_descriptor ep0;
|
|
||||||
struct usb_device_descriptor device_desc;
|
struct usb_device_descriptor device_desc;
|
||||||
struct usbh_configuration config;
|
struct usbh_configuration config;
|
||||||
const char *iManufacturer;
|
const char *iManufacturer;
|
||||||
@@ -111,7 +110,8 @@ struct usbh_hubport {
|
|||||||
#ifdef CONFIG_USBHOST_XHCI
|
#ifdef CONFIG_USBHOST_XHCI
|
||||||
uint32_t protocol; /* port protocol, for xhci, some ports are USB2.0, others are USB3.0 */
|
uint32_t protocol; /* port protocol, for xhci, some ports are USB2.0, others are USB3.0 */
|
||||||
#endif
|
#endif
|
||||||
usb_osal_thread_t thread;
|
struct usb_endpoint_descriptor ep0;
|
||||||
|
struct usbh_urb ep0_urb;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct usbh_hub {
|
struct usbh_hub {
|
||||||
@@ -120,12 +120,12 @@ struct usbh_hub {
|
|||||||
bool is_roothub;
|
bool is_roothub;
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
uint8_t hub_addr;
|
uint8_t hub_addr;
|
||||||
struct usb_endpoint_descriptor *intin;
|
|
||||||
uint8_t *int_buffer;
|
|
||||||
struct usbh_urb intin_urb;
|
|
||||||
struct usb_hub_descriptor hub_desc;
|
struct usb_hub_descriptor hub_desc;
|
||||||
struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
|
struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS];
|
||||||
struct usbh_hubport *parent;
|
struct usbh_hubport *parent;
|
||||||
|
struct usb_endpoint_descriptor *intin;
|
||||||
|
struct usbh_urb intin_urb;
|
||||||
|
uint8_t *int_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void usbh_control_urb_fill(struct usbh_urb *urb,
|
static inline void usbh_control_urb_fill(struct usbh_urb *urb,
|
||||||
|
|||||||
Reference in New Issue
Block a user