Skip to content

Commit 8b3c558

Browse files
authored
Merge pull request hathach#3093 from hathach/refactor-usbh-bus-info
refactor(usbh) improve the usage of bus info
2 parents b632686 + 9a1f690 commit 8b3c558

File tree

21 files changed

+241
-202
lines changed

21 files changed

+241
-202
lines changed

.idea/debugServers/esp32s2.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/debugServers/rp2350.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/debugServers/stm32f769.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/debugServers/stm32h563.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/debugServers/stm32h743.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/host/cdc_msc_hid/src/msc_app.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@
3030
//--------------------------------------------------------------------+
3131
static scsi_inquiry_resp_t inquiry_resp;
3232

33-
bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
34-
{
33+
static bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data) {
3534
msc_cbw_t const* cbw = cb_data->cbw;
3635
msc_csw_t const* csw = cb_data->csw;
3736

38-
if (csw->status != 0)
39-
{
37+
if (csw->status != 0) {
4038
printf("Inquiry failed\r\n");
4139
return false;
4240
}
@@ -55,16 +53,14 @@ bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_da
5553
}
5654

5755
//------------- IMPLEMENTATION -------------//
58-
void tuh_msc_mount_cb(uint8_t dev_addr)
59-
{
56+
void tuh_msc_mount_cb(uint8_t dev_addr) {
6057
printf("A MassStorage device is mounted\r\n");
6158

6259
uint8_t const lun = 0;
6360
tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb, 0);
6461
}
6562

66-
void tuh_msc_umount_cb(uint8_t dev_addr)
67-
{
63+
void tuh_msc_umount_cb(uint8_t dev_addr) {
6864
(void) dev_addr;
6965
printf("A MassStorage device is unmounted\r\n");
7066
}

src/host/hcd.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ typedef struct {
9090
};
9191
} hcd_event_t;
9292

93-
typedef struct {
94-
uint8_t rhport;
95-
uint8_t hub_addr;
96-
uint8_t hub_port;
97-
uint8_t speed;
98-
} hcd_devtree_info_t;
99-
10093
//--------------------------------------------------------------------+
10194
// Memory API
10295
//--------------------------------------------------------------------+
@@ -186,13 +179,6 @@ bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr);
186179
// USBH implemented API
187180
//--------------------------------------------------------------------+
188181

189-
// Get device tree information of a device
190-
// USB device tree can be complicated and manged by USBH, this help HCD to retrieve
191-
// needed topology info to carry out its work
192-
extern void hcd_devtree_get_info(uint8_t dev_addr, hcd_devtree_info_t* devtree_info);
193-
194-
//------------- Event API -------------//
195-
196182
// Called by HCD to notify stack
197183
extern void hcd_event_handler(hcd_event_t const* event, bool in_isr);
198184

@@ -239,4 +225,4 @@ void hcd_event_xfer_complete(uint8_t dev_addr, uint8_t ep_addr, uint32_t xferred
239225
}
240226
#endif
241227

242-
#endif /* _TUSB_HCD_H_ */
228+
#endif

0 commit comments

Comments
 (0)