2022-03-21 04:34:59 +00:00
|
|
|
#pragma once
|
|
|
|
#include "MIPSInterfaceHandler.h"
|
2022-10-10 00:22:17 +00:00
|
|
|
#include "MemoryHandler.h"
|
2022-03-21 04:34:59 +00:00
|
|
|
#include <Project64-core\Logging.h>
|
2022-10-10 00:22:17 +00:00
|
|
|
#include <Project64-core\Settings\DebugSettings.h>
|
2022-03-21 04:34:59 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SI_STATUS_DMA_BUSY = 0x0001,
|
|
|
|
SI_STATUS_RD_BUSY = 0x0002,
|
|
|
|
SI_STATUS_DMA_ERROR = 0x0008,
|
|
|
|
SI_STATUS_INTERRUPT = 0x1000,
|
|
|
|
};
|
|
|
|
|
2022-10-16 21:57:52 +00:00
|
|
|
class PifRamHandler;
|
|
|
|
|
2022-03-21 04:34:59 +00:00
|
|
|
class SerialInterfaceReg
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
SerialInterfaceReg(uint32_t * Interface);
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint32_t & SI_DRAM_ADDR_REG;
|
|
|
|
uint32_t & SI_PIF_ADDR_RD64B_REG;
|
|
|
|
uint32_t & SI_PIF_ADDR_WR64B_REG;
|
|
|
|
uint32_t & SI_STATUS_REG;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SerialInterfaceReg();
|
2022-10-10 00:22:17 +00:00
|
|
|
SerialInterfaceReg(const SerialInterfaceReg &);
|
|
|
|
SerialInterfaceReg & operator=(const SerialInterfaceReg &);
|
2022-03-21 04:34:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CMipsMemoryVM;
|
|
|
|
class CRegisters;
|
|
|
|
|
|
|
|
class SerialInterfaceHandler :
|
|
|
|
public MemoryHandler,
|
|
|
|
public SerialInterfaceReg,
|
|
|
|
private MIPSInterfaceReg,
|
|
|
|
private CDebugSettings,
|
|
|
|
private CLogging
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SerialInterfaceHandler(CMipsMemoryVM & MMU, CRegisters & Reg);
|
|
|
|
|
|
|
|
bool Read32(uint32_t Address, uint32_t & Value);
|
|
|
|
bool Write32(uint32_t Address, uint32_t Value, uint32_t Mask);
|
|
|
|
|
|
|
|
private:
|
|
|
|
SerialInterfaceHandler();
|
|
|
|
SerialInterfaceHandler(const SerialInterfaceHandler &);
|
|
|
|
SerialInterfaceHandler & operator=(const SerialInterfaceHandler &);
|
|
|
|
|
2022-10-16 21:57:52 +00:00
|
|
|
PifRamHandler & m_PifRamHandler;
|
2022-03-21 04:34:59 +00:00
|
|
|
CMipsMemoryVM & m_MMU;
|
|
|
|
CRegisters & m_Reg;
|
|
|
|
uint32_t & m_PC;
|
|
|
|
};
|