summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-03-02 21:52:42 +0100
committerReinhard Panhuber <[email protected]>2021-03-02 21:52:42 +0100
commita1b07ae14c7133a012c48346923304e5d4062ecd (patch)
treeaae8ae3f791e8ed1c1c53c04e311eb2333a4b601 /src
parent3cdb82c21c7425c8fb6ba88b2a85a6238edb777a (diff)
Change copy modes for new read/write functions in tusb_fifo.c
Diffstat (limited to 'src')
-rw-r--r--src/portable/espressif/esp32s2/dcd_esp32s2.c14
-rw-r--r--src/portable/microchip/samg/dcd_samg.c7
-rw-r--r--src/portable/nuvoton/nuc120/dcd_nuc120.c2
-rw-r--r--src/portable/nuvoton/nuc121/dcd_nuc121.c2
-rw-r--r--src/portable/nuvoton/nuc505/dcd_nuc505.c6
-rw-r--r--src/portable/template/dcd_template.c2
-rw-r--r--src/portable/ti/msp430x5xx/dcd_msp430x5xx.c2
7 files changed, 7 insertions, 28 deletions
diff --git a/src/portable/espressif/esp32s2/dcd_esp32s2.c b/src/portable/espressif/esp32s2/dcd_esp32s2.c
index ade79f107..eb2c05153 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 5866e1ce8..07ab9e83f 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 0e7157d4c..06ffa2965 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 65a41463c..6d98ba08a 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 0d82a28c0..5d15ca962 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 ba656385b..d8c8753d3 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 a8da1ae49..40b12eb04 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);
}