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< TransferBlock > | blocks_ |
std::deque< PortWrite > | port_history_ |
Static Private Attributes | |
static constexpr size_t | kMaxHistorySize = 1000 |
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.
|
strong |
Enumerator | |
---|---|
RESET | |
IPL_BOOT | |
WAITING_BBAA | |
HANDSHAKE_CC | |
TRANSFER_ACTIVE | |
TRANSFER_DONE | |
RUNNING |
Definition at line 23 of file apu_debugger.h.
yaze::emu::debug::ApuHandshakeTracker::ApuHandshakeTracker | ( | ) |
Definition at line 12 of file apu_debugger.cc.
References Reset().
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().
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().
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().
|
inline |
Definition at line 57 of file apu_debugger.h.
References phase_.
|
inline |
Definition at line 58 of file apu_debugger.h.
References handshake_complete_.
|
inline |
Definition at line 59 of file apu_debugger.h.
References phase_, and TRANSFER_ACTIVE.
|
inline |
Definition at line 60 of file apu_debugger.h.
References total_bytes_transferred_.
|
inline |
Definition at line 61 of file apu_debugger.h.
References blocks_.
|
inline |
Definition at line 64 of file apu_debugger.h.
References port_history_.
|
inline |
Definition at line 65 of file apu_debugger.h.
References blocks_.
std::string yaze::emu::debug::ApuHandshakeTracker::GetPhaseString | ( | ) | const |
Definition at line 168 of file apu_debugger.cc.
References HANDSHAKE_CC, IPL_BOOT, phase_, RESET, RUNNING, TRANSFER_ACTIVE, TRANSFER_DONE, and WAITING_BBAA.
Referenced by GetStatusSummary(), and UpdatePhase().
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_.
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.
void yaze::emu::debug::ApuHandshakeTracker::Reset | ( | ) |
Definition at line 16 of file apu_debugger.cc.
References blocks_, cpu_ports_, handshake_complete_, ipl_rom_enabled_, LOG_DEBUG, phase_, port_history_, RESET, spc_ports_, total_bytes_transferred_, and transfer_counter_.
Referenced by ApuHandshakeTracker(), and yaze::emu::Apu::Reset().
|
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().
|
private |
Definition at line 150 of file apu_debugger.cc.
References yaze::emu::debug::ApuHandshakeTracker::PortWrite::description, yaze::emu::debug::ApuHandshakeTracker::PortWrite::is_cpu, kMaxHistorySize, yaze::emu::debug::ApuHandshakeTracker::PortWrite::pc, yaze::emu::debug::ApuHandshakeTracker::PortWrite::port, port_history_, yaze::emu::debug::ApuHandshakeTracker::PortWrite::timestamp, and yaze::emu::debug::ApuHandshakeTracker::PortWrite::value.
Referenced by OnCpuPortWrite(), and OnSpcPortWrite().
|
private |
Definition at line 80 of file apu_debugger.h.
Referenced by GetPhase(), GetPhaseString(), GetTransferProgress(), IsTransferActive(), OnCpuPortWrite(), OnSpcPCChange(), OnSpcPortWrite(), Reset(), and UpdatePhase().
|
private |
Definition at line 81 of file apu_debugger.h.
Referenced by GetStatusSummary(), IsHandshakeComplete(), OnCpuPortWrite(), and Reset().
|
private |
Definition at line 82 of file apu_debugger.h.
Referenced by OnSpcPCChange(), and Reset().
|
private |
Definition at line 84 of file apu_debugger.h.
Referenced by OnCpuPortWrite(), and Reset().
|
private |
Definition at line 85 of file apu_debugger.h.
Referenced by OnSpcPortWrite(), and Reset().
|
private |
Definition at line 87 of file apu_debugger.h.
Referenced by OnCpuPortWrite(), OnSpcPortWrite(), and Reset().
|
private |
Definition at line 88 of file apu_debugger.h.
Referenced by GetBytesTransferred(), GetStatusSummary(), GetTransferProgress(), OnSpcPortWrite(), and Reset().
|
private |
Definition at line 90 of file apu_debugger.h.
Referenced by GetBlockCount(), GetBlocks(), GetStatusSummary(), and Reset().
|
private |
Definition at line 91 of file apu_debugger.h.
Referenced by GetPortHistory(), LogPortWrite(), and Reset().
|
staticconstexprprivate |
Definition at line 93 of file apu_debugger.h.
Referenced by LogPortWrite().