-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
word-wise dma copy #175
base: master
Are you sure you want to change the base?
word-wise dma copy #175
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,10 +126,17 @@ static void dma_pi_write(struct pi_controller* pi) | |
dram = (uint8_t*)pi->ri->rdram.dram; | ||
rom = pi->cart_rom.rom; | ||
|
||
for(i = 0; i < longueur; ++i) | ||
{ | ||
dram[(dram_address+i)^S8] = rom[(rom_address+i)^S8]; | ||
} | ||
if (((dram_address | rom_address | longueur) & 3) != 0) | ||
{ | ||
for(i = 0; i < longueur; ++i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can I suggest to add a tab in from of the for loop to keep code readable? |
||
{ | ||
dram[(dram_address+i)^S8] = rom[(rom_address+i)^S8]; | ||
} | ||
} | ||
else | ||
{ | ||
MEMCPY4(&dram[dram_address], &rom[rom_address], longueur); | ||
} | ||
|
||
invalidate_r4300_cached_code(0x80000000 + dram_address, longueur); | ||
invalidate_r4300_cached_code(0xa0000000 + dram_address, longueur); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,14 +47,25 @@ static void dma_sp_write(struct rsp_core* sp) | |
unsigned char *spmem = (unsigned char*)sp->mem + (sp->regs[SP_MEM_ADDR_REG] & 0x1000); | ||
unsigned char *dram = (unsigned char*)sp->ri->rdram.dram; | ||
|
||
for(j=0; j<count; j++) { | ||
for(i=0; i<length; i++) { | ||
spmem[memaddr^S8] = dram[dramaddr^S8]; | ||
memaddr++; | ||
dramaddr++; | ||
} | ||
dramaddr+=skip; | ||
} | ||
if (((memaddr | dramaddr | length | skip) & 3) != 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
for(j=0; j<count; j++) { | ||
for(i=0; i<length; i++) { | ||
spmem[memaddr^S8] = dram[dramaddr^S8]; | ||
memaddr++; | ||
dramaddr++; | ||
} | ||
dramaddr+=skip; | ||
} | ||
} | ||
else | ||
{ | ||
for(j=0; j<count; j++) { | ||
MEMCPY4(&spmem[memaddr], &dram[dramaddr], length); | ||
memaddr += length; | ||
dramaddr += skip + length; | ||
} | ||
} | ||
} | ||
|
||
static void dma_sp_read(struct rsp_core* sp) | ||
|
@@ -73,14 +84,25 @@ static void dma_sp_read(struct rsp_core* sp) | |
unsigned char *spmem = (unsigned char*)sp->mem + (sp->regs[SP_MEM_ADDR_REG] & 0x1000); | ||
unsigned char *dram = (unsigned char*)sp->ri->rdram.dram; | ||
|
||
for(j=0; j<count; j++) { | ||
for(i=0; i<length; i++) { | ||
dram[dramaddr^S8] = spmem[memaddr^S8]; | ||
memaddr++; | ||
dramaddr++; | ||
} | ||
dramaddr+=skip; | ||
} | ||
if (((dramaddr | memaddr | skip | length) & 3) != 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
for(j=0; j<count; j++) { | ||
for(i=0; i<length; i++) { | ||
dram[dramaddr^S8] = spmem[memaddr^S8]; | ||
memaddr++; | ||
dramaddr++; | ||
} | ||
dramaddr+=skip; | ||
} | ||
} | ||
else | ||
{ | ||
for(j=0; j<count; j++) { | ||
MEMCPY4(&dram[dramaddr], &spmem[memaddr], length); | ||
memaddr += length; | ||
dramaddr += length + skip; | ||
} | ||
} | ||
} | ||
|
||
static void update_sp_status(struct rsp_core* sp, uint32_t w) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest a tiny comment after the if statement
non aligned word
(or maybe it's obvious).