aboutsummaryrefslogtreecommitdiff
path: root/DMA.h
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-01-18 01:33:06 +0100
committerStapleButter <thetotalworm@gmail.com>2017-01-18 01:33:06 +0100
commit9808b73c6f64ea2506a76e719cd1c2eefda43870 (patch)
tree625777555f4c15c0a137096ef1ce4032d3703c24 /DMA.h
parentb10a0d64a2161a9efaf7548f7bf9942ac829d660 (diff)
DMA support!
Diffstat (limited to 'DMA.h')
-rw-r--r--DMA.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/DMA.h b/DMA.h
new file mode 100644
index 0000000..619b163
--- /dev/null
+++ b/DMA.h
@@ -0,0 +1,56 @@
+/*
+ Copyright 2016-2017 StapleButter
+
+ This file is part of melonDS.
+
+ melonDS 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 3 of the License, or (at your option)
+ any later version.
+
+ melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with melonDS. If not, see http://www.gnu.org/licenses/.
+*/
+
+#ifndef DMA_H
+#define DMA_H
+
+#include "types.h"
+
+class DMA
+{
+public:
+ DMA(u32 cpu, u32 num);
+ ~DMA();
+
+ void Reset();
+
+ void WriteCnt(u32 val);
+ void Start();
+
+ void StartIfNeeded(u32 mode)
+ {
+ if ((mode == StartMode) && (Cnt & 0x80000000))
+ Start();
+ }
+
+ u32 SrcAddr;
+ u32 DstAddr;
+ u32 Cnt;
+
+private:
+ u32 CPU, Num;
+
+ u32 StartMode;
+ u32 CurSrcAddr;
+ u32 CurDstAddr;
+ u32 RemCount;
+ u32 SrcAddrInc;
+ u32 DstAddrInc;
+};
+
+#endif