summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-01-09 23:34:00 +0700
committerhathach <[email protected]>2026-01-10 00:11:09 +0700
commit09b8f4008450e55caea2f8ee559a3d0abcd87a36 (patch)
treeb2f072113c493f188644ec7ea703ce1e084bc109
parent4c86cbdc822ccf0f71a67c5f2d627e18ecbad46f (diff)
remove transfer_type from hw_endpoint
-rw-r--r--hw/bsp/rp2040/family.cmake1
-rw-r--r--src/portable/raspberrypi/rp2040/dcd_rp2040.c1
-rw-r--r--src/portable/raspberrypi/rp2040/rp2040_usb.c12
-rw-r--r--src/portable/raspberrypi/rp2040/rp2040_usb.h1
4 files changed, 7 insertions, 8 deletions
diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake
index 40eee082d..e617ab3ca 100644
--- a/hw/bsp/rp2040/family.cmake
+++ b/hw/bsp/rp2040/family.cmake
@@ -251,6 +251,7 @@ function(family_configure_target TARGET RTOS)
family_flash_jlink(${TARGET})
# Generate linkermap target and post build. LINKERMAP_OPTION can be set with -D to change default options
+ family_add_bloaty(${TARGET})
family_add_linkermap(${TARGET})
endfunction()
diff --git a/src/portable/raspberrypi/rp2040/dcd_rp2040.c b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
index f25d808d4..240e6c727 100644
--- a/src/portable/raspberrypi/rp2040/dcd_rp2040.c
+++ b/src/portable/raspberrypi/rp2040/dcd_rp2040.c
@@ -74,7 +74,6 @@ static void hw_endpoint_init(hw_endpoint_t *ep, uint8_t ep_addr, uint16_t wMaxPa
ep->ep_addr = ep_addr;
ep->next_pid = 0u;
ep->wMaxPacketSize = wMaxPacketSize;
- ep->transfer_type = transfer_type;
// Clear existing buffer control state
io_rw_32 *buf_ctrl_reg = hwbuf_ctrl_reg_device(ep);
diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.c b/src/portable/raspberrypi/rp2040/rp2040_usb.c
index bde45db1b..3b65f57a4 100644
--- a/src/portable/raspberrypi/rp2040/rp2040_usb.c
+++ b/src/portable/raspberrypi/rp2040/rp2040_usb.c
@@ -47,22 +47,20 @@ static bool e15_is_critical_frame_period(struct hw_endpoint *ep);
// Implementation
//--------------------------------------------------------------------+
// Provide own byte by byte memcpy as not all copies are aligned
-static void unaligned_memcpy(void *dst, const void *src, size_t n) {
- uint8_t *dst_byte = (uint8_t*)dst;
- const uint8_t *src_byte = (const uint8_t*)src;
+static void unaligned_memcpy(uint8_t *dst, const uint8_t *src, size_t n) {
while (n--) {
- *dst_byte++ = *src_byte++;
+ *dst++ = *src++;
}
}
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((void *)(uintptr_t)hwfifo, src, len);
+ unaligned_memcpy((uint8_t *)(uintptr_t)hwfifo, src, len);
}
void tu_hwfifo_read(const volatile void *hwfifo, uint8_t *dest, uint16_t len, const tu_hwfifo_access_t *access_mode) {
(void)access_mode;
- unaligned_memcpy(dest, (const void *)(uintptr_t)hwfifo, len);
+ unaligned_memcpy(dest, (const uint8_t *)(uintptr_t)hwfifo, len);
}
void rp2usb_init(void) {
@@ -141,6 +139,7 @@ static uint32_t __tusb_irq_path_func(prepare_ep_buffer)(struct hw_endpoint *ep,
// Copy data from user buffer/fifo to hw buffer
uint8_t *hw_buf = ep->hw_data_buf + buf_id * 64;
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 {
unaligned_memcpy(hw_buf, ep->user_buf, buflen);
@@ -286,6 +285,7 @@ static uint16_t __tusb_irq_path_func(sync_ep_buffer)(hw_endpoint_t *ep, io_rw_32
uint8_t *hw_buf = ep->hw_data_buf + buf_id * 64;
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 {
unaligned_memcpy(ep->user_buf, hw_buf, xferred_bytes);
diff --git a/src/portable/raspberrypi/rp2040/rp2040_usb.h b/src/portable/raspberrypi/rp2040/rp2040_usb.h
index cce868540..c03dc34b2 100644
--- a/src/portable/raspberrypi/rp2040/rp2040_usb.h
+++ b/src/portable/raspberrypi/rp2040/rp2040_usb.h
@@ -64,7 +64,6 @@
typedef struct hw_endpoint {
uint8_t ep_addr;
uint8_t next_pid;
- uint8_t transfer_type;
bool active; // transferring data
bool is_xfer_fifo; // transfer using fifo