summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-06 21:46:34 +0700
committerhathach <[email protected]>2018-12-06 21:46:34 +0700
commit5b09774ae05d15cb18ff9920864535b8444a1c3c (patch)
treed43e4106fe8509308982e3a25584580a3bc3b4fa
parent1d3583785f9f890da2e6ac720d1327ab0452f974 (diff)
clean up usbh, rename doxygen folder to docs
-rw-r--r--docs/changelog.md (renamed from doxygen/changelog.md)0
-rw-r--r--docs/coding_standard.md (renamed from doxygen/coding_standard.md)0
-rw-r--r--docs/configuration.txt (renamed from doxygen/configuration.txt)2
-rw-r--r--docs/getting_started.md (renamed from doxygen/getting_started.md)0
-rw-r--r--docs/group_def.txt (renamed from doxygen/group_def.txt)0
-rw-r--r--docs/header.html (renamed from doxygen/header.html)0
-rw-r--r--docs/porting.md (renamed from doxygen/porting.md)0
-rw-r--r--docs/started_demo.md (renamed from doxygen/started_demo.md)0
-rw-r--r--examples/host/cdc_msc_hid/src/tusb_config.h4
-rw-r--r--examples/obsolete/host/src/main.c2
-rw-r--r--examples/obsolete/host/src/tusb_config.h4
-rw-r--r--src/host/hcd.c44
-rw-r--r--src/host/hcd.h35
-rw-r--r--src/host/hub.c2
-rw-r--r--src/host/usbh.c93
-rw-r--r--src/host/usbh.h2
-rw-r--r--src/tusb_option.h2
-rw-r--r--tests/support/tusb_config.h2
18 files changed, 87 insertions, 105 deletions
diff --git a/doxygen/changelog.md b/docs/changelog.md
index a98db8a17..a98db8a17 100644
--- a/doxygen/changelog.md
+++ b/docs/changelog.md
diff --git a/doxygen/coding_standard.md b/docs/coding_standard.md
index 3eb3c0d7d..3eb3c0d7d 100644
--- a/doxygen/coding_standard.md
+++ b/docs/coding_standard.md
diff --git a/doxygen/configuration.txt b/docs/configuration.txt
index da30786ed..896c9da6c 100644
--- a/doxygen/configuration.txt
+++ b/docs/configuration.txt
@@ -40,7 +40,7 @@
/** \defgroup config_host_class Class Driver
* \brief For each Class Driver a value of 1 means enable, value of 0 mean disable
* @{ */
-#define CFG_TUSB_HOST_HUB ///< Enable Hub Class
+#define CFG_TUH_HUB ///< Enable Hub Class
#define CFG_TUSB_HOST_HID_KEYBOARD ///< Enable HID Class for Keyboard
#define CFG_TUSB_HOST_HID_MOUSE ///< Enable HID Class for Mouse
#define CFG_TUSB_HOST_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
diff --git a/doxygen/getting_started.md b/docs/getting_started.md
index 6d6091c03..6d6091c03 100644
--- a/doxygen/getting_started.md
+++ b/docs/getting_started.md
diff --git a/doxygen/group_def.txt b/docs/group_def.txt
index 0f5419810..0f5419810 100644
--- a/doxygen/group_def.txt
+++ b/docs/group_def.txt
diff --git a/doxygen/header.html b/docs/header.html
index e75be44de..e75be44de 100644
--- a/doxygen/header.html
+++ b/docs/header.html
diff --git a/doxygen/porting.md b/docs/porting.md
index 5a464fa6b..5a464fa6b 100644
--- a/doxygen/porting.md
+++ b/docs/porting.md
diff --git a/doxygen/started_demo.md b/docs/started_demo.md
index 7e82596f5..7e82596f5 100644
--- a/doxygen/started_demo.md
+++ b/docs/started_demo.md
diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h
index 4b39d6d18..8d3e39c64 100644
--- a/examples/host/cdc_msc_hid/src/tusb_config.h
+++ b/examples/host/cdc_msc_hid/src/tusb_config.h
@@ -83,14 +83,14 @@
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
-#define CFG_TUSB_HOST_HUB 0
+#define CFG_TUH_HUB 1
#define CFG_TUSB_HOST_HID_KEYBOARD 0
#define CFG_TUSB_HOST_HID_MOUSE 0
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
#define CFG_TUSB_HOST_MSC 0
#define CFG_TUSB_HOST_CDC 1
-#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUSB_HOST_HUB ? 5 : 1) // normal hub has 4 ports
+#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports
//------------- CLASS -------------//
#define CFG_TUD_CDC 0
diff --git a/examples/obsolete/host/src/main.c b/examples/obsolete/host/src/main.c
index 90c64f849..0f2905fc6 100644
--- a/examples/obsolete/host/src/main.c
+++ b/examples/obsolete/host/src/main.c
@@ -135,7 +135,7 @@ void print_greeting(void)
puts("This HOST demo is configured to support:");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
- if (CFG_TUSB_HOST_HUB ) puts(" - Hub (1 level only)");
+ if (CFG_TUH_HUB ) puts(" - Hub (1 level only)");
if (CFG_TUSB_HOST_HID_MOUSE ) puts(" - HID Mouse");
if (CFG_TUSB_HOST_HID_KEYBOARD ) puts(" - HID Keyboard");
if (CFG_TUSB_HOST_MSC ) puts(" - Mass Storage");
diff --git a/examples/obsolete/host/src/tusb_config.h b/examples/obsolete/host/src/tusb_config.h
index f39fa26b4..3d0d5f3db 100644
--- a/examples/obsolete/host/src/tusb_config.h
+++ b/examples/obsolete/host/src/tusb_config.h
@@ -54,14 +54,14 @@
//--------------------------------------------------------------------+
//------------- CLASS -------------//
-#define CFG_TUSB_HOST_HUB 1
+#define CFG_TUH_HUB 1
#define CFG_TUSB_HOST_HID_KEYBOARD 1
#define CFG_TUSB_HOST_HID_MOUSE 1
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
#define CFG_TUSB_HOST_MSC 1
#define CFG_TUSB_HOST_CDC 1
-#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUSB_HOST_HUB ? 5 : 1) // normal hub has 4 ports
+#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
diff --git a/src/host/hcd.c b/src/host/hcd.c
deleted file mode 100644
index 092ca96da..000000000
--- a/src/host/hcd.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/**************************************************************************/
-/*!
- @file hcd.c
- @author hathach (tinyusb.org)
-
- @section LICENSE
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2013, hathach (tinyusb.org)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This file is part of the tinyusb stack.
-*/
-/**************************************************************************/
-
-#include "hcd.h"
-
-#if MODE_HOST_SUPPORTED
-
-
-#endif
diff --git a/src/host/hcd.h b/src/host/hcd.h
index 420b8a001..a6b1b7027 100644
--- a/src/host/hcd.h
+++ b/src/host/hcd.h
@@ -43,16 +43,45 @@
#ifndef _TUSB_HCD_H_
#define _TUSB_HCD_H_
+#include <common/tusb_common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <common/tusb_common.h>
+typedef enum
+{
+ HCD_EVENT_DEVICE_PLUG,
+ HCD_EVENT_DEVICE_UNPLUG,
+ HCD_EVENT_XFER_COMPLETE,
+} hcd_eventid_t;
+
+typedef struct
+{
+ uint8_t rhport;
+ uint8_t event_id;
+
+ union
+ {
+ struct
+ {
+ uint8_t hub_addr;
+ uint8_t hub_port;
+ } plug, unplug;
+
+ struct
+ {
+ uint8_t ep_addr;
+ uint8_t result;
+ uint32_t len;
+ } xfer_complete;
+ };
+} hcd_event_t;
#if MODE_HOST_SUPPORTED
// Max number of endpoints per device
enum {
- HCD_MAX_ENDPOINT = CFG_TUSB_HOST_HUB + CFG_TUSB_HOST_HID_KEYBOARD + CFG_TUSB_HOST_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC +
+ HCD_MAX_ENDPOINT = CFG_TUH_HUB + CFG_TUSB_HOST_HID_KEYBOARD + CFG_TUSB_HOST_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC +
CFG_TUSB_HOST_MSC*2 + CFG_TUSB_HOST_CDC*3,
HCD_MAX_XFER = HCD_MAX_ENDPOINT*2,
@@ -69,13 +98,11 @@ typedef struct {
uint8_t reserved;
} pipe_handle_t;
-static inline bool pipehandle_is_valid(pipe_handle_t pipe_hdl) ATTR_CONST ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool pipehandle_is_valid(pipe_handle_t pipe_hdl)
{
return pipe_hdl.dev_addr > 0;
}
-static inline bool pipehandle_is_equal(pipe_handle_t x, pipe_handle_t y) ATTR_CONST ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool pipehandle_is_equal(pipe_handle_t x, pipe_handle_t y)
{
return (x.dev_addr == y.dev_addr) && (x.xfer_type == y.xfer_type) && (x.index == y.index);
diff --git a/src/host/hub.c b/src/host/hub.c
index 55c8597ad..485e47147 100644
--- a/src/host/hub.c
+++ b/src/host/hub.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if (MODE_HOST_SUPPORTED && CFG_TUSB_HOST_HUB)
+#if (MODE_HOST_SUPPORTED && CFG_TUH_HUB)
#define _TINY_USB_SOURCE_FILE_
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 80e59037f..dc13030c3 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -94,7 +94,7 @@ static host_class_driver_t const usbh_class_drivers[] =
},
#endif
- #if CFG_TUSB_HOST_HUB
+ #if CFG_TUH_HUB
[TUSB_CLASS_HUB] = {
.init = hub_init,
.open_subtask = hub_open_subtask,
@@ -190,40 +190,35 @@ bool usbh_init(void)
}
//------------- USBH control transfer -------------//
-// function called within a task, requesting os blocking services, subtask input parameter must be static/global variables or constant
-tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
+bool usbh_control_xfer_subtask (uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
uint16_t wValue, uint16_t wIndex, uint16_t wLength, uint8_t* data)
{
- // FIXME [CMSIS-RTX] use svc for OS API, error value changed after mutex release at the end of function
- static tusb_error_t error;
+ usbh_device_info_t* dev = &usbh_devices[dev_addr];
-// OSAL_SUBTASK_BEGIN
+ TU_ASSERT(osal_mutex_lock(dev->control.mutex_hdl, OSAL_TIMEOUT_NORMAL));
- error = osal_mutex_lock(usbh_devices[dev_addr].control.mutex_hdl, OSAL_TIMEOUT_NORMAL);
- TU_VERIFY_ERR_HDLR(error, osal_mutex_unlock(usbh_devices[dev_addr].control.mutex_hdl));
-
- usbh_devices[dev_addr].control.request = (tusb_control_request_t) {
+ dev->control.request = (tusb_control_request_t ) {
{.bmRequestType = bmRequestType},
.bRequest = bRequest,
.wValue = wValue,
.wIndex = wIndex,
.wLength = wLength
};
- usbh_devices[dev_addr].control.pipe_status = 0;
+ dev->control.pipe_status = 0;
+
+ TU_ASSERT_ERR(hcd_pipe_control_xfer(dev_addr, &dev->control.request, data), false);
+ TU_ASSERT(osal_semaphore_wait(dev->control.sem_hdl, OSAL_TIMEOUT_NORMAL));
- error = hcd_pipe_control_xfer(dev_addr, &usbh_devices[dev_addr].control.request, data);
- if ( TUSB_ERROR_NONE == error ) error = osal_semaphore_wait(usbh_devices[dev_addr].control.sem_hdl, OSAL_TIMEOUT_NORMAL);
- osal_mutex_unlock(usbh_devices[dev_addr].control.mutex_hdl);
+ osal_mutex_unlock(dev->control.mutex_hdl);
- TU_ASSERT_ERR(error);
- if (XFER_RESULT_STALLED == usbh_devices[dev_addr].control.pipe_status) return (TUSB_ERROR_USBH_XFER_STALLED);
- if (XFER_RESULT_FAILED == usbh_devices[dev_addr].control.pipe_status) return (TUSB_ERROR_USBH_XFER_FAILED);
+ if ( XFER_RESULT_STALLED == dev->control.pipe_status ) return false;
+ if ( XFER_RESULT_FAILED == dev->control.pipe_status ) return false;
// STASK_ASSERT_HDLR(TUSB_ERROR_NONE == error &&
-// XFER_RESULT_SUCCESS == usbh_devices[dev_addr].control.pipe_status,
+// XFER_RESULT_SUCCESS == dev->control.pipe_status,
// tuh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL) );
-// OSAL_SUBTASK_END
+ return true;
}
tusb_error_t usbh_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size)
@@ -359,7 +354,7 @@ void usbh_hcd_rhport_unplugged_isr(uint8_t hostid)
//--------------------------------------------------------------------+
// ENUMERATION TASK
//--------------------------------------------------------------------+
-tusb_error_t usbh_task_body(void)
+bool usbh_task_body(void)
{
enum {
POWER_STABLE_DELAY = 500,
@@ -374,7 +369,7 @@ tusb_error_t usbh_task_body(void)
static uint8_t configure_selected = 1; // TODO move
static uint8_t *p_desc = NULL; // TODO move
- if ( !osal_queue_receive(_usbh_q, &enum_entry) ) return TUSB_ERROR_NONE;
+ if ( !osal_queue_receive(_usbh_q, &enum_entry) ) return false;
usbh_devices[0].core_id = enum_entry.core_id; // TODO refractor integrate to device_pool
usbh_devices[0].hub_addr = enum_entry.hub_addr;
@@ -390,7 +385,7 @@ tusb_error_t usbh_task_body(void)
osal_task_delay(POWER_STABLE_DELAY); // wait until device is stable. Increase this if the first 8 bytes is failed to get
// exit if device unplugged while delaying
- if ( !hcd_port_connect_status(usbh_devices[0].core_id) ) return TUSB_ERROR_NONE;
+ if ( !hcd_port_connect_status(usbh_devices[0].core_id) ) return true;
hcd_port_reset( usbh_devices[0].core_id ); // port must be reset to have correct speed operation
osal_task_delay(RESET_DELAY);
@@ -398,12 +393,13 @@ tusb_error_t usbh_task_body(void)
usbh_devices[0].speed = hcd_port_speed_get( usbh_devices[0].core_id );
}
else
- { // disconnection event
+ {
+ // disconnection event
usbh_device_unplugged(usbh_devices[0].core_id, 0, 0);
- return TUSB_ERROR_NONE; // restart task
+ return true; // restart task
}
}
- #if CFG_TUSB_HOST_HUB
+ #if CFG_TUH_HUB
//------------- connected/disconnected via hub -------------//
else
{
@@ -450,19 +446,19 @@ tusb_error_t usbh_task_body(void)
usbh_devices[0].state = TUSB_DEVICE_STATE_ADDRESSED;
//------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------//
- error = usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0,
- 8, enum_data_buffer );
+ // TODO some slow device is observed to fail the very fist controller xfer, can try more times
+ TU_ASSERT(usbh_control_xfer_subtask(0, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TUSB_REQ_GET_DESCRIPTOR,
+ (TUSB_DESC_DEVICE << 8), 0, 8, enum_data_buffer));
//------------- Reset device again before Set Address -------------//
if (usbh_devices[0].hub_addr == 0)
{
// connected directly to roothub
- TU_ASSERT_ERR(error); // TODO some slow device is observed to fail the very fist controller xfer, can try more times
hcd_port_reset( usbh_devices[0].core_id ); // reset port after 8 byte descriptor
osal_task_delay(RESET_DELAY);
}
- #if CFG_TUSB_HOST_HUB
+ #if CFG_TUH_HUB
else
{ // connected via a hub
STASK_ASSERT_ERR_HDLR(error, hub_status_pipe_queue( usbh_devices[0].hub_addr) ); // TODO hub refractor
@@ -481,10 +477,9 @@ tusb_error_t usbh_task_body(void)
new_addr = get_new_address();
TU_ASSERT(new_addr <= CFG_TUSB_HOST_DEVICE_MAX); // TODO notify application we reach max devices
- error = usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQ_SET_ADDRESS, new_addr, 0,
- 0, NULL );
- TU_ASSERT_ERR(error);
+ TU_ASSERT(usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TUSB_REQ_SET_ADDRESS, new_addr, 0,
+ 0, NULL ));
//------------- update port info & close control pipe of addr0 -------------//
usbh_devices[new_addr].core_id = usbh_devices[0].core_id;
@@ -500,10 +495,11 @@ tusb_error_t usbh_task_body(void)
TU_ASSERT_ERR ( usbh_pipe_control_open(new_addr, ((tusb_desc_device_t*) enum_data_buffer)->bMaxPacketSize0 ) );
//------------- Get full device descriptor -------------//
- error = usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TU_ASSERT(
+ usbh_control_xfer_subtask(new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_DEVICE << 8), 0,
- 18, enum_data_buffer );
- TU_ASSERT_ERR(error);
+ 18,
+ enum_data_buffer));
// update device info TODO alignment issue
usbh_devices[new_addr].vendor_id = ((tusb_desc_device_t*) enum_data_buffer)->idVendor;
@@ -514,27 +510,28 @@ tusb_error_t usbh_task_body(void)
TU_ASSERT(configure_selected <= usbh_devices[new_addr].configure_count); // TODO notify application when invalid configuration
//------------- Get 9 bytes of configuration descriptor -------------//
- error = usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
- TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
- 9, enum_data_buffer );
- TU_ASSERT_ERR(error);
+ TU_ASSERT(
+ usbh_control_xfer_subtask(new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TUSB_REQ_GET_DESCRIPTOR,
+ (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
+ 9,
+ enum_data_buffer));
+
TU_VERIFY_HDLR( CFG_TUSB_HOST_ENUM_BUFFER_SIZE >= ((tusb_desc_configuration_t*)enum_data_buffer)->wTotalLength,
tuh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG, NULL) );
//------------- Get full configuration descriptor -------------//
- error = usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TU_ASSERT( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
- CFG_TUSB_HOST_ENUM_BUFFER_SIZE, enum_data_buffer );
- TU_ASSERT_ERR(error);
+ CFG_TUSB_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ) );
// update configuration info
usbh_devices[new_addr].interface_count = ((tusb_desc_configuration_t*) enum_data_buffer)->bNumInterfaces;
//------------- Set Configure -------------//
- error = usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
+ TU_ASSERT( usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_OUT, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
TUSB_REQ_SET_CONFIGURATION, configure_selected, 0,
- 0, NULL );
- TU_ASSERT_ERR(error);
+ 0, NULL ));
usbh_devices[new_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
@@ -582,6 +579,8 @@ tusb_error_t usbh_task_body(void)
}
tuh_device_mount_succeed_cb(new_addr);
+
+ return true;
}
diff --git a/src/host/usbh.h b/src/host/usbh.h
index f4433ae31..4909eb8a7 100644
--- a/src/host/usbh.h
+++ b/src/host/usbh.h
@@ -100,7 +100,7 @@ ATTR_WEAK void tuh_device_mount_failed_cb(tusb_error_t error, tusb_desc_devic
bool usbh_init(void);
void usbh_task(void* param);
-tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
+bool usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
uint16_t wValue, uint16_t wIndex, uint16_t wLength, uint8_t* data);
#endif
diff --git a/src/tusb_option.h b/src/tusb_option.h
index 6b84db21c..07b39b5be 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -213,7 +213,7 @@
#endif
//------------- HUB CLASS -------------//
- #if CFG_TUSB_HOST_HUB && (CFG_TUSB_HOST_DEVICE_MAX == 1)
+ #if CFG_TUH_HUB && (CFG_TUSB_HOST_DEVICE_MAX == 1)
#error there is no benefit enable hub with max device is 1. Please disable hub or increase CFG_TUSB_HOST_DEVICE_MAX
#endif
diff --git a/tests/support/tusb_config.h b/tests/support/tusb_config.h
index bf6277849..3e5721019 100644
--- a/tests/support/tusb_config.h
+++ b/tests/support/tusb_config.h
@@ -55,7 +55,7 @@
#define CFG_TUSB_HOST_DEVICE_MAX 5 // TODO be a part of HUB config
//------------- CLASS -------------//
-#define CFG_TUSB_HOST_HUB 0
+#define CFG_TUH_HUB 0
#define CFG_TUSB_HOST_HID_KEYBOARD 1
#define CFG_TUSB_HOST_HID_MOUSE 1
#define CFG_TUSB_HOST_MSC 1