Skip to content

Commit

Permalink
Implement EXI interrupt support
Browse files Browse the repository at this point in the history
  • Loading branch information
Zopolis4 committed Dec 17, 2021
1 parent 19df1bd commit 55241be
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,59 @@ void CEXIBaseboard::TransferByte(u8& byte)
byte = ID[(m_position - 2) & 3];
break;
}
case 0x01:
byte = 0x01;
break;
case 0x02:
byte = 0x01;
break;
case 0x03:
byte = 0x01;
break;
case 0xFF:
{
if ((m_subcommand[1] == 0) && (m_subcommand[2] == 0))
{
m_have_irq = true;
m_irq_timer = 0;
m_irq_status = 0x02;
}
if ((m_subcommand[1] == 2) && (m_subcommand[2] == 1))
{
m_irq_status = 0;
}
byte = 0x04;
break;
}
default:
ERROR_LOG_FMT(EXPANSIONINTERFACE, "EXI BASEBOARD: Unhandled command {:#x} {:#x}", m_command,
m_position);
byte = 0x04;
break;
}
}
m_position++;
}

bool CEXIBaseboard::IsInterruptSet()
{
if (m_have_irq)
{
if (++m_irq_timer > 4)
m_have_irq = false;
return 1;
}
else
{
return 0;
}
}

void CEXIBaseboard::DoState(PointerWrap& p)
{
p.Do(m_position);
p.Do(m_command);
p.Do(m_subcommand);
p.Do(m_have_irq);
}
} // namespace ExpansionInterface
5 changes: 5 additions & 0 deletions Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ class CEXIBaseboard : public IEXIDevice
CEXIBaseboard();
void SetCS(int CS) override;
bool IsPresent() const override;
bool IsInterruptSet();
void DoState(PointerWrap& p) override;

private:
// STATE_TO_SAVE
bool m_have_irq;
u32 m_position = 0;
u32 m_command = 0;
u8* m_subcommand = (u8*)&m_command;
u32 m_irq_timer;
u32 m_irq_status;

void TransferByte(u8& byte) override;
};
Expand Down

0 comments on commit 55241be

Please sign in to comment.