diff --git a/demos/device/src/tusb_config.h b/demos/device/src/tusb_config.h
index dd07bc57d..41aaf468a 100644
--- a/demos/device/src/tusb_config.h
+++ b/demos/device/src/tusb_config.h
@@ -61,20 +61,17 @@
//--------------------------------------------------------------------+
// HOST CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_HOST_DEVICE_MAX 1
-#define TUSB_CFG_CONFIGURATION_MAX 1
-
-//------------- USBD -------------//
-#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256
+#define TUSB_CFG_HOST_DEVICE_MAX 1
+#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256
//------------- CLASS -------------//
-#define TUSB_CFG_HOST_HUB 0
-#define TUSB_CFG_HOST_HID_KEYBOARD 0
-#define TUSB_CFG_HOST_HID_MOUSE 0
-#define TUSB_CFG_HOST_HID_GENERIC 0
-#define TUSB_CFG_HOST_MSC 0
-#define TUSB_CFG_HOST_CDC 0
-#define TUSB_CFG_HOST_CDC_RNDIS 0
+#define TUSB_CFG_HOST_HUB 0
+#define TUSB_CFG_HOST_HID_KEYBOARD 0
+#define TUSB_CFG_HOST_HID_MOUSE 0
+#define TUSB_CFG_HOST_HID_GENERIC 0
+#define TUSB_CFG_HOST_MSC 0
+#define TUSB_CFG_HOST_CDC 0
+#define TUSB_CFG_HOST_CDC_RNDIS 0
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
@@ -85,13 +82,11 @@
#define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor, remove
//------------- CLASS -------------//
-#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
-#define TUSB_CFG_DEVICE_HID_MOUSE 0
-#define TUSB_CFG_DEVICE_HID_GENERIC 0
-#define TUSB_CFG_DEVICE_MSC 0
-#define TUSB_CFG_DEVICE_CDC 1
-
-
+#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
+#define TUSB_CFG_DEVICE_HID_MOUSE 0
+#define TUSB_CFG_DEVICE_HID_GENERIC 0
+#define TUSB_CFG_DEVICE_MSC 0
+#define TUSB_CFG_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
diff --git a/demos/host/host_os_none/.cproject b/demos/host/host_os_none/.cproject
index a766f338a..c68972029 100644
--- a/demos/host/host_os_none/.cproject
+++ b/demos/host/host_os_none/.cproject
@@ -82,7 +82,7 @@
-
+
@@ -170,6 +170,7 @@
+
@@ -178,7 +179,7 @@
-
+
@@ -270,7 +271,7 @@
-
+
@@ -362,7 +363,7 @@
-
+
@@ -451,7 +452,7 @@
-
+
@@ -536,6 +537,7 @@
+
@@ -561,8 +563,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<TargetConfig>
-<Properties property_0="" property_3="NXP" property_4="LPC1769" property_count="5" version="1"/>
-<infoList vendor="NXP"><info chip="LPC1769" match_id="0x26113F37" name="LPC1769" package="lpc17_lqfp100.xml"><chip><name>LPC1769</name>
+<Properties property_0="" property_2="LPC175x_6x_512.cfx" property_3="NXP" property_4="LPC1769" property_count="5" version="1"/>
+<infoList vendor="NXP"><info chip="LPC1769" flash_driver="LPC175x_6x_512.cfx" match_id="0x26113F37" name="LPC1769" package="lpc17_lqfp100.xml" stub="crt_emu_cm3_nxp"><chip><name>LPC1769</name>
<family>LPC17xx</family>
<vendor>NXP (formerly Philips)</vendor>
<reset board="None" core="Real" sys="Real"/>
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index c05a5fc11..a8a001beb 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -448,7 +448,7 @@
app
- 1
+ 0
0
0
0
@@ -568,7 +568,7 @@
tinyusb
- 1
+ 0
0
0
0
@@ -832,7 +832,7 @@
boards
- 1
+ 0
0
0
0
@@ -1000,7 +1000,7 @@
cmsis
- 1
+ 0
0
0
0
@@ -1104,7 +1104,7 @@
startup
- 1
+ 0
0
0
0
diff --git a/demos/host/src/tusb_config.h b/demos/host/src/tusb_config.h
index ef01e87c0..09e481bbd 100644
--- a/demos/host/src/tusb_config.h
+++ b/demos/host/src/tusb_config.h
@@ -60,20 +60,17 @@
//--------------------------------------------------------------------+
// HOST CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_HOST_DEVICE_MAX 3 // TODO be a part of HUB config
-#define TUSB_CFG_CONFIGURATION_MAX 1
-
-//------------- USBD -------------//
-#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255
+#define TUSB_CFG_HOST_DEVICE_MAX 3 // TODO be a part of HUB config
+#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 255
//------------- CLASS -------------//
-#define TUSB_CFG_HOST_HUB 1
-#define TUSB_CFG_HOST_HID_KEYBOARD 0
-#define TUSB_CFG_HOST_HID_MOUSE 0
-#define TUSB_CFG_HOST_HID_GENERIC 0
-#define TUSB_CFG_HOST_MSC 0
-#define TUSB_CFG_HOST_CDC 1
-#define TUSB_CFG_HOST_CDC_RNDIS 0
+#define TUSB_CFG_HOST_HUB 1
+#define TUSB_CFG_HOST_HID_KEYBOARD 1
+#define TUSB_CFG_HOST_HID_MOUSE 1
+#define TUSB_CFG_HOST_HID_GENERIC 0
+#define TUSB_CFG_HOST_MSC 1
+#define TUSB_CFG_HOST_CDC 1
+#define TUSB_CFG_HOST_CDC_RNDIS 0
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
@@ -82,11 +79,11 @@
#define TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT 4
//------------- CLASS -------------//
-#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
-#define TUSB_CFG_DEVICE_HID_MOUSE 0
-#define TUSB_CFG_DEVICE_HID_GENERIC 0
-#define TUSB_CFG_DEVICE_MSC 0
-#define TUSB_CFG_DEVICE_CDC 0
+#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
+#define TUSB_CFG_DEVICE_HID_MOUSE 0
+#define TUSB_CFG_DEVICE_HID_GENERIC 0
+#define TUSB_CFG_DEVICE_MSC 0
+#define TUSB_CFG_DEVICE_CDC 0
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index ecc7bf425..4933634d2 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -228,6 +228,13 @@ static inline uint32_t offset4k(uint32_t value)
}
//------------- Mathematics -------------//
+static inline uint32_t abs_of(int32_t value) ATTR_ALWAYS_INLINE ATTR_CONST;
+static inline uint32_t abs_of(int32_t value)
+{
+ return (value < 0) ? (-value) : value;
+}
+
+
/// inclusive range checking
static inline bool is_in_range(uint32_t lower, uint32_t value, uint32_t upper) ATTR_ALWAYS_INLINE ATTR_CONST;
static inline bool is_in_range(uint32_t lower, uint32_t value, uint32_t upper)
diff --git a/tinyusb/host/ohci/ohci.c b/tinyusb/host/ohci/ohci.c
index 75688cfca..f55563535 100644
--- a/tinyusb/host/ohci/ohci.c
+++ b/tinyusb/host/ohci/ohci.c
@@ -293,7 +293,7 @@ tusb_error_t hcd_pipe_control_xfer(uint8_t dev_addr, tusb_control_request_t con
ohci_gtd_t *p_status = p_setup + 2;
//------------- SETUP Phase -------------//
- gtd_init(p_setup, p_request, 8);
+ gtd_init(p_setup, (void*) p_request, 8);
p_setup->index = dev_addr;
p_setup->pid = OHCI_PID_SETUP;
p_setup->data_toggle = BIN8(10); // DATA0
@@ -664,9 +664,11 @@ void hcd_isr(uint8_t hostid)
// TODO dual port is not yet supported
if ( rhport_status & OHCI_RHPORT_CONNECT_STATUS_CHANGE_MASK )
{
+ // TODO check if remote wake-up
if ( OHCI_REG->rhport_status_bit[0].current_connect_status )
{
-// OHCI_REG->rhport_status[0] = OHCI_RHPORT_PORT_RESET_STATUS_MASK; // reset port immediately
+ // TODO reset port immediately, without this controller will got 2-3 (debouncing connection status change)
+ OHCI_REG->rhport_status[0] = OHCI_RHPORT_PORT_RESET_STATUS_MASK;
usbh_hcd_rhport_plugged_isr(0);
}else
{
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index de9e15164..229c9da65 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -375,7 +375,7 @@ tusb_error_t enumeration_body_subtask(void)
{
if( hcd_port_connect_status(usbh_devices[0].core_id) )
{ // connection event
- osal_task_delay(200); // wait until device is stable
+ osal_task_delay(200); // wait until device is stable. Increase this if the first 8 bytes is failed to get
if ( !hcd_port_connect_status(usbh_devices[0].core_id) ) SUBTASK_EXIT(TUSB_ERROR_NONE); // exit if device unplugged while delaying
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h
index adea45f32..7816cda33 100644
--- a/tinyusb/osal/osal_none.h
+++ b/tinyusb/osal/osal_none.h
@@ -203,7 +203,7 @@ static inline void osal_semaphore_reset(osal_semaphore_handle_t sem_hdl)
timeout = osal_tick_get();\
state = __LINE__; case __LINE__:\
if( *(sem_hdl) == 0 ) {\
- if ( (msec != OSAL_TIMEOUT_WAIT_FOREVER) && (timeout + osal_tick_from_msec(msec) <= osal_tick_get()) ) /* time out */ \
+ if ( ( ((uint32_t) (msec)) != OSAL_TIMEOUT_WAIT_FOREVER) && (timeout + osal_tick_from_msec(msec) <= osal_tick_get()) ) /* time out */ \
*(p_error) = TUSB_ERROR_OSAL_TIMEOUT;\
else\
return TUSB_ERROR_OSAL_WAITING;\
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index 3e6ec3574..d27f21cbe 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -126,10 +126,10 @@
/**
* Maximum number of supported USB's configuration (currently only support only 1)
*/
-#ifndef TUSB_CFG_CONFIGURATION_MAX
- #define TUSB_CFG_CONFIGURATION_MAX 1
- #warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
-#endif
+//#ifndef TUSB_CFG_CONFIGURATION_MAX
+// #define TUSB_CFG_CONFIGURATION_MAX 1
+// #warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
+//#endif
//--------------------------------------------------------------------+
// HOST OPTIONS