diff --git a/src/portable/espressif/esp32s2/dcd_esp32s2.c b/src/portable/espressif/esp32s2/dcd_esp32s2.c index ade79f10..eb2c0515 100644 --- a/src/portable/espressif/esp32s2/dcd_esp32s2.c +++ b/src/portable/espressif/esp32s2/dcd_esp32s2.c @@ -382,16 +382,6 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 num_packets++; } - // Set copy mode to constant address - required since data copied to or from the hardware USB FIFO needs to be written at a constant address - if (dir == TUSB_DIR_IN) - { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_CST); - } - else - { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_CST); - } - ESP_LOGV(TAG, "Transfer <-> EP%i, %s, pkgs: %i, bytes: %i", epnum, ((dir == TUSB_DIR_IN) ? "USB0.HOST (in)" : "HOST->DEV (out)"), num_packets, total_bytes); @@ -527,7 +517,7 @@ static void receive_packet(xfer_ctl_t *xfer, /* usb_out_endpoint_t * out_ep, */ if (xfer->ff) { // Ring buffer - tu_fifo_write_n(xfer->ff, (const void *) rx_fifo, to_recv_size); + tu_fifo_write_n_const_addr(xfer->ff, (const void *) rx_fifo, to_recv_size); } else { @@ -583,7 +573,7 @@ static void transmit_packet(xfer_ctl_t *xfer, volatile usb_in_endpoint_t *in_ep, if (xfer->ff) { - tu_fifo_read_n(xfer->ff, (void *) tx_fifo, to_xfer_size); + tu_fifo_read_n_const_addr(xfer->ff, (void *) tx_fifo, to_xfer_size); } else { diff --git a/src/portable/microchip/samg/dcd_samg.c b/src/portable/microchip/samg/dcd_samg.c index 5866e1ce..07ab9e83 100644 --- a/src/portable/microchip/samg/dcd_samg.c +++ b/src/portable/microchip/samg/dcd_samg.c @@ -312,14 +312,11 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 if (dir == TUSB_DIR_OUT) { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_CST); - // Enable interrupt when starting OUT transfer if (epnum != 0) UDP->UDP_IER |= (1 << epnum); } else { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_CST); tu_fifo_read_n(ff, (void *) &UDP->UDP_FDR[epnum], xfer_packet_len(xfer)); // TX ready for transfer @@ -440,7 +437,7 @@ void dcd_int_handler(uint8_t rhport) // write to EP fifo if (xfer->ff) { - tu_fifo_read_n(xfer->ff, (void *) &UDP->UDP_FDR[epnum], xact_len); + tu_fifo_read_n_const_addr(xfer->ff, (void *) &UDP->UDP_FDR[epnum], xact_len); } else { @@ -473,7 +470,7 @@ void dcd_int_handler(uint8_t rhport) // Read from EP fifo if (xfer->ff) { - tu_fifo_write_n(xfer->ff, (const void *) &UDP->UDP_FDR[epnum], xact_len); + tu_fifo_write_n_const_addr(xfer->ff, (const void *) &UDP->UDP_FDR[epnum], xact_len); } else { diff --git a/src/portable/nuvoton/nuc120/dcd_nuc120.c b/src/portable/nuvoton/nuc120/dcd_nuc120.c index 0e7157d4..06ffa296 100644 --- a/src/portable/nuvoton/nuc120/dcd_nuc120.c +++ b/src/portable/nuvoton/nuc120/dcd_nuc120.c @@ -314,12 +314,10 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 if (TUSB_DIR_IN == dir) { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_INC); // For the PHY in nuc120 the source and destination pointer have to be incremented! dcd_in_xfer(xfer, ep); } else { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_INC); // For the PHY in nuc120 the source and destination pointer have to be incremented! xfer->out_bytes_so_far = 0; ep->MXPLD = xfer->max_packet_size; } diff --git a/src/portable/nuvoton/nuc121/dcd_nuc121.c b/src/portable/nuvoton/nuc121/dcd_nuc121.c index 65a41463..6d98ba08 100644 --- a/src/portable/nuvoton/nuc121/dcd_nuc121.c +++ b/src/portable/nuvoton/nuc121/dcd_nuc121.c @@ -320,12 +320,10 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 if (TUSB_DIR_IN == dir) { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_INC); // For the PHY in nuc120 the source and destination pointer have to be incremented! dcd_in_xfer(xfer, ep); } else { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_INC); // For the PHY in nuc120 the source and destination pointer have to be incremented! xfer->out_bytes_so_far = 0; ep->MXPLD = xfer->max_packet_size; } diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c index 0d82a28c..5d15ca96 100644 --- a/src/portable/nuvoton/nuc505/dcd_nuc505.c +++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c @@ -183,7 +183,7 @@ static void dcd_userEP_in_xfer(struct xfer_ctl_t *xfer, USBD_EP_T *ep) /* provided buffers are thankfully 32-bit aligned, allowing most data to be transfered as 32-bit */ if (xfer->ff) { - tu_fifo_read_n(xfer->ff, (void *) (&ep->EPDAT_BYTE), bytes_now); + tu_fifo_read_n_const_addr(xfer->ff, (void *) (&ep->EPDAT_BYTE), bytes_now); } else { @@ -431,12 +431,10 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 if (TUSB_DIR_IN == dir) { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_CST); // For the PHY in nuc505 the source and destination pointer have to be constant! ep->EPINTEN = USBD_EPINTEN_BUFEMPTYIEN_Msk; } else { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_CST); // For the PHY in nuc505 the source and destination pointer have to be constant! xfer->out_bytes_so_far = 0; ep->EPINTEN = USBD_EPINTEN_RXPKIEN_Msk; } @@ -659,7 +657,7 @@ void dcd_int_handler(uint8_t rhport) /* copy the data from the PC to the previously provided buffer */ if (xfer->ff) { - tu_fifo_write_n(xfer->ff, (const void *) &ep->EPDAT_BYTE, tu_min16(available_bytes, xfer->total_bytes - xfer->out_bytes_so_far)); + tu_fifo_write_n_const_addr(xfer->ff, (const void *) &ep->EPDAT_BYTE, tu_min16(available_bytes, xfer->total_bytes - xfer->out_bytes_so_far)); } else { diff --git a/src/portable/template/dcd_template.c b/src/portable/template/dcd_template.c index ba656385..d8c8753d 100644 --- a/src/portable/template/dcd_template.c +++ b/src/portable/template/dcd_template.c @@ -105,7 +105,7 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t return false; } -// Submit a transfer where is managed by FIFO, When complete dcd_event_xfer_complete() is invoked to notify the stack +// Submit a transfer where is managed by FIFO, When complete dcd_event_xfer_complete() is invoked to notify the stack - optional, however, must be listed in usbd.c bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) { (void) rhport; diff --git a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c index a8da1ae4..40b12eb0 100644 --- a/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c +++ b/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c @@ -365,12 +365,10 @@ bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16 if(dir == TUSB_DIR_OUT) { - tu_fifo_set_copy_mode_read(ff, TU_FIFO_COPY_INC); // For the PHY in msp430 the source and destination pointer have to be incremented! ep_regs[BCTX] &= ~NAK; } else { - tu_fifo_set_copy_mode_write(ff, TU_FIFO_COPY_INC); // For the PHY in msp430 the source and destination pointer have to be incremented! USBIEPIFG |= (1 << epnum); }