mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-20 19:44:57 +00:00
Fix reads
This commit is contained in:
parent
c553cd5dbf
commit
0658170681
2 changed files with 15 additions and 12 deletions
|
@ -305,16 +305,7 @@ void I2CBus::SCLFallingEdge(const bool sda)
|
|||
// SCL falling edge is used to advance bit_counter/change states and process writes.
|
||||
if (state == State::SetI2CAddress || state == State::WriteToDevice)
|
||||
{
|
||||
if (bit_counter == 8)
|
||||
{
|
||||
// Acknowledge bit for *reads*.
|
||||
if (sda)
|
||||
{
|
||||
WARN_LOG_FMT(WII_IPC, "Read NACK'd");
|
||||
state = State::Inactive;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (bit_counter != 8)
|
||||
{
|
||||
current_byte <<= 1;
|
||||
if (sda)
|
||||
|
@ -337,7 +328,7 @@ void I2CBus::SCLFallingEdge(const bool sda)
|
|||
else
|
||||
{
|
||||
state = State::Inactive; // NACK
|
||||
WARN_LOG_FMT(WII_IPC, "I2C: No device responded to read from {:02x}", current_byte);
|
||||
WARN_LOG_FMT(WII_IPC, "I2C: No device responded to read from {:02x}", slave_addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -350,7 +341,7 @@ void I2CBus::SCLFallingEdge(const bool sda)
|
|||
else
|
||||
{
|
||||
state = State::Inactive; // NACK
|
||||
WARN_LOG_FMT(WII_IPC, "I2C: No device responded to write to {:02x}", current_byte);
|
||||
WARN_LOG_FMT(WII_IPC, "I2C: No device responded to write to {:02x}", slave_addr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -392,6 +383,15 @@ void I2CBus::SCLFallingEdge(const bool sda)
|
|||
state = State::ReadFromDevice;
|
||||
}
|
||||
}
|
||||
else if (state == State::ReadFromDevice)
|
||||
{
|
||||
// Acknowledge bit for *reads*.
|
||||
if (sda)
|
||||
{
|
||||
WARN_LOG_FMT(WII_IPC, "Read NACK'd");
|
||||
state = State::Inactive;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -261,8 +261,11 @@ void WiiIPC::InitState()
|
|||
|
||||
m_ppc_irq_masks |= INT_CAUSE_IPC_BROADWAY;
|
||||
|
||||
ave_state.Reset();
|
||||
i2c_state = {};
|
||||
ave_state.Reset();
|
||||
ave_state.m_registers.video_output_config = 0x23;
|
||||
i2c_state.AddSlave(&ave_state);
|
||||
}
|
||||
|
||||
void WiiIPC::Init()
|
||||
|
|
Loading…
Add table
Reference in a new issue