diff options
author | Nebuleon Fumika | 2013-02-08 05:50:22 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-02-08 05:50:22 -0500 |
commit | 927d456306672110870eb3386742c1c1ef8eb4f6 (patch) | |
tree | 509da9ac1727570b02572068aefb9cdf102ad75b /sdk-modifications/libsrc/core/ds2_dma.c | |
parent | 433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1 (diff) | |
parent | d4fcf2697c9a45594e3ee0b8bf82e480ddd0b69b (diff) | |
download | snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.gz snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.tar.bz2 snes9x2005-927d456306672110870eb3386742c1c1ef8eb4f6.zip |
Merge branch 'master' into 8bitsound
Conflicts:
source/nds/entry.cpp
Diffstat (limited to 'sdk-modifications/libsrc/core/ds2_dma.c')
-rw-r--r-- | sdk-modifications/libsrc/core/ds2_dma.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sdk-modifications/libsrc/core/ds2_dma.c b/sdk-modifications/libsrc/core/ds2_dma.c new file mode 100644 index 0000000..0b0eca1 --- /dev/null +++ b/sdk-modifications/libsrc/core/ds2_dma.c @@ -0,0 +1,34 @@ +#include "ds2_dma.h" + + + +//register a DMA transfer request +//ch: channel id request, there are 6 channles, +//irq_handler: the DMA interruption handle +//arg: argument to the handle +//mode: DMA mode, such as port width, address increased/fixed, and so on +//type: DMA request type +extern int dma_request(int ch, void (*irq_handler)(unsigned int), unsigned int arg, + unsigned int mode, unsigned int type); + +//start DMA transfer, must request a DMA first +//ch: channel id +//srcAddr: DMA source address +//dstAddr: DMA destination address +//count: DMA transfer count, the total bytes due the mode in dma_request +extern void dma_start(int ch, unsigned int srcAddr, unsigned int dstAddr, + unsigned int count); + + +int _dmaCopy(int ch, void *dest, void *src, unsigned int size, unsigned int flags){ + int test = 0; + if(!(test = dma_request(ch, 0, 0, + //increment dest addr + DMAC_DCMD_DAI | flags, + //auto request type + DMAC_DRSR_RS_AUTO))) + { + dma_start(ch, (unsigned int)src, (unsigned int)dest, size); + } + return test; +} |