summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/hal/hal_lpc43xx.h1
-rw-r--r--tinyusb/host/hub.c4
-rw-r--r--tinyusb/host/usbh.c15
3 files changed, 10 insertions, 10 deletions
diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h
index 6360384ea..899f14445 100644
--- a/tinyusb/hal/hal_lpc43xx.h
+++ b/tinyusb/hal/hal_lpc43xx.h
@@ -40,6 +40,7 @@
#define _TUSB_HAL_LPC43XX_H_
#include "LPC43xx.h"
+#include "lpc43xx_cgu.h"
#ifdef __cplusplus
extern "C" {
diff --git a/tinyusb/host/hub.c b/tinyusb/host/hub.c
index 3259732e3..e9608f952 100644
--- a/tinyusb/host/hub.c
+++ b/tinyusb/host/hub.c
@@ -105,6 +105,7 @@ tusb_error_t hub_port_clear_feature_subtask(uint8_t hub_addr, uint8_t hub_port,
tusb_error_t hub_port_reset_subtask(uint8_t hub_addr, uint8_t hub_port)
{
+ enum { RESET_DELAY = 200 }; // USB specs say only 50ms but many devices require much longer
tusb_error_t error;
OSAL_SUBTASK_BEGIN
@@ -118,7 +119,7 @@ tusb_error_t hub_port_reset_subtask(uint8_t hub_addr, uint8_t hub_port)
);
SUBTASK_ASSERT_STATUS( error );
- osal_task_delay(50); // TODO Hub wait for Status Endpoint on Reset Change
+ osal_task_delay(RESET_DELAY); // TODO Hub wait for Status Endpoint on Reset Change
//------------- Get Port Status to check if port is enabled, powered and reset_change -------------//
OSAL_SUBTASK_INVOKED_AND_WAIT(
@@ -221,6 +222,7 @@ void hub_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes)
if ( BIT_TEST_(p_hub->status_change, port) )
{
usbh_hub_port_plugged_isr(pipe_hdl.dev_addr, port);
+ break; // handle one port at a time, next port if any will be handled in the next cycle
}
}
// NOTE: next status transfer is queued by usbh.c after handling this request
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 5504e9602..e694ef066 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -199,14 +199,11 @@ tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType,
usbh_devices[dev_addr].control.pipe_status = TUSB_EVENT_XFER_COMPLETE; // in Test project, mark as complete immediately
#endif
- SUBTASK_ASSERT_STATUS_WITH_HANDLER( hcd_pipe_control_xfer(dev_addr, &usbh_devices[dev_addr].control.request, data),
- osal_mutex_release(usbh_devices[dev_addr].control.mutex_hdl) );
-
- osal_semaphore_wait(usbh_devices[dev_addr].control.sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // careful of local variable without static
+ error = hcd_pipe_control_xfer(dev_addr, &usbh_devices[dev_addr].control.request, data);
+ if ( TUSB_ERROR_NONE == error ) osal_semaphore_wait(usbh_devices[dev_addr].control.sem_hdl, OSAL_TIMEOUT_NORMAL, &error);
osal_mutex_release(usbh_devices[dev_addr].control.mutex_hdl);
- // TODO make handler for this function general purpose
- if (TUSB_ERROR_NONE != error) SUBTASK_EXIT(error);
+ SUBTASK_ASSERT_STATUS(error);
if (TUSB_EVENT_XFER_STALLED == usbh_devices[dev_addr].control.pipe_status) SUBTASK_EXIT(TUSB_ERROR_USBH_XFER_STALLED);
if (TUSB_EVENT_XFER_ERROR == usbh_devices[dev_addr].control.pipe_status) SUBTASK_EXIT(TUSB_ERROR_USBH_XFER_FAILED);
@@ -259,7 +256,7 @@ void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t even
usbh_class_drivers[class_index].isr(pipe_hdl, event, xferred_bytes);
}else
{
- ASSERT(false, VOID_RETURN); // something wrong, no one claims the isr's source
+ ASSERT_FAILED(VOID_RETURN); // something wrong, no one claims the isr's source
}
}
@@ -361,8 +358,8 @@ OSAL_TASK_FUNCTION(usbh_enumeration_task, p_task_para)
tusb_error_t enumeration_body_subtask(void)
{
enum {
- POWER_STABLE_DELAY = 300,
- RESET_DELAY = 100 // NXP's EHCI require more than 50ms to work properly although the USB specs say only 50ms
+ POWER_STABLE_DELAY = 500,
+ RESET_DELAY = 200 // USB specs say only 50ms but many devices require much longer
};
tusb_error_t error;