summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-08-30 16:21:43 +0700
committerhathach <[email protected]>2023-08-30 16:21:43 +0700
commit41493426b38c8ce44b1f7720b907538bc5402f98 (patch)
treee25d55d1cd9d9c8101969edca0b4012e8d5bc790
parent1ab488eb06ef4cb8ad9c0cff91e6b0caf76f73c4 (diff)
use ep buf to keep setup packet, work well with hid device
-rw-r--r--examples/host/msc_file_explorer/src/tusb_config.h2
-rw-r--r--src/portable/analog/max3421/hcd_max3421.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/host/msc_file_explorer/src/tusb_config.h b/examples/host/msc_file_explorer/src/tusb_config.h
index 28e130c0e..e6186ba46 100644
--- a/examples/host/msc_file_explorer/src/tusb_config.h
+++ b/examples/host/msc_file_explorer/src/tusb_config.h
@@ -37,7 +37,7 @@
#if CFG_TUSB_MCU == OPT_MCU_RP2040
// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
#define CFG_TUH_RPI_PIO_USB 0
- #define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_US
+ #define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_USB
//#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
// // Use external USB controller (via SPI) MAX3421E (aka usb host shield)
// #define CFG_TUH_MAX3421 1
diff --git a/src/portable/analog/max3421/hcd_max3421.c b/src/portable/analog/max3421/hcd_max3421.c
index 705bb5bfd..d644390da 100644
--- a/src/portable/analog/max3421/hcd_max3421.c
+++ b/src/portable/analog/max3421/hcd_max3421.c
@@ -633,6 +633,7 @@ TU_ATTR_ALWAYS_INLINE static inline void xact_inout(uint8_t rhport, max3421_ep_t
// setup
if (ep->is_setup) {
peraddr_write(rhport, ep->daddr, in_isr);
+ fifo_write(rhport, SUDFIFO_ADDR, ep->buf, 8, in_isr);
hxfr_write(rhport, HXFR_SETUP, in_isr);
return;
}
@@ -703,12 +704,12 @@ bool hcd_setup_send(uint8_t rhport, uint8_t daddr, uint8_t const setup_packet[8]
TU_ASSERT(ep);
ep->ep_dir = 0;
+ ep->is_setup = 1;
+ ep->buf = (uint8_t*)(uintptr_t) setup_packet;
ep->total_len = 8;
ep->xferred_len = 0;
+ ep->xfer_complete = 0;
ep->xfer_pending = 1;
- ep->is_setup = 1;
-
- fifo_write(rhport, SUDFIFO_ADDR, setup_packet, 8, false);
// carry out transfer if not busy
if ( !atomic_flag_test_and_set(&_hcd_data.busy) ) {