aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dfsound/dma.c')
-rw-r--r--plugins/dfsound/dma.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/plugins/dfsound/dma.c b/plugins/dfsound/dma.c
new file mode 100644
index 0000000..f92d066
--- /dev/null
+++ b/plugins/dfsound/dma.c
@@ -0,0 +1,97 @@
+/***************************************************************************
+ dma.c - description
+ -------------------
+ begin : Wed May 15 2002
+ copyright : (C) 2002 by Pete Bernert
+ email : BlackDove@addcom.de
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. See also the license.txt file for *
+ * additional informations. *
+ * *
+ ***************************************************************************/
+
+#include "stdafx.h"
+
+#define _IN_DMA
+
+#include "externals.h"
+
+////////////////////////////////////////////////////////////////////////
+// READ DMA (one value)
+////////////////////////////////////////////////////////////////////////
+
+unsigned short CALLBACK SPUreadDMA(void)
+{
+ unsigned short s=spuMem[spuAddr>>1];
+ spuAddr+=2;
+ if(spuAddr>0x7ffff) spuAddr=0;
+
+ iSpuAsyncWait=0;
+
+ return s;
+}
+
+////////////////////////////////////////////////////////////////////////
+// READ DMA (many values)
+////////////////////////////////////////////////////////////////////////
+
+void CALLBACK SPUreadDMAMem(unsigned short * pusPSXMem,int iSize)
+{
+ int i;
+
+ for(i=0;i<iSize;i++)
+ {
+ *pusPSXMem++=spuMem[spuAddr>>1]; // spu addr got by writeregister
+ spuAddr+=2; // inc spu addr
+ if(spuAddr>0x7ffff) spuAddr=0; // wrap
+ }
+
+ iSpuAsyncWait=0;
+}
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+// to investigate: do sound data updates by writedma affect spu
+// irqs? Will an irq be triggered, if new data is written to
+// the memory irq address?
+
+////////////////////////////////////////////////////////////////////////
+// WRITE DMA (one value)
+////////////////////////////////////////////////////////////////////////
+
+void CALLBACK SPUwriteDMA(unsigned short val)
+{
+ spuMem[spuAddr>>1] = val; // spu addr got by writeregister
+
+ spuAddr+=2; // inc spu addr
+ if(spuAddr>0x7ffff) spuAddr=0; // wrap
+
+ iSpuAsyncWait=0;
+}
+
+////////////////////////////////////////////////////////////////////////
+// WRITE DMA (many values)
+////////////////////////////////////////////////////////////////////////
+
+void CALLBACK SPUwriteDMAMem(unsigned short * pusPSXMem,int iSize)
+{
+ int i;
+
+ for(i=0;i<iSize;i++)
+ {
+ spuMem[spuAddr>>1] = *pusPSXMem++; // spu addr got by writeregister
+ spuAddr+=2; // inc spu addr
+ if(spuAddr>0x7ffff) spuAddr=0; // wrap
+ }
+
+ iSpuAsyncWait=0;
+}
+
+////////////////////////////////////////////////////////////////////////