Pad: Use baud rate for transfer delay
This commit is contained in:
parent
4283fa7f74
commit
e99f0a4acf
|
@ -77,7 +77,7 @@ u32 Pad::ReadRegister(u32 offset)
|
|||
{
|
||||
if (m_RX_FIFO.IsEmpty())
|
||||
{
|
||||
Log_WarningPrint("Read from RX fifo when empty");
|
||||
Log_DevPrintf("Read from RX fifo when empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ void Pad::WriteRegister(u32 offset, u32 value)
|
|||
case 0x0E:
|
||||
{
|
||||
Log_DebugPrintf("JOY_BAUD <- 0x%08X", value);
|
||||
m_JOY_BAUD = value;
|
||||
m_JOY_BAUD = Truncate16(value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void Pad::BeginTransfer()
|
|||
|
||||
m_system->Synchronize();
|
||||
m_state = State::Transmitting;
|
||||
m_ticks_remaining = TRANSFER_TICKS;
|
||||
m_ticks_remaining = GetTransferTicks();
|
||||
m_system->SetDowncount(m_ticks_remaining);
|
||||
}
|
||||
|
||||
|
@ -268,9 +268,9 @@ void Pad::DoTransfer()
|
|||
{
|
||||
case ActiveDevice::None:
|
||||
{
|
||||
if (!controller || !(ack = controller->Transfer(data_out, &data_in)))
|
||||
if (!controller || (ack = controller->Transfer(data_out, &data_in)) == false)
|
||||
{
|
||||
if (!memory_card || !(ack = memory_card->Transfer(data_out, &data_in)))
|
||||
if (!memory_card || (ack = memory_card->Transfer(data_out, &data_in)) == false)
|
||||
{
|
||||
// nothing connected to this port
|
||||
Log_DebugPrintf("Nothing connected or ACK'ed");
|
||||
|
@ -327,7 +327,7 @@ void Pad::DoTransfer()
|
|||
else
|
||||
{
|
||||
// queue the next byte
|
||||
m_ticks_remaining += TRANSFER_TICKS;
|
||||
m_ticks_remaining += GetTransferTicks();
|
||||
m_system->SetDowncount(m_ticks_remaining);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ public:
|
|||
|
||||
private:
|
||||
static constexpr u32 NUM_SLOTS = 2;
|
||||
static constexpr u32 TRANSFER_TICKS = 750;
|
||||
|
||||
enum class State : u32
|
||||
{
|
||||
|
@ -94,6 +93,8 @@ private:
|
|||
return !m_TX_FIFO.IsEmpty() && !m_RX_FIFO.IsFull() && m_JOY_CTRL.SELECT && m_JOY_CTRL.TXEN;
|
||||
}
|
||||
|
||||
TickCount GetTransferTicks() const { return static_cast<TickCount>(ZeroExtend32(m_JOY_BAUD) * 8); }
|
||||
|
||||
void SoftReset();
|
||||
void UpdateJoyStat();
|
||||
void BeginTransfer();
|
||||
|
|
|
@ -78,8 +78,7 @@ int main(int argc, char* argv[])
|
|||
const LOGLEVEL level = LOGLEVEL_INFO;
|
||||
// const LOGLEVEL level = LOGLEVEL_DEV;
|
||||
// const LOGLEVEL level = LOGLEVEL_PROFILE;
|
||||
// g_pLog->SetConsoleOutputParams(true, nullptr, level);
|
||||
g_pLog->SetConsoleOutputParams(true, "Pad", level);
|
||||
g_pLog->SetConsoleOutputParams(true, nullptr, level);
|
||||
g_pLog->SetFilterLevel(level);
|
||||
#else
|
||||
g_pLog->SetConsoleOutputParams(true, nullptr, LOGLEVEL_DEBUG);
|
||||
|
|
Loading…
Reference in New Issue