mirror of
https://github.com/hathach/tinyusb.git
synced 2026-03-24 08:24:49 +00:00
Merge pull request #3560 from hathach/rp2-disable-hwifo
rp2 disable hwfifo
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user