yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::emu::debug::ApuHandshakeTracker Class Reference

IPL ROM handshake tracker. More...

#include <apu_debugger.h>

Classes

struct  PortWrite
 
struct  TransferBlock
 

Public Types

enum class  Phase {
  RESET , IPL_BOOT , WAITING_BBAA , HANDSHAKE_CC ,
  TRANSFER_ACTIVE , TRANSFER_DONE , RUNNING
}
 

Public Member Functions

 ApuHandshakeTracker ()
 
void OnCpuPortWrite (uint8_t port, uint8_t value, uint32_t pc)
 
void OnSpcPortWrite (uint8_t port, uint8_t value, uint16_t pc)
 
void OnSpcPCChange (uint16_t old_pc, uint16_t new_pc)
 
Phase GetPhase () const
 
bool IsHandshakeComplete () const
 
bool IsTransferActive () const
 
int GetBytesTransferred () const
 
int GetBlockCount () const
 
const std::deque< PortWrite > & GetPortHistory () const
 
const std::vector< TransferBlock > & GetBlocks () const
 
std::string GetPhaseString () const
 
std::string GetStatusSummary () const
 
std::string GetTransferProgress () const
 
void Reset ()
 

Private Member Functions

void UpdatePhase (Phase new_phase)
 
void LogPortWrite (bool is_cpu, uint8_t port, uint8_t value, uint32_t pc, const std::string &desc)
 

Private Attributes

Phase phase_ = Phase::RESET
 
bool handshake_complete_ = false
 
bool ipl_rom_enabled_ = true
 
uint8_t cpu_ports_ [4] = {0}
 
uint8_t spc_ports_ [4] = {0}
 
int transfer_counter_ = 0
 
int total_bytes_transferred_ = 0
 
std::vector< TransferBlockblocks_
 
std::deque< PortWriteport_history_
 

Static Private Attributes

static constexpr size_t kMaxHistorySize = 1000
 

Detailed Description

IPL ROM handshake tracker.

Monitors CPU-APU communication during audio program upload to diagnose handshake failures and transfer issues.

Definition at line 21 of file apu_debugger.h.

Member Enumeration Documentation

◆ Phase

Enumerator
RESET 
IPL_BOOT 
WAITING_BBAA 
HANDSHAKE_CC 
TRANSFER_ACTIVE 
TRANSFER_DONE 
RUNNING 

Definition at line 23 of file apu_debugger.h.

Constructor & Destructor Documentation

◆ ApuHandshakeTracker()

yaze::emu::debug::ApuHandshakeTracker::ApuHandshakeTracker ( )

Definition at line 12 of file apu_debugger.cc.

References Reset().

Here is the call graph for this function:

Member Function Documentation

◆ OnCpuPortWrite()

void yaze::emu::debug::ApuHandshakeTracker::OnCpuPortWrite ( uint8_t  port,
uint8_t  value,
uint32_t  pc 
)

Definition at line 32 of file apu_debugger.cc.

References cpu_ports_, HANDSHAKE_CC, handshake_complete_, LOG_INFO, LogPortWrite(), phase_, TRANSFER_ACTIVE, transfer_counter_, UpdatePhase(), and WAITING_BBAA.

Referenced by yaze::emu::Snes::WriteBBus().

Here is the call graph for this function:

◆ OnSpcPortWrite()

void yaze::emu::debug::ApuHandshakeTracker::OnSpcPortWrite ( uint8_t  port,
uint8_t  value,
uint16_t  pc 
)

Definition at line 67 of file apu_debugger.cc.

References IPL_BOOT, LOG_INFO, LOG_WARN, LogPortWrite(), phase_, spc_ports_, total_bytes_transferred_, TRANSFER_ACTIVE, transfer_counter_, UpdatePhase(), and WAITING_BBAA.

Referenced by yaze::emu::Apu::Write().

Here is the call graph for this function:

◆ OnSpcPCChange()

void yaze::emu::debug::ApuHandshakeTracker::OnSpcPCChange ( uint16_t  old_pc,
uint16_t  new_pc 
)

Definition at line 111 of file apu_debugger.cc.

References IPL_BOOT, ipl_rom_enabled_, LOG_INFO, phase_, RESET, RUNNING, TRANSFER_ACTIVE, TRANSFER_DONE, and UpdatePhase().

Referenced by yaze::emu::Apu::RunCycles(), and yaze::emu::Apu::Write().

Here is the call graph for this function:

◆ GetPhase()

Phase yaze::emu::debug::ApuHandshakeTracker::GetPhase ( ) const
inline

Definition at line 57 of file apu_debugger.h.

References phase_.

◆ IsHandshakeComplete()

bool yaze::emu::debug::ApuHandshakeTracker::IsHandshakeComplete ( ) const
inline

Definition at line 58 of file apu_debugger.h.

References handshake_complete_.

◆ IsTransferActive()

bool yaze::emu::debug::ApuHandshakeTracker::IsTransferActive ( ) const
inline

Definition at line 59 of file apu_debugger.h.

References phase_, and TRANSFER_ACTIVE.

◆ GetBytesTransferred()

int yaze::emu::debug::ApuHandshakeTracker::GetBytesTransferred ( ) const
inline

Definition at line 60 of file apu_debugger.h.

References total_bytes_transferred_.

◆ GetBlockCount()

int yaze::emu::debug::ApuHandshakeTracker::GetBlockCount ( ) const
inline

Definition at line 61 of file apu_debugger.h.

References blocks_.

◆ GetPortHistory()

const std::deque< PortWrite > & yaze::emu::debug::ApuHandshakeTracker::GetPortHistory ( ) const
inline

Definition at line 64 of file apu_debugger.h.

References port_history_.

◆ GetBlocks()

const std::vector< TransferBlock > & yaze::emu::debug::ApuHandshakeTracker::GetBlocks ( ) const
inline

Definition at line 65 of file apu_debugger.h.

References blocks_.

◆ GetPhaseString()

std::string yaze::emu::debug::ApuHandshakeTracker::GetPhaseString ( ) const

◆ GetStatusSummary()

std::string yaze::emu::debug::ApuHandshakeTracker::GetStatusSummary ( ) const

Definition at line 181 of file apu_debugger.cc.

References blocks_, GetPhaseString(), handshake_complete_, and total_bytes_transferred_.

Here is the call graph for this function:

◆ GetTransferProgress()

std::string yaze::emu::debug::ApuHandshakeTracker::GetTransferProgress ( ) const

Definition at line 190 of file apu_debugger.cc.

References phase_, total_bytes_transferred_, TRANSFER_ACTIVE, and TRANSFER_DONE.

◆ Reset()

void yaze::emu::debug::ApuHandshakeTracker::Reset ( )

◆ UpdatePhase()

void yaze::emu::debug::ApuHandshakeTracker::UpdatePhase ( Phase  new_phase)
private

Definition at line 130 of file apu_debugger.cc.

References GetPhaseString(), HANDSHAKE_CC, IPL_BOOT, LOG_DEBUG, phase_, RESET, RUNNING, TRANSFER_ACTIVE, TRANSFER_DONE, and WAITING_BBAA.

Referenced by OnCpuPortWrite(), OnSpcPCChange(), and OnSpcPortWrite().

Here is the call graph for this function:

◆ LogPortWrite()

Member Data Documentation

◆ phase_

Phase yaze::emu::debug::ApuHandshakeTracker::phase_ = Phase::RESET
private

◆ handshake_complete_

bool yaze::emu::debug::ApuHandshakeTracker::handshake_complete_ = false
private

Definition at line 81 of file apu_debugger.h.

Referenced by GetStatusSummary(), IsHandshakeComplete(), OnCpuPortWrite(), and Reset().

◆ ipl_rom_enabled_

bool yaze::emu::debug::ApuHandshakeTracker::ipl_rom_enabled_ = true
private

Definition at line 82 of file apu_debugger.h.

Referenced by OnSpcPCChange(), and Reset().

◆ cpu_ports_

uint8_t yaze::emu::debug::ApuHandshakeTracker::cpu_ports_[4] = {0}
private

Definition at line 84 of file apu_debugger.h.

Referenced by OnCpuPortWrite(), and Reset().

◆ spc_ports_

uint8_t yaze::emu::debug::ApuHandshakeTracker::spc_ports_[4] = {0}
private

Definition at line 85 of file apu_debugger.h.

Referenced by OnSpcPortWrite(), and Reset().

◆ transfer_counter_

int yaze::emu::debug::ApuHandshakeTracker::transfer_counter_ = 0
private

Definition at line 87 of file apu_debugger.h.

Referenced by OnCpuPortWrite(), OnSpcPortWrite(), and Reset().

◆ total_bytes_transferred_

int yaze::emu::debug::ApuHandshakeTracker::total_bytes_transferred_ = 0
private

◆ blocks_

std::vector<TransferBlock> yaze::emu::debug::ApuHandshakeTracker::blocks_
private

Definition at line 90 of file apu_debugger.h.

Referenced by GetBlockCount(), GetBlocks(), GetStatusSummary(), and Reset().

◆ port_history_

std::deque<PortWrite> yaze::emu::debug::ApuHandshakeTracker::port_history_
private

Definition at line 91 of file apu_debugger.h.

Referenced by GetPortHistory(), LogPortWrite(), and Reset().

◆ kMaxHistorySize

constexpr size_t yaze::emu::debug::ApuHandshakeTracker::kMaxHistorySize = 1000
staticconstexprprivate

Definition at line 93 of file apu_debugger.h.

Referenced by LogPortWrite().


The documentation for this class was generated from the following files: