gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > DMA on the ARM7 and ARM9

#40056 - Darkain - Thu Apr 14, 2005 8:19 pm

ARM9 DMA. Async? Guess not. :(
Code:
    int i = 0;
    dmaCopyWordsAsynch(2, DarkStar2_Map,  &BG_GFX[20480], 90112);
    dmaCopyWordsAsynch(3, DarkStar2_Map,  &BG_GFX_SUB[20480], 90112);
    while ( dmaBusy(2) & dmaBusy(3) ) { i++; }
 
    char str[32];
    itoa(i, str);
    printTitle(str);
 
outputs 0
Code:
    int i = 0;
    dmaCopyWordsAsynch(3, DarkStar2_Map,  &BG_GFX_SUB[20480], 90112);
    while (dmaBusy(3)) i++;
 
    char str[32];
    itoa(i, str);
    printTitle(str);
 
outputs 0

the first test was to check to see if the two channels would be active at the same time. i tried both a logical AND and a logical OR operation on testing, and it always returned 0. The second test is to see if the CPU was even active during a DMA transfer, which apparently it isnt, sadly :(

Next, onwards to ARM7 DMA testing!! I modified the ARM7 boot loader to use DMA isntead of copying bytes manually in code. dayum, is it much faster to boot now! :D

Code:
  dmaCopyWords(0, GETRAW(arm9_bin), (void*)0x02004000, GETRAWSIZE(arm9_bin));
  dmaCopyWords(0, GETRAW(arm7_bin), (void*)0x02380000, GETRAWSIZE(arm7_bin));
FAILS!!
 
  dmaCopyWords(1, GETRAW(arm9_bin), (void*)0x02004000, GETRAWSIZE(arm9_bin));
  dmaCopyWords(1, GETRAW(arm7_bin), (void*)0x02380000, GETRAWSIZE(arm7_bin));
FAILS!!
 
  dmaCopyWords(2, GETRAW(arm9_bin), (void*)0x02004000, GETRAWSIZE(arm9_bin));
  dmaCopyWords(2, GETRAW(arm7_bin), (void*)0x02380000, GETRAWSIZE(arm7_bin));
FAILS!!
 
  dmaCopyWords(3, GETRAW(arm9_bin), (void*)0x02004000, GETRAWSIZE(arm9_bin));
  dmaCopyWords(3, GETRAW(arm7_bin), (void*)0x02380000, GETRAWSIZE(arm7_bin));
WORKS!!

As we can see from this series of tests, it appears that the ARM7 still has DMA access restrictions much like it did on the GBA. For more info on the DMA as it was on GBA, check this out: http://www.cs.rit.edu/~tjh8300/CowBite/CowBiteSpec.htm#DMA%20Source%20Registers


After the ARM7 test, i went back and did the ARM9 test again with all 4 DMA channels. they all worked, and produced the same result. so, from what i can tell so far, there isnt the same restrictions on the ARM9 DMA transfers as there is on the ARM7.
_________________
-=- Darkain Dragoon -=-
http://www.darkain.com
DarkStar for Nintendo DS

#40094 - FeaRog - Fri Apr 15, 2005 1:55 am

Good info! Gives me a few more ideas to try with my DMAing of stuff when I get some more time to fiddle. Cheers!

#40097 - tepples - Fri Apr 15, 2005 2:35 am

Darkain wrote:
Next, onwards to ARM7 DMA testing!! I modified the ARM7 boot loader to use DMA isntead of copying bytes manually in code. dayum, is it much faster to boot now! :D

You could have got at least 80% of the the same speedup with an unrolled ldmia/stmia loop.

Quote:
As we can see from this series of tests, it appears that the ARM7 still has DMA access restrictions much like it did on the GBA. For more info on the DMA as it was on GBA, check this out: http://www.cs.rit.edu/~tjh8300/CowBite/CowBiteSpec.htm#DMA%20Source%20Registers

All that seems to show is that DMA[0] can't copy from ROM. I can't see why DMA[1] and [2] would fail to copy from ROM. Perhaps it has something to do with GBA sound being disabled in DS mode.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.