all repos — mgba @ a816bd960b4cb4fcdf0a8811bccd036ae59a6b88

mGBA Game Boy Advance Emulator

GBA: SIO logging layer
Jeffrey Pfau jeffrey@endrift.com
Mon, 08 Jun 2015 22:30:28 -0700
commit

a816bd960b4cb4fcdf0a8811bccd036ae59a6b88

parent

ce647c8613f53d30a8cece2f380def41fc041ffa

M CHANGESCHANGES

@@ -62,6 +62,7 @@ - Qt: Only hide cursor in full screen

- 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:
M src/gba/gba.hsrc/gba/gba.h

@@ -46,8 +46,9 @@

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
M src/gba/sio/lockstep.csrc/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 @@

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 @@ }

} 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 @@ node->p->waiting = 0;

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];
M src/platform/qt/LogView.cppsrc/platform/qt/LogView.cpp

@@ -26,6 +26,7 @@ connect(m_ui.levelFatal, SIGNAL(toggled(bool)), this, SLOT(setLevelFatal(bool)));

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 @@ m_ui.levelFatal->setCheckState(levels & GBA_LOG_FATAL ? Qt::Checked : Qt::Unchecked);

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 @@ clearLevel(GBA_LOG_STATUS);

} } +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 @@ case GBA_LOG_SWI:

return tr("SWI"); case GBA_LOG_STATUS: return tr("STATUS"); + case GBA_LOG_SIO: + return tr("SIO"); } return QString(); }
M src/platform/qt/LogView.hsrc/platform/qt/LogView.h

@@ -41,6 +41,7 @@ void setLevelFatal(bool);

void setLevelGameError(bool); void setLevelSWI(bool); void setLevelStatus(bool); + void setLevelSIO(bool); void setMaxLines(int);
M src/platform/qt/LogView.uisrc/platform/qt/LogView.ui

@@ -116,6 +116,13 @@ <bool>true</bool>

</property> </widget> </item> + <item> + <widget class="QCheckBox" name="levelSIO"> + <property name="text"> + <string>Serial I/O</string> + </property> + </widget> + </item> </layout> </widget> </item>