add sw init for os and hw init for host controller
This commit is contained in:
@@ -59,12 +59,19 @@ struct usbh_endpoint_cfg {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief usb host software init, used for global reset.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int usb_hc_sw_init(void);
|
||||
|
||||
/**
|
||||
* @brief usb host controller hardware init.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int usb_hc_init(void);
|
||||
int usb_hc_hw_init(void);
|
||||
|
||||
/**
|
||||
* @brief get port connect status
|
||||
@@ -144,11 +151,12 @@ int usbh_control_transfer(usbh_epinfo_t ep, struct usb_setup_packet *setup, uint
|
||||
* of bytes successfully transferred. On a failure, a negated errno value
|
||||
* is returned that indicates the nature of the failure:
|
||||
*
|
||||
* EAGAIN - If devices NAKs the transfer (or NYET or other error where
|
||||
* -EAGAIN - If devices NAKs the transfer (or NYET or other error where
|
||||
* it may be appropriate to restart the entire transaction).
|
||||
* EPERM - If the endpoint stalls
|
||||
* EIO - On a TX or data toggle error
|
||||
* EPIPE - Overrun errors
|
||||
* -EPERM - If the endpoint stalls
|
||||
* -EIO - On a TX or data toggle error
|
||||
* -EPIPE - Overrun errors
|
||||
* -ETIMEDOUT - Sem wait timeout
|
||||
*
|
||||
*/
|
||||
int usbh_ep_bulk_transfer(usbh_epinfo_t ep, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
|
||||
@@ -166,11 +174,12 @@ int usbh_ep_bulk_transfer(usbh_epinfo_t ep, uint8_t *buffer, uint32_t buflen, ui
|
||||
* of bytes successfully transferred. On a failure, a negated errno value
|
||||
* is returned that indicates the nature of the failure:
|
||||
*
|
||||
* EAGAIN - If devices NAKs the transfer (or NYET or other error where
|
||||
* -EAGAIN - If devices NAKs the transfer (or NYET or other error where
|
||||
* it may be appropriate to restart the entire transaction).
|
||||
* EPERM - If the endpoint stalls
|
||||
* EIO - On a TX or data toggle error
|
||||
* EPIPE - Overrun errors
|
||||
* -EPERM - If the endpoint stalls
|
||||
* -EIO - On a TX or data toggle error
|
||||
* -EPIPE - Overrun errors
|
||||
* -ETIMEDOUT - Sem wait timeout
|
||||
*
|
||||
*/
|
||||
int usbh_ep_intr_transfer(usbh_epinfo_t ep, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
|
||||
|
||||
@@ -745,13 +745,15 @@ static void usbh_portchange_detect_thread(void *argument)
|
||||
{
|
||||
struct usbh_hubport *hport = NULL;
|
||||
|
||||
usb_hc_sw_init();
|
||||
|
||||
for (uint8_t port = USBH_HUB_PORT_START_INDEX; port <= CONFIG_USBHOST_RHPORTS; port++) {
|
||||
usbh_core_cfg.rhport[port - 1].hport.port = port;
|
||||
usbh_core_cfg.rhport[port - 1].devgen.next = 1;
|
||||
usbh_hport_activate(&usbh_core_cfg.rhport[port - 1].hport);
|
||||
}
|
||||
|
||||
usb_hc_init();
|
||||
usb_hc_hw_init();
|
||||
|
||||
while (1) {
|
||||
usbh_portchange_wait(&hport);
|
||||
@@ -844,9 +846,8 @@ int usbh_initialize(void)
|
||||
usbh_class_info_table_end = (struct usbh_class_info *)(class_info_table[0] + (sizeof(class_info_table) / sizeof(class_info_table[0])));
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
usbh_workq_initialize();
|
||||
#endif
|
||||
|
||||
usbh_core_cfg.pscevent = usb_osal_event_create();
|
||||
if (usbh_core_cfg.pscevent == NULL) {
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user