summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-10-26 12:53:29 +0700
committerhathach <[email protected]>2021-10-26 12:53:29 +0700
commit34844c90610763a91c421bc889ffe4a9d988e14a (patch)
treeaee0a1815bbdb7cd9a94277bc3aa21fc27342c0d /src
parent5e1a0318004d95c6663e494ade76a0581594391e (diff)
use dwc2->fifo[]
Diffstat (limited to 'src')
-rw-r--r--src/portable/synopsys/dwc2/dcd_dwc2.c14
-rw-r--r--src/portable/synopsys/dwc2/dwc2_type.h1
2 files changed, 9 insertions, 6 deletions
diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c
index 718773a00..1909f45fd 100644
--- a/src/portable/synopsys/dwc2/dcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/dcd_dwc2.c
@@ -53,7 +53,6 @@
#define DWC2_REG(_port) ((dwc2_regs_t*) DWC2_REG_BASE)
#define EPIN_REG(_port) (DWC2_REG(_port)->epin)
#define EPOUT_REG(_port) (DWC2_REG(_port)->epout)
-#define FIFO_BASE(_port, _x) ((volatile uint32_t*) (DWC2_REG_BASE + DWC2_FIFO_BASE + (_x) * DWC2_FIFO_SIZE))
enum
{
@@ -758,7 +757,8 @@ static void read_fifo_packet(uint8_t rhport, uint8_t * dst, uint16_t len)
{
(void) rhport;
- volatile uint32_t * rx_fifo = FIFO_BASE(rhport, 0);
+ dwc2_regs_t * dwc2 = DWC2_REG(rhport);
+ volatile uint32_t * rx_fifo = dwc2->fifo[0];
// Reading full available 32 bit words from fifo
uint16_t full_words = len >> 2;
@@ -794,7 +794,8 @@ static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t * src, u
{
(void) rhport;
- volatile uint32_t * tx_fifo = FIFO_BASE(rhport, fifo_num);
+ dwc2_regs_t * dwc2 = DWC2_REG(rhport);
+ volatile uint32_t * tx_fifo = dwc2->fifo[fifo_num];
// Pushing full available 32 bit words to fifo
uint16_t full_words = len >> 2;
@@ -822,9 +823,10 @@ static void write_fifo_packet(uint8_t rhport, uint8_t fifo_num, uint8_t * src, u
}
}
-static void handle_rxflvl_ints(uint8_t rhport, dwc2_epout_t * out_ep) {
+static void handle_rxflvl_ints(uint8_t rhport, dwc2_epout_t * out_ep)
+{
dwc2_regs_t * dwc2 = DWC2_REG(rhport);
- volatile uint32_t * rx_fifo = FIFO_BASE(rhport, 0);
+ volatile uint32_t * rx_fifo = dwc2->fifo[0];
// Pop control word off FIFO
uint32_t ctl_word = dwc2->grxstsp;
@@ -972,7 +974,7 @@ static void handle_epin_ints(uint8_t rhport, dwc2_regs_t * dwc2, dwc2_epin_t * i
// Push packet to Tx-FIFO
if (xfer->ff)
{
- volatile uint32_t * tx_fifo = FIFO_BASE(rhport, n);
+ volatile uint32_t * tx_fifo = dwc2->fifo[n];
tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *)(uintptr_t) tx_fifo, packet_size);
}
else
diff --git a/src/portable/synopsys/dwc2/dwc2_type.h b/src/portable/synopsys/dwc2/dwc2_type.h
index 95d043b86..5669aa88d 100644
--- a/src/portable/synopsys/dwc2/dwc2_type.h
+++ b/src/portable/synopsys/dwc2/dwc2_type.h
@@ -164,6 +164,7 @@ union {
uint32_t reservede08[126]; // E08..FFF
//------------- FIFOs -------------//
+ // Word-accessed only using first pointer since it auto shift
volatile uint32_t fifo[16][0x400]; // 1000..FFFF Endpoint FIFO
} dwc2_regs_t;