use ep buf to keep setup packet, work well with hid device

This commit is contained in:
hathach 2023-08-30 16:21:43 +07:00
parent 1ab488eb06
commit 41493426b3
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA
2 changed files with 5 additions and 4 deletions

View File

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

View File

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