summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-08-29 10:14:03 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-08-29 10:14:03 -0400
commit3867f0b95958a6219ed5b459c22b246fb827efe2 (patch)
tree76d3677f5cd31108d0449603506569433543bbc7 /firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c
parent6296b220e5408feda177346a5a439ce4c6803a83 (diff)
downloadrockbox-3867f0b959.tar.gz
rockbox-3867f0b959.tar.bz2
rockbox-3867f0b959.zip
XduooX3 Sources WS changes
Change-Id: I17ae59e7ef0440756527ce50ab30f8bf34f79007
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c b/firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c
index c4d79a7567..6f317f7b3f 100644
--- a/firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/dma_acc-jz4740.c
@@ -26,14 +26,14 @@ void memset(void *target, unsigned char c, size_t len)
int ch = DMA_CHANNEL;
unsigned int d;
unsigned char *dp;
-
+
if(len < 32)
_memset(target,c,len);
else
{
if(((unsigned int)target < 0xa0000000) && len)
dma_cache_wback_inv((unsigned long)target, len);
-
+
dp = (unsigned char *)((unsigned int)(&d) | 0xa0000000);
*(dp + 0) = c;
*(dp + 1) = c;
@@ -45,16 +45,16 @@ void memset(void *target, unsigned char c, size_t len)
REG_DMAC_DRSR(ch) = DMAC_DRSR_RS_AUTO;
REG_DMAC_DCMD(ch) = DMAC_DCMD_DAI | DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | DMAC_DCMD_DS_32BYTE;
REG_DMAC_DCCSR(ch) = DMAC_DCCSR_EN | DMAC_DCCSR_NDES;
-
+
while (REG_DMAC_DTCR(ch));
if(len % 32)
{
dp = (unsigned char *)((unsigned int)target + (len & (32 - 1)));
for(d = 0;d < (len % 32); d++)
*dp++ = c;
-
+
}
- }
+ }
}
void memset16(void *target, unsigned short c, size_t len)
@@ -62,14 +62,14 @@ void memset16(void *target, unsigned short c, size_t len)
int ch = DMA_CHANNEL;
unsigned short d;
unsigned short *dp;
-
+
if(len < 32)
_memset16(target,c,len);
else
{
if(((unsigned int)target < 0xa0000000) && len)
dma_cache_wback_inv((unsigned long)target, len);
-
+
d = c;
REG_DMAC_DSAR(ch) = PHYSADDR((unsigned long)&d);
REG_DMAC_DTAR(ch) = PHYSADDR((unsigned long)target);
@@ -77,7 +77,7 @@ void memset16(void *target, unsigned short c, size_t len)
REG_DMAC_DRSR(ch) = DMAC_DRSR_RS_AUTO;
REG_DMAC_DCMD(ch) = DMAC_DCMD_DAI | DMAC_DCMD_SWDH_16 | DMAC_DCMD_DWDH_16 | DMAC_DCMD_DS_32BYTE;
REG_DMAC_DCCSR(ch) = DMAC_DCCSR_EN | DMAC_DCCSR_NDES;
-
+
while (REG_DMAC_DTCR(ch));
if(len % 32)
{
@@ -85,29 +85,29 @@ void memset16(void *target, unsigned short c, size_t len)
for(d = 0; d < (len % 32); d++)
*dp++ = c;
}
- }
+ }
}
void memcpy(void *target, const void *source, size_t len)
{
int ch = DMA_CHANNEL;
unsigned char *dp;
-
+
if(len < 4)
_memcpy(target, source, len);
-
+
if(((unsigned int)source < 0xa0000000) && len)
dma_cache_wback_inv((unsigned long)source, len);
-
+
if(((unsigned int)target < 0xa0000000) && len)
dma_cache_wback_inv((unsigned long)target, len);
-
+
REG_DMAC_DSAR(ch) = PHYSADDR((unsigned long)source);
- REG_DMAC_DTAR(ch) = PHYSADDR((unsigned long)target);
+ REG_DMAC_DTAR(ch) = PHYSADDR((unsigned long)target);
REG_DMAC_DTCR(ch) = len / 4;
REG_DMAC_DRSR(ch) = DMAC_DRSR_RS_AUTO;
REG_DMAC_DCMD(ch) = DMAC_DCMD_DAI | DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | DMAC_DCMD_DS_32BIT;
-
+
REG_DMAC_DCCSR(ch) = DMAC_DCCSR_EN | DMAC_DCCSR_NDES;
while (REG_DMAC_DTCR(ch));
if(len % 4)