mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 06:39:33 +00:00
Even more refactoring
This commit is contained in:
parent
a45f21e422
commit
74f1ed4c4b
1 changed files with 93 additions and 84 deletions
|
@ -159,6 +159,8 @@ public:
|
|||
private:
|
||||
void Start();
|
||||
void Stop();
|
||||
void SCLRisingEdge(const bool sda);
|
||||
void SCLFallingEdge(const bool sda);
|
||||
bool WriteExpected() const;
|
||||
};
|
||||
I2CBus i2c_state;
|
||||
|
@ -414,6 +416,17 @@ void I2CBus::Update(Core::System& system, const bool old_scl, const bool new_scl
|
|||
else if (active)
|
||||
{
|
||||
if (!old_scl && new_scl)
|
||||
{
|
||||
SCLRisingEdge(new_sda);
|
||||
}
|
||||
else if (old_scl && !new_scl)
|
||||
{
|
||||
SCLFallingEdge(new_sda);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void I2CBus::SCLRisingEdge(const bool sda)
|
||||
{
|
||||
// INFO_LOG_FMT(WII_IPC, "AVE: {} rising edge: {} (write expected: {})", bit_counter, new_sda,
|
||||
// WriteExpected());
|
||||
|
@ -435,13 +448,12 @@ void I2CBus::Update(Core::System& system, const bool old_scl, const bool new_scl
|
|||
acknowledge = false;
|
||||
}
|
||||
}
|
||||
// Dolphin_Debugger::PrintCallstack(Common::Log::LogType::WII_IPC,
|
||||
// Common::Log::LogLevel::LINFO);
|
||||
// Dolphin_Debugger::PrintCallstack(Common::Log::LogType::WII_IPC, Common::Log::LogLevel::LINFO);
|
||||
}
|
||||
else if (old_scl && !new_scl)
|
||||
|
||||
void I2CBus::SCLFallingEdge(const bool sda)
|
||||
{
|
||||
// INFO_LOG_FMT(WII_IPC, "AVE: {} falling edge: {} (write expected: {})", bit_counter,
|
||||
// new_sda,
|
||||
// INFO_LOG_FMT(WII_IPC, "AVE: {} falling edge: {} (write expected: {})", bit_counter, new_sda,
|
||||
// WriteExpected());
|
||||
// SCL falling edge is used to advance bit_counter and process wri'tes.
|
||||
if (bit_counter != 9 && WriteExpected())
|
||||
|
@ -449,13 +461,13 @@ void I2CBus::Update(Core::System& system, const bool old_scl, const bool new_scl
|
|||
if (bit_counter == 8)
|
||||
{
|
||||
// Acknowledge bit for *reads*.
|
||||
if (new_sda)
|
||||
if (sda)
|
||||
WARN_LOG_FMT(WII_IPC, "Read NACK'd");
|
||||
}
|
||||
else
|
||||
{
|
||||
current_byte <<= 1;
|
||||
if (new_sda)
|
||||
if (sda)
|
||||
current_byte |= 1;
|
||||
|
||||
if (bit_counter == 7)
|
||||
|
@ -509,10 +521,7 @@ void I2CBus::Update(Core::System& system, const bool old_scl, const bool new_scl
|
|||
{
|
||||
bit_counter++;
|
||||
}
|
||||
// Dolphin_Debugger::PrintCallstack(Common::Log::LogType::WII_IPC,
|
||||
// Common::Log::LogLevel::LINFO);
|
||||
}
|
||||
}
|
||||
// Dolphin_Debugger::PrintCallstack(Common::Log::LogType::WII_IPC, Common::Log::LogLevel::LINFO);
|
||||
}
|
||||
|
||||
void WiiIPC::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue