include/mgba/internal/ds/dma.h (view raw)
1/* Copyright (c) 2013-2017 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef DS_DMA_H
7#define DS_DMA_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/internal/gba/dma.h>
14
15enum DSDMATiming {
16 DS_DMA_TIMING_NOW = 0,
17 DS_DMA_TIMING_VBLANK = 1,
18 DS_DMA_TIMING_HBLANK = 2,
19 DS7_DMA_TIMING_SLOT1 = 2,
20 DS_DMA_TIMING_DISPLAY_START = 3,
21 DS7_DMA_TIMING_CUSTOM = 3,
22 DS_DMA_TIMING_MEMORY_DISPLAY = 4,
23 DS9_DMA_TIMING_SLOT1 = 5,
24 DS_DMA_TIMING_SLOT2 = 6,
25 DS_DMA_TIMING_GEOM_FIFO = 7,
26};
27
28DECL_BITS(GBADMARegister, Timing9, 11, 3);
29
30struct DS;
31struct DSCommon;
32void DSDMAInit(struct DS* ds);
33void DSDMAReset(struct DSCommon* dscore);
34
35uint32_t DSDMAWriteSAD(struct DSCommon* dscore, int dma, uint32_t address);
36uint32_t DSDMAWriteDAD(struct DSCommon* dscore, int dma, uint32_t address);
37void DS7DMAWriteCNT(struct DSCommon* dscore, int dma, uint32_t value);
38void DS9DMAWriteCNT(struct DSCommon* dscore, int dma, uint32_t value);
39
40struct DSDMA;
41void DSDMASchedule(struct DSCommon* dscore, int number, struct GBADMA* info);
42void DSDMAUpdate(struct DSCommon* dscore);
43
44CXX_GUARD_END
45
46#endif