diff --git a/include/mgba/internal/ds/ipc.h b/include/mgba/internal/ds/ipc.h index ba774a03a..87f7347ea 100644 --- a/include/mgba/internal/ds/ipc.h +++ b/include/mgba/internal/ds/ipc.h @@ -10,6 +10,10 @@ CXX_GUARD_START +#include + +mLOG_DECLARE_CATEGORY(DS_IPC); + DECL_BITFIELD(DSIPCFIFOCNT, int16_t); DECL_BIT(DSIPCFIFOCNT, SendEmpty, 0); DECL_BIT(DSIPCFIFOCNT, SendFull, 1); diff --git a/src/ds/ipc.c b/src/ds/ipc.c index c5cbcce97..a487a30ea 100644 --- a/src/ds/ipc.c +++ b/src/ds/ipc.c @@ -8,11 +8,13 @@ #include #include +mLOG_DEFINE_CATEGORY(DS_IPC, "DS IPC"); + void DSIPCWriteSYNC(struct ARMCore* remoteCpu, uint16_t* remoteIo, int16_t value) { remoteIo[DS_REG_IPCSYNC >> 1] &= 0xFFF0; remoteIo[DS_REG_IPCSYNC >> 1] |= (value >> 8) & 0x0F; if (value & 0x2000 && remoteIo[DS_REG_IPCSYNC >> 1] & 0x4000) { - mLOG(DS_IO, STUB, "Unimplemented IPC IRQ"); + mLOG(DS_IPC, STUB, "Unimplemented IRQ"); UNUSED(remoteCpu); } } @@ -38,6 +40,7 @@ void DSIPCWriteFIFO(struct DSCommon* dscore, int32_t value) { if (!DSIPCFIFOCNTIsEnable(dscore->memory.io[DS_REG_IPCFIFOCNT >> 1])) { return; } + mLOG(DS_IPC, DEBUG, "Written from ARM%c: %08X", (dscore == &dscore->p->ds7) ? '7' : '9', value); CircleBufferWrite32(&dscore->ipc->fifo, value); size_t fullness = CircleBufferSize(&dscore->ipc->fifo); if (fullness == 4) { @@ -59,6 +62,7 @@ int32_t DSIPCReadFIFO(struct DSCommon* dscore) { } int32_t value = ((int32_t*) dscore->ipc->memory.io)[DS_REG_IPCFIFOSEND_LO >> 2]; // TODO: actual last value CircleBufferRead32(&dscore->fifo, &value); + mLOG(DS_IPC, DEBUG, "Read from ARM%c: %08X", (dscore == &dscore->p->ds7) ? '7' : '9', value); size_t fullness = CircleBufferSize(&dscore->fifo); dscore->memory.io[DS_REG_IPCFIFOCNT >> 1] = DSIPCFIFOCNTClearRecvFull(dscore->memory.io[DS_REG_IPCFIFOCNT >> 1]); dscore->ipc->memory.io[DS_REG_IPCFIFOCNT >> 1] = DSIPCFIFOCNTClearSendFull(dscore->ipc->memory.io[DS_REG_IPCFIFOCNT >> 1]);