diff --git a/CHANGES b/CHANGES index f74d7ce0c..c67f7d85b 100644 --- a/CHANGES +++ b/CHANGES @@ -62,6 +62,7 @@ Misc: - Perf: Ability to load savestates immediately on launch - Qt: Replace pause-after-frame mutex with an atomic - Util: Allow disabling the threading code entirely + - GBA: SIO logging layer 0.2.1: (2015-05-13) Bugfixes: diff --git a/src/gba/gba.h b/src/gba/gba.h index 92fedfa91..0926470c5 100644 --- a/src/gba/gba.h +++ b/src/gba/gba.h @@ -46,8 +46,9 @@ enum GBALogLevel { GBA_LOG_GAME_ERROR = 0x100, GBA_LOG_SWI = 0x200, GBA_LOG_STATUS = 0x400, + GBA_LOG_SIO = 0x800, - GBA_LOG_ALL = 0x73F, + GBA_LOG_ALL = 0xF3F, #ifdef NDEBUG GBA_LOG_DANGER = GBA_LOG_ERROR diff --git a/src/gba/sio/lockstep.c b/src/gba/sio/lockstep.c index 842db4571..d8efe3390 100644 --- a/src/gba/sio/lockstep.c +++ b/src/gba/sio/lockstep.c @@ -82,6 +82,7 @@ bool GBASIOLockstepNodeInit(struct GBASIODriver* driver) { struct GBASIOLockstepNode* node = (struct GBASIOLockstepNode*) driver; node->nextEvent = LOCKSTEP_INCREMENT; node->d.p->multiplayerControl.slave = node->id > 0; + GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: Node init", node->id); return true; } @@ -115,9 +116,11 @@ bool GBASIOLockstepNodeUnload(struct GBASIODriver* driver) { static uint16_t GBASIOLockstepNodeWriteRegister(struct GBASIODriver* driver, uint32_t address, uint16_t value) { struct GBASIOLockstepNode* node = (struct GBASIOLockstepNode*) driver; if (address == REG_SIOCNT) { + GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: SIOCNT <- %04x", node->id, value); if (value & 0x0080) { value &= ~0x0080; if (!node->id) { + GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: Transfer initiated", node->id); MutexLock(&node->p->mutex); node->p->transferActive = true; node->p->transferCycles = GBASIOCyclesPerTransfer[node->d.p->multiplayerControl.baud][node->p->attached - 1]; @@ -126,6 +129,8 @@ static uint16_t GBASIOLockstepNodeWriteRegister(struct GBASIODriver* driver, uin } value &= 0xFF03; value |= driver->p->siocnt & 0x007C; + } else if (address == REG_SIOMLT_SEND) { + GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: SIOMLT_SEND <- %04x", node->id, value); } return value; } @@ -162,6 +167,7 @@ static int32_t GBASIOLockstepNodeProcessEvents(struct GBASIODriver* driver, int3 ConditionWake(&node->p->barrier); } if (node->state == LOCKSTEP_FINISHED) { + GBALog(node->d.p->p, GBA_LOG_SIO, "Lockstep %i: Finishing transfer: %04x %04x %04x %04x", node->id, node->p->multiRecv[0], node->p->multiRecv[1], node->p->multiRecv[2], node->p->multiRecv[3]); node->d.p->p->memory.io[REG_SIOMULTI0 >> 1] = node->p->multiRecv[0]; node->d.p->p->memory.io[REG_SIOMULTI1 >> 1] = node->p->multiRecv[1]; node->d.p->p->memory.io[REG_SIOMULTI2 >> 1] = node->p->multiRecv[2]; diff --git a/src/platform/qt/LogView.cpp b/src/platform/qt/LogView.cpp index 15a299480..bd9832def 100644 --- a/src/platform/qt/LogView.cpp +++ b/src/platform/qt/LogView.cpp @@ -26,6 +26,7 @@ LogView::LogView(QWidget* parent) connect(m_ui.levelGameError, SIGNAL(toggled(bool)), this, SLOT(setLevelGameError(bool))); connect(m_ui.levelSWI, SIGNAL(toggled(bool)), this, SLOT(setLevelSWI(bool))); connect(m_ui.levelStatus, SIGNAL(toggled(bool)), this, SLOT(setLevelStatus(bool))); + connect(m_ui.levelSIO, SIGNAL(toggled(bool)), this, SLOT(setLevelSIO(bool))); connect(m_ui.clear, SIGNAL(clicked()), this, SLOT(clear())); connect(m_ui.maxLines, SIGNAL(valueChanged(int)), this, SLOT(setMaxLines(int))); m_ui.maxLines->setValue(DEFAULT_LINE_LIMIT); @@ -59,6 +60,7 @@ void LogView::setLevels(int levels) { m_ui.levelGameError->setCheckState(levels & GBA_LOG_GAME_ERROR ? Qt::Checked : Qt::Unchecked); m_ui.levelSWI->setCheckState(levels & GBA_LOG_SWI ? Qt::Checked : Qt::Unchecked); m_ui.levelStatus->setCheckState(levels & GBA_LOG_STATUS ? Qt::Checked : Qt::Unchecked); + m_ui.levelSIO->setCheckState(levels & GBA_LOG_SIO ? Qt::Checked : Qt::Unchecked); emit levelsSet(levels); } @@ -135,6 +137,14 @@ void LogView::setLevelStatus(bool set) { } } +void LogView::setLevelSIO(bool set) { + if (set) { + setLevel(GBA_LOG_SIO); + } else { + clearLevel(GBA_LOG_SIO); + } +} + void LogView::setMaxLines(int limit) { m_lineLimit = limit; while (m_lines > m_lineLimit) { @@ -162,6 +172,8 @@ QString LogView::toString(int level) { return tr("SWI"); case GBA_LOG_STATUS: return tr("STATUS"); + case GBA_LOG_SIO: + return tr("SIO"); } return QString(); } diff --git a/src/platform/qt/LogView.h b/src/platform/qt/LogView.h index 66eb18b71..28658672e 100644 --- a/src/platform/qt/LogView.h +++ b/src/platform/qt/LogView.h @@ -41,6 +41,7 @@ public slots: void setLevelGameError(bool); void setLevelSWI(bool); void setLevelStatus(bool); + void setLevelSIO(bool); void setMaxLines(int); diff --git a/src/platform/qt/LogView.ui b/src/platform/qt/LogView.ui index 020c826ad..64e2642ec 100644 --- a/src/platform/qt/LogView.ui +++ b/src/platform/qt/LogView.ui @@ -116,6 +116,13 @@ + + + + Serial I/O + + +