summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-03-19 10:31:17 +0700
committerGitHub <[email protected]>2026-03-19 10:31:17 +0700
commit8a9f44bdd267d05640d1028c07269d044291243b (patch)
tree849234944fd5861e255400bdf3882b0b2cb35bed
parent418501e99f7df7ab556b928084f520ed9a010294 (diff)
parent9b17d55c91744ace59ad85dbb7b4ae8c6aedfb2c (diff)
Merge pull request #3560 from hathach/rp2-disable-hwifo
rp2 disable hwfifo
-rw-r--r--src/portable/raspberrypi/rp2040/dcd_rp2040.c2
-rw-r--r--src/portable/raspberrypi/rp2040/rp2040_usb.c18
-rw-r--r--src/tusb_option.h2
3 files changed, 18 insertions, 4 deletions
diff --git a/src/portable/raspberrypi/rp2040/dcd_rp2040.c b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
index 240e6c727..ca0e24e96 100644
--- a/src/portable/raspberrypi/rp2040/dcd_rp2040.c
+++ b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
@@ -505,6 +505,7 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to
return true;
}
+#if CFG_TUD_EDPT_DEDICATED_HWFIFO
bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t *ff, uint16_t total_bytes, bool is_isr) {
(void)rhport;
(void)is_isr;
@@ -512,6 +513,7 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t *ff, uint16_t
hw_endpoint_xfer_start(ep, NULL, ff, total_bytes);
return true;
}
+#endif
void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) {
(void)rhport;
diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.c b/src/portable/raspberrypi/rp2040/rp2040_usb.c
index 3b65f57a4..ca83acc6b 100644
--- a/src/portable/raspberrypi/rp2040/rp2040_usb.c
+++ b/src/portable/raspberrypi/rp2040/rp2040_usb.c
@@ -53,6 +53,7 @@ static void unaligned_memcpy(uint8_t *dst, const uint8_t *src, size_t n) {
}
}
+#if CFG_TUD_EDPT_DEDICATED_HWFIFO
void tu_hwfifo_write(volatile void *hwfifo, const uint8_t *src, uint16_t len, const tu_hwfifo_access_t *access_mode) {
(void)access_mode;
unaligned_memcpy((uint8_t *)(uintptr_t)hwfifo, src, len);
@@ -62,6 +63,7 @@ void tu_hwfifo_read(const volatile void *hwfifo, uint8_t *dest, uint16_t len, co
(void)access_mode;
unaligned_memcpy(dest, (const uint8_t *)(uintptr_t)hwfifo, len);
}
+#endif
void rp2usb_init(void) {
// Reset usb controller
@@ -138,10 +140,13 @@ static uint32_t __tusb_irq_path_func(prepare_ep_buffer)(struct hw_endpoint *ep,
if (buflen) {
// Copy data from user buffer/fifo to hw buffer
uint8_t *hw_buf = ep->hw_data_buf + buf_id * 64;
+ #if CFG_TUD_EDPT_DEDICATED_HWFIFO
if (ep->is_xfer_fifo) {
// not in sram, may mess up timing with E15 workaround
tu_hwfifo_write_from_fifo(hw_buf, ep->user_fifo, buflen, NULL);
- } else {
+ } else
+ #endif
+ {
unaligned_memcpy(hw_buf, ep->user_buf, buflen);
ep->user_buf += buflen;
}
@@ -227,6 +232,7 @@ void __tusb_irq_path_func(hw_endpoint_start_next_buffer)(struct hw_endpoint* ep)
}
void hw_endpoint_xfer_start(struct hw_endpoint *ep, uint8_t *buffer, tu_fifo_t *ff, uint16_t total_len) {
+ (void) ff;
hw_endpoint_lock_update(ep, 1);
if (ep->active) {
@@ -240,10 +246,13 @@ void hw_endpoint_xfer_start(struct hw_endpoint *ep, uint8_t *buffer, tu_fifo_t *
ep->xferred_len = 0;
ep->active = true;
+#if CFG_TUD_EDPT_DEDICATED_HWFIFO
if (ff != NULL) {
ep->user_fifo = ff;
ep->is_xfer_fifo = true;
- } else {
+ } else
+#endif
+ {
ep->user_buf = buffer;
ep->is_xfer_fifo = false;
}
@@ -284,10 +293,13 @@ static uint16_t __tusb_irq_path_func(sync_ep_buffer)(hw_endpoint_t *ep, io_rw_32
assert(buf_ctrl & USB_BUF_CTRL_FULL);
uint8_t *hw_buf = ep->hw_data_buf + buf_id * 64;
+ #if CFG_TUD_EDPT_DEDICATED_HWFIFO
if (ep->is_xfer_fifo) {
// not in sram, may mess up timing with E15 workaround
tu_hwfifo_read_to_fifo(hw_buf, ep->user_fifo, xferred_bytes, NULL);
- } else {
+ } else
+ #endif
+ {
unaligned_memcpy(ep->user_buf, hw_buf, xferred_bytes);
ep->user_buf += xferred_bytes;
}
diff --git a/src/tusb_option.h b/src/tusb_option.h
index 9eb8ee533..74a556605 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -381,7 +381,7 @@
#endif
#if (CFG_TUSB_MCU == OPT_MCU_RP2040) && !CFG_TUD_RPI_PIO_USB
- #define CFG_TUD_EDPT_DEDICATED_HWFIFO 1
+ #define CFG_TUD_EDPT_DEDICATED_HWFIFO 0
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 1
#define CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE 1
#define CFG_TUSB_FIFO_HWFIFO_CUSTOM_WRITE