From f6065d3ab401bd3c3fb3af0da20b01a973009a95 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 20 Feb 2017 13:28:41 -0800 Subject: [PATCH] DS SPI: Stub out SPI --- include/mgba/internal/ds/io.h | 20 +++----------------- src/ds/io.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/mgba/internal/ds/io.h b/include/mgba/internal/ds/io.h index ab5882c21..3bba5792a 100644 --- a/include/mgba/internal/ds/io.h +++ b/include/mgba/internal/ds/io.h @@ -104,23 +104,9 @@ enum DS7IORegisters { DS7_REG_EXTKEYIN = 0x136, DS7_REG_RTC = 0x138, - // Game card - DS7_REG_AUXSPICNT = 0x1A0, - DS7_REG_AUXSPIDATA = 0x1A2, - DS7_REG_SLOT1CNT_LO = 0x1A4, - DS7_REG_SLOT1CNT_HI = 0x1A6, - DS7_REG_SLOT1CMD_0 = 0x1A8, - DS7_REG_SLOT1CMD_1 = 0x1A9, - DS7_REG_SLOT1CMD_2 = 0x1AA, - DS7_REG_SLOT1CMD_3 = 0x1AB, - DS7_REG_SLOT1CMD_4 = 0x1AC, - DS7_REG_SLOT1CMD_5 = 0x1AD, - DS7_REG_SLOT1CMD_6 = 0x1AE, - DS7_REG_SLOT1CMD_7 = 0x1AF, - DS7_REG_SLOT1DATA_0 = 0x100010, - DS7_REG_SLOT1DATA_1 = 0x100011, - DS7_REG_SLOT1DATA_2 = 0x100012, - DS7_REG_SLOT1DATA_3 = 0x100013, + // SPI + DS7_REG_SPICNT = 0x1C0, + DS7_REG_SPIDATA = 0x1C2, // Etc DS7_REG_EXMEMSTAT = 0x204, diff --git a/src/ds/io.c b/src/ds/io.c index 6a29e62ca..414f9f5a7 100644 --- a/src/ds/io.c +++ b/src/ds/io.c @@ -8,6 +8,7 @@ #include #include #include +#include mLOG_DEFINE_CATEGORY(DS_IO, "DS I/O"); @@ -168,6 +169,13 @@ void DS7IOInit(struct DS* ds) { void DS7IOWrite(struct DS* ds, uint32_t address, uint16_t value) { switch (address) { + case DS7_REG_SPICNT: + value &= 0xCF83; + value = DSSPIWriteControl(ds, value); + break; + case DS7_REG_SPIDATA: + DSSPIWrite(ds, value); + return; default: { uint32_t v2 = DSIOWrite(&ds->ds7, address, value); @@ -280,6 +288,8 @@ uint16_t DS7IORead(struct DS* ds, uint32_t address) { case DS_REG_TM1CNT_HI: case DS_REG_TM2CNT_HI: case DS_REG_TM3CNT_HI: + case DS7_REG_SPICNT: + case DS7_REG_SPIDATA: case DS_REG_IPCSYNC: case DS_REG_IPCFIFOCNT: case DS_REG_IME: