minor house keeping
diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index a49a105..e4239e3 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c
@@ -26,7 +26,7 @@ #include "tusb_option.h" -#if CFG_TUH_ENABLED & CFG_TUH_MSC +#if CFG_TUH_ENABLED && CFG_TUH_MSC #include "host/usbh.h" #include "host/usbh_classdriver.h"
diff --git a/src/common/tusb_error.h b/src/common/tusb_error.h index d7ad8c3..42541ac 100644 --- a/src/common/tusb_error.h +++ b/src/common/tusb_error.h
@@ -64,6 +64,8 @@ #if CFG_TUSB_DEBUG /// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0 extern char const* const tusb_strerr[TUSB_ERROR_COUNT]; +extern char const* const tusb_speed_str[]; + #endif #ifdef __cplusplus
diff --git a/src/device/usbd.c b/src/device/usbd.c index e6861ee..c20bab7 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c
@@ -332,8 +332,6 @@ "Synch Frame" }; -static char const* const _tusb_speed_str[] = { "Full", "Low", "High" }; - // for usbd_control to print the name of control complete driver void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback) { @@ -509,7 +507,7 @@ switch ( event.event_id ) { case DCD_EVENT_BUS_RESET: - TU_LOG2(": %s Speed\r\n", _tusb_speed_str[event.bus_reset.speed]); + TU_LOG2(": %s Speed\r\n", tusb_speed_str[event.bus_reset.speed]); usbd_reset(event.rhport); _usbd_dev.speed = event.bus_reset.speed; break;
diff --git a/src/host/usbh.c b/src/host/usbh.c index e29ce1e..ce0ccc3 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c
@@ -709,6 +709,7 @@ if ( !hcd_port_connect_status(_dev0.rhport) ) return true; _dev0.speed = hcd_port_speed_get(_dev0.rhport ); + TU_LOG2("%s Speed\r\n", tusb_speed_str[_dev0.speed]); enum_request_addr0_device_desc(); }
diff --git a/src/tusb.c b/src/tusb.c index 03fe431..a302210 100644 --- a/src/tusb.c +++ b/src/tusb.c
@@ -163,6 +163,8 @@ char const* const tusb_strerr[TUSB_ERROR_COUNT] = { ERROR_TABLE(ERROR_STRING) }; +char const* const tusb_speed_str[] = { "Full", "Low", "High" }; + static void dump_str_line(uint8_t const* buf, uint16_t count) { tu_printf(" |");
diff --git a/src/tusb_option.h b/src/tusb_option.h index 6a36384..5bf3364 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h
@@ -223,8 +223,19 @@ // CFG_TUD_SPEED OPT_MODE_HIGH_SPEED //------------- Roothub as Host -------------// -#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) ) -#define CFG_TUH_ENABLED ( TUH_OPT_RHPORT >= 0 ) + +#if (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST + #define TUH_RHPORT_MODE (CFG_TUSB_RHPORT0_MODE) + #define TUH_OPT_RHPORT 0 +#elif (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST + #define TUH_RHPORT_MODE (CFG_TUSB_RHPORT1_MODE) + #define TUH_OPT_RHPORT 1 +#else + #define TUH_RHPORT_MODE OPT_MODE_NONE + #define TUH_OPT_RHPORT -1 +#endif + +#define CFG_TUH_ENABLED ( TUH_RHPORT_MODE & OPT_MODE_HOST ) // For backward compatible #define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED