aboutsummaryrefslogtreecommitdiff
path: root/sdk-modifications/libsrc/dma/ds2_dma.h
diff options
context:
space:
mode:
authorNebuleon Fumika2013-02-03 05:59:48 -0500
committerNebuleon Fumika2013-02-03 05:59:48 -0500
commit461f2406555faaee7191871390192d06625f5a81 (patch)
treeedbbc706e1b565855c2ae37289a622429b454988 /sdk-modifications/libsrc/dma/ds2_dma.h
parentfd92545013ed91d2867e1e180a9b86611eb19f9c (diff)
downloadsnesemu-461f2406555faaee7191871390192d06625f5a81.tar.gz
snesemu-461f2406555faaee7191871390192d06625f5a81.tar.bz2
snesemu-461f2406555faaee7191871390192d06625f5a81.zip
Fix a name clash between Snes9x's dma.h and the DS2 dma.h by renaming the DS2 dma.h to ds2_dma.h.
Add preliminary support for drawing emulated screens with DS2 DMA.
Diffstat (limited to 'sdk-modifications/libsrc/dma/ds2_dma.h')
-rw-r--r--sdk-modifications/libsrc/dma/ds2_dma.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/sdk-modifications/libsrc/dma/ds2_dma.h b/sdk-modifications/libsrc/dma/ds2_dma.h
new file mode 100644
index 0000000..491df0e
--- /dev/null
+++ b/sdk-modifications/libsrc/dma/ds2_dma.h
@@ -0,0 +1,54 @@
+#ifndef __DMA_H__
+#define __DMA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//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);
+
+//Stop DMA transfer
+extern void dma_stop(int ch);
+
+//Wait DMA transfer over
+extern int dma_wait_finish(int ch);
+
+
+/*
+ * Copy 'size' bytes from src to dest, in blocks of 32 bytes.
+ * size is in bytes and must be a multiple of 32.
+ * Both src and dest must be aligned to 32 bytes.
+ * Returns 0 on failure, non-zero on success.
+ */
+extern int dma_copy32Byte(int ch, void *dest, void *src, unsigned int size);
+// Blocks of 16 bytes, aligned to 16 bytes
+extern int dma_copy16Byte(int ch, void *dest, void *src, unsigned int size);
+// Blocks of 4 bytes, aligned to 4 bytes
+extern int dma_copy32Bit(int ch, void *dest, void *src, unsigned int size);
+// Blocks of 2 bytes, aligned to 2 bytes
+extern int dma_copy16Bit(int ch, void *dest, void *src, unsigned int size);
+extern int dma_isBusy(int ch);
+extern int dma_isFree(int ch);
+extern int dma_getFree(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__DMA_H__
+