Skip to content

Commit 3a7d1cf

Browse files
committed
minor cleanup
1 parent 039b235 commit 3a7d1cf

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

examples/host/libusb_api/src/main.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
//--------------------------------------------------------------------+
4141
void led_blinking_task(void);
4242

43-
extern void cdc_task(void);
44-
extern void hid_app_task(void);
45-
4643
/*------------- MAIN -------------*/
4744
int main(void)
4845
{
@@ -67,10 +64,17 @@ int main(void)
6764
// TinyUSB Callbacks
6865
//--------------------------------------------------------------------+
6966

67+
void print_device_descriptor(uint8_t dev_addr)
68+
{
69+
printf("Device Descriptor:\r\n");
70+
71+
}
72+
7073
// Invoked when device is mounted (configured)
7174
void tuh_mount_cb (uint8_t dev_addr)
7275
{
7376
printf("Device attached, address = %d\r\n", dev_addr);
77+
print_device_descriptor(dev_addr);
7478
}
7579

7680
/// Invoked when device is unmounted (bus reset/unplugged)

src/host/usbh.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
// USBH Configuration
3838
//--------------------------------------------------------------------+
3939

40-
// TODO remove,update
41-
#ifndef CFG_TUH_EP_MAX
42-
#define CFG_TUH_EP_MAX 9
43-
#endif
44-
4540
#ifndef CFG_TUH_TASK_QUEUE_SZ
4641
#define CFG_TUH_TASK_QUEUE_SZ 16
4742
#endif
@@ -72,7 +67,7 @@ typedef struct
7267
} usbh_dev0_t;
7368

7469
typedef struct {
75-
// port
70+
// port, must be same layout as usbh_dev0_t
7671
uint8_t rhport;
7772
uint8_t hub_addr;
7873
uint8_t hub_port;
@@ -102,7 +97,7 @@ typedef struct {
10297
volatile uint8_t state; // device state, value from enum tusbh_device_state_t
10398

10499
uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid)
105-
uint8_t ep2drv[CFG_TUH_EP_MAX][2]; // map endpoint to driver ( 0xff is invalid )
100+
uint8_t ep2drv[CFG_TUH_ENDPOINT_MAX][2]; // map endpoint to driver ( 0xff is invalid )
106101

107102
struct TU_ATTR_PACKED
108103
{
@@ -111,7 +106,7 @@ typedef struct {
111106
volatile bool claimed : 1;
112107

113108
// TODO merge ep2drv here, 4-bit should be sufficient
114-
}ep_status[CFG_TUH_EP_MAX][2];
109+
}ep_status[CFG_TUH_ENDPOINT_MAX][2];
115110

116111
// Mutex for claiming endpoint, only needed when using with preempted RTOS
117112
#if CFG_TUSB_OS != OPT_OS_NONE
@@ -344,6 +339,8 @@ bool tuh_init(uint8_t rhport)
344339

345340
TU_LOG2("USBH init\r\n");
346341

342+
TU_LOG2_INT(sizeof(usbh_device_t));
343+
347344
tu_memclr(_usbh_devices, sizeof(_usbh_devices));
348345
tu_memclr(&_dev0, sizeof(_dev0));
349346

0 commit comments

Comments
 (0)