Added in IOP Timers hblank mode for TMR1, added CDVD S-CMD 0x15. IOP now in interruptable idle (good).

This commit is contained in:
Marco Satti 2017-07-01 17:21:43 +08:00
parent 8293ea01a1
commit ab51de1680
6 changed files with 28 additions and 16 deletions

View file

@ -60,9 +60,9 @@ IOPDmacChannel_SPU2C0_t::IOPDmacChannel_SPU2C0_t(const std::shared_ptr<FIFOQueue
IOPDmacChannel_t(CHANNEL_ID, fifoQueue)
{
MADR = std::make_shared<IOPDmacChannelRegister_MADR_t>("IOP DMAC CH_SPU2C0 MADR", false, false);
BCR = std::make_shared<IOPDmacChannelRegister_BCR_t>("IOP DMAC CH_SPU2C0 BCR", false, true);
CHCR = std::make_shared<IOPDmacChannelRegister_CHCR_t>("IOP DMAC CH_SPU2C0 CHCR", false, true);
TADR = std::make_shared<IOPDmacChannelRegister_TADR_t>("IOP DMAC CH_SPU2C0 TADR", false, true);
BCR = std::make_shared<IOPDmacChannelRegister_BCR_t>("IOP DMAC CH_SPU2C0 BCR", false, false);
CHCR = std::make_shared<IOPDmacChannelRegister_CHCR_t>("IOP DMAC CH_SPU2C0 CHCR", false, false);
TADR = std::make_shared<IOPDmacChannelRegister_TADR_t>("IOP DMAC CH_SPU2C0 TADR", false, false);
}
IOPDmacChannel_PIO_t::IOPDmacChannel_PIO_t(const std::shared_ptr<FIFOQueue_t> & fifoQueue) :
@ -85,8 +85,8 @@ IOPDmacChannel_SPU2C1_t::IOPDmacChannel_SPU2C1_t(const std::shared_ptr<FIFOQueue
IOPDmacChannel_t(CHANNEL_ID, fifoQueue)
{
MADR = std::make_shared<IOPDmacChannelRegister_MADR_t>("IOP DMAC CH_SPU2C1 MADR", false, false);
BCR = std::make_shared<IOPDmacChannelRegister_BCR_t>("IOP DMAC CH_SPU2C1 BCR", false, true);
CHCR = std::make_shared<IOPDmacChannelRegister_CHCR_t>("IOP DMAC CH_SPU2C1 CHCR", false, true);
BCR = std::make_shared<IOPDmacChannelRegister_BCR_t>("IOP DMAC CH_SPU2C1 BCR", false, false);
CHCR = std::make_shared<IOPDmacChannelRegister_CHCR_t>("IOP DMAC CH_SPU2C1 CHCR", false, false);
}
IOPDmacChannel_DEV9_t::IOPDmacChannel_DEV9_t(const std::shared_ptr<FIFOQueue_t> & fifoQueue) :

View file

@ -162,7 +162,7 @@ void IOPTimersTimerRegister_MODE_t::handleEventSourceUpdate(const Context_t cont
// Check for Prescale8 (bit 9).
if (getFieldValue(context, Fields::Prescale0) > 0)
{
throw std::runtime_error("handleEventSourceUpdate() not fully implemented.");
throw std::runtime_error("IOP Timers handleEventSourceUpdate() not fully implemented [0].");
}
else
{
@ -173,7 +173,8 @@ void IOPTimersTimerRegister_MODE_t::handleEventSourceUpdate(const Context_t cont
}
else
{
throw std::runtime_error("handleEventSourceUpdate() not fully implemented.");
mCount->setPrescale(1);
mEventSource = Event_t::Source::HBlank;
}
}
}
@ -182,7 +183,7 @@ void IOPTimersTimerRegister_MODE_t::handleEventSourceUpdate(const Context_t cont
// Check for Prescale8/16/256 (bits 13 and 14).
if (getFieldValue(context, Fields::Prescale1) > 0)
{
throw std::runtime_error("handleEventSourceUpdate() not fully implemented.");
throw std::runtime_error("IOP Timers handleEventSourceUpdate() not fully implemented [2].");
}
else
{
@ -193,7 +194,7 @@ void IOPTimersTimerRegister_MODE_t::handleEventSourceUpdate(const Context_t cont
}
else
{
throw std::runtime_error("handleEventSourceUpdate() not fully implemented.");
throw std::runtime_error("IOP Timers handleEventSourceUpdate() not fully implemented [3].");
}
}
}

View file

@ -27,7 +27,7 @@ IOPTimersTimer_TIM1_t::IOPTimersTimer_TIM1_t() :
{
COUNT = std::make_shared<IOPTimersTimerRegister_HWORD_COUNT_t>("IOP Timer1 Count", false, false);
MODE = std::make_shared<IOPTimersTimerRegister_MODE_t>("IOP Timer1 Mode", false, false, TIMER_ID, COUNT);
COMP = std::make_shared<Register32_t>("IOP Timer1 Compare", false, false);
COMP = std::make_shared<Register32_t>("IOP Timer1 Compare", false, true);
}
IOPTimersTimer_TIM2_t::IOPTimersTimer_TIM2_t() :

View file

@ -9,6 +9,13 @@
#include "Resources/CDVD/Types/CDVDNvrams_t.h"
#include "Resources/CDVD/Types/CDVDFIFOQueues_t.h"
void CDVD_s::SCMD_INSTRUCTION_15()
{
// Return magic value.
if (!mCDVD->S_DATA_OUT->writeByte(getContext(), 0x5))
throw std::runtime_error("CDVD_s: Instruction 0x15 failed, not enough space in the FIFO queue to write. Please debug");
}
void CDVD_s::SCMD_INSTRUCTION_40()
{
// Read config parameters.
@ -24,7 +31,8 @@ void CDVD_s::SCMD_INSTRUCTION_40()
mCDVD->NVRAM->setConfigAccessParams(readWrite, area, maxBlocks, 0);
// Return success.
mCDVD->S_DATA_OUT->writeByte(getContext(), 0);
if (!mCDVD->S_DATA_OUT->writeByte(getContext(), 0))
throw std::runtime_error("CDVD_s: Instruction 0x40 failed, not enough space in the FIFO queue to write. Please debug");
}
void CDVD_s::SCMD_INSTRUCTION_41()
@ -47,12 +55,14 @@ void CDVD_s::SCMD_INSTRUCTION_42()
if (!mCDVD->S_RDY_DIN->DATA_IN->read(getContext(), reinterpret_cast<u8*>(buffer), 16))
throw std::runtime_error("CDVD_s: Instruction 0x42 failed, not enough data in the FIFO queue to read. Please debug.");
mCDVD->NVRAM->writeConfigBlock(getContext(), buffer);
mCDVD->S_DATA_OUT->writeByte(getContext(), 0);
if (!mCDVD->S_DATA_OUT->writeByte(getContext(), 0))
throw std::runtime_error("CDVD_s: Instruction 0x42 failed, not enough space in the FIFO queue to write. Please debug");
}
void CDVD_s::SCMD_INSTRUCTION_43()
{
// Reset config parameters and return success.
mCDVD->NVRAM->setConfigAccessParams(0, 0, 0, 0);
mCDVD->S_DATA_OUT->writeByte(getContext(), 0);
if (!mCDVD->S_DATA_OUT->writeByte(getContext(), 0))
throw std::runtime_error("CDVD_s: Instruction 0x43 failed, not enough space in the FIFO queue to write. Please debug");
}

View file

@ -47,10 +47,10 @@ int CDVD_s::step(const Event_t & event)
void CDVD_s::NCMD_INSTRUCTION_UNKNOWN()
{
log(Debug, "CDVD N_CMD Unknown Instruction called (%d).", mCDVD->N_COMMAND->readByte(getContext()));
log(Debug, "CDVD N_CMD Unknown Instruction called (0x%02X).", mCDVD->N_COMMAND->readByte(getContext()));
}
void CDVD_s::SCMD_INSTRUCTION_UNKNOWN()
{
log(Debug, "CDVD S_CMD Unknown Instruction called (%d).", mCDVD->S_COMMAND->readByte(getContext()));
log(Debug, "CDVD S_CMD Unknown Instruction called (0x%02X).", mCDVD->S_COMMAND->readByte(getContext()));
}

View file

@ -301,6 +301,7 @@ public:
Notation: "Mnemonic" (3:1) means 3 parameter bytes in (S_DATA_IN FIFO), 1 result byte out (S_DATA_OUT).
*/
void SCMD_INSTRUCTION_UNKNOWN();
void SCMD_INSTRUCTION_15(); // "sceCdForbidDVDP" (0:1).
void SCMD_INSTRUCTION_40(); // "sceCdOpenConfig" (3:1).
void SCMD_INSTRUCTION_41(); // "sceCdReadConfig" (0:16).
void SCMD_INSTRUCTION_42(); // "sceCdWriteConfig" (16:1).
@ -328,7 +329,7 @@ public:
/* 0x12 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x13 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x14 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x15 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x15 */ &CDVD_s::SCMD_INSTRUCTION_15,
/* 0x16 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x17 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,
/* 0x18 */ &CDVD_s::SCMD_INSTRUCTION_UNKNOWN,