minor house keeping

This commit is contained in:
hathach 2022-02-25 22:26:35 +07:00
parent 99ad3ae2ca
commit 309540473b
6 changed files with 20 additions and 6 deletions

View File

@ -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"

View File

@ -64,6 +64,8 @@ typedef enum
#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

View File

@ -332,8 +332,6 @@ static char const* const _tusb_std_request_str[] =
"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 @@ void tud_task (void)
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;

View File

@ -709,6 +709,7 @@ static bool enum_new_device(hcd_event_t* event)
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();
}

View File

@ -163,6 +163,8 @@ uint16_t tu_desc_get_interface_total_len(tusb_desc_interface_t const* desc_itf,
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(" |");

View File

@ -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