Skip to content

Commit 3095404

Browse files
committed
minor house keeping
1 parent 99ad3ae commit 3095404

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

src/class/msc/msc_host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "tusb_option.h"
2828

29-
#if CFG_TUH_ENABLED & CFG_TUH_MSC
29+
#if CFG_TUH_ENABLED && CFG_TUH_MSC
3030

3131
#include "host/usbh.h"
3232
#include "host/usbh_classdriver.h"

src/common/tusb_error.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ typedef enum
6464
#if CFG_TUSB_DEBUG
6565
/// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0
6666
extern char const* const tusb_strerr[TUSB_ERROR_COUNT];
67+
extern char const* const tusb_speed_str[];
68+
6769
#endif
6870

6971
#ifdef __cplusplus

src/device/usbd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ static char const* const _tusb_std_request_str[] =
332332
"Synch Frame"
333333
};
334334

335-
static char const* const _tusb_speed_str[] = { "Full", "Low", "High" };
336-
337335
// for usbd_control to print the name of control complete driver
338336
void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t callback)
339337
{
@@ -509,7 +507,7 @@ void tud_task (void)
509507
switch ( event.event_id )
510508
{
511509
case DCD_EVENT_BUS_RESET:
512-
TU_LOG2(": %s Speed\r\n", _tusb_speed_str[event.bus_reset.speed]);
510+
TU_LOG2(": %s Speed\r\n", tusb_speed_str[event.bus_reset.speed]);
513511
usbd_reset(event.rhport);
514512
_usbd_dev.speed = event.bus_reset.speed;
515513
break;

src/host/usbh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ static bool enum_new_device(hcd_event_t* event)
709709
if ( !hcd_port_connect_status(_dev0.rhport) ) return true;
710710

711711
_dev0.speed = hcd_port_speed_get(_dev0.rhport );
712+
TU_LOG2("%s Speed\r\n", tusb_speed_str[_dev0.speed]);
712713

713714
enum_request_addr0_device_desc();
714715
}

src/tusb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ uint16_t tu_desc_get_interface_total_len(tusb_desc_interface_t const* desc_itf,
163163

164164
char const* const tusb_strerr[TUSB_ERROR_COUNT] = { ERROR_TABLE(ERROR_STRING) };
165165

166+
char const* const tusb_speed_str[] = { "Full", "Low", "High" };
167+
166168
static void dump_str_line(uint8_t const* buf, uint16_t count)
167169
{
168170
tu_printf(" |");

src/tusb_option.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,19 @@
223223
// CFG_TUD_SPEED OPT_MODE_HIGH_SPEED
224224

225225
//------------- Roothub as Host -------------//
226-
#define TUH_OPT_RHPORT ( ((CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST) ? 0 : (((CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST) ? 1 : -1) )
227-
#define CFG_TUH_ENABLED ( TUH_OPT_RHPORT >= 0 )
226+
227+
#if (CFG_TUSB_RHPORT0_MODE) & OPT_MODE_HOST
228+
#define TUH_RHPORT_MODE (CFG_TUSB_RHPORT0_MODE)
229+
#define TUH_OPT_RHPORT 0
230+
#elif (CFG_TUSB_RHPORT1_MODE) & OPT_MODE_HOST
231+
#define TUH_RHPORT_MODE (CFG_TUSB_RHPORT1_MODE)
232+
#define TUH_OPT_RHPORT 1
233+
#else
234+
#define TUH_RHPORT_MODE OPT_MODE_NONE
235+
#define TUH_OPT_RHPORT -1
236+
#endif
237+
238+
#define CFG_TUH_ENABLED ( TUH_RHPORT_MODE & OPT_MODE_HOST )
228239

229240
// For backward compatible
230241
#define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED

0 commit comments

Comments
 (0)