A GameCube/Wii emulator and debugger written in Rust.
starlet response delivery fix bit
Layle2dbf9e0a5fae
diff --git a/crates/gecko/src/hollywood/ipc.rs b/crates/gecko/src/hollywood/ipc.rsindex f118f17..787e6c3 100644--- a/crates/gecko/src/hollywood/ipc.rs+++ b/crates/gecko/src/hollywood/ipc.rs@@ -83,6 +83,6 @@ crate::mmio_device_dispatch! {pub fn deliver_response<const SYSTEM: SystemId>(sys: &mut System<SYSTEM>, cmd_paddr: u32, result: i32) {sys.mmio.phys_write_u32(cmd_paddr + 0x04, result as u32);sys.hollywood.ipc.armmsg = ArmMsg::from_raw(cmd_paddr);- sys.hollywood.ipc.ppcctrl = sys.hollywood.ipc.ppcctrl.with_ack_reply(true);+ sys.hollywood.ipc.ppcctrl = sys.hollywood.ipc.ppcctrl.with_arm_response(true);crate::hollywood::irq::assert_ipc(sys);}diff --git a/crates/gecko/src/hollywood/regs.rs b/crates/gecko/src/hollywood/regs.rsindex 00f7fb3..ecbae1a 100644--- a/crates/gecko/src/hollywood/regs.rs+++ b/crates/gecko/src/hollywood/regs.rs@@ -19,12 +19,23 @@ crate::mmio_default_access!(PpcMsg => System.hollywood.ipc.ppcmsg);#[derive(Copy, Clone, Debug)]#[rustfmt::skip]pub struct PpcCtrl {- #[bits(0)] pub execute: bool,- #[bits(1)] pub ack_reply: bool,- #[bits(2)] pub ack_relaunch: bool,- #[bits(3)] pub relaunch: bool,- #[bits(4)] pub irq_relaunch_enable: bool,- #[bits(5)] pub irq_reply_enable: bool,+ /// X1: PPC writes 1 to launch a command. Self-clearing once Starlet consumes.+ #[bits(0, alias = "x1")] pub execute: bool,++ /// Y2: Starlet sets to confirm transaction complete. W1C from PPC.+ #[bits(1, alias = "y2")] pub arm_post_ack: bool,++ /// Y1: Starlet sets to deliver the main response (with data). W1C from PPC.+ #[bits(2, alias = "y1")] pub arm_response: bool,++ /// X2: PPC writes 1 to acknowledge the Y1 response.+ #[bits(3, alias = "x2")] pub ack_response: bool,++ /// IY1: enable IRQ when Y1 (arm_response) is set.+ #[bits(4, alias = "iy1")] pub irq_arm_response: bool,++ /// IY2: enable IRQ when Y2 (arm_post_ack) is set.+ #[bits(5, alias = "iy2")] pub irq_arm_post_ack: bool,}crate::mmio_reg!(PpcCtrl: u32 @ 0x0D00_0004);@@ -41,8 +52,8 @@ impl<const SYSTEM: SystemId> MmioAccess<System<SYSTEM>> for PpcCtrl {// these are write 1 to clearsys.hollywood.ipc.ppcctrl = incoming- .with_ack_reply(current.ack_reply() && !incoming.ack_reply())- .with_ack_relaunch(current.ack_relaunch() && !incoming.ack_relaunch());+ .with_arm_post_ack(current.arm_post_ack() && !incoming.arm_post_ack())+ .with_arm_response(current.arm_response() && !incoming.arm_response());// dispatch via starletif sys.hollywood.ipc.ppcctrl.execute() {@@ -55,7 +66,7 @@ impl<const SYSTEM: SystemId> MmioAccess<System<SYSTEM>> for PpcCtrl {// PPC just ACKed a pending replylet ack_happened =- (current.ack_reply() && incoming.ack_reply()) || (current.ack_relaunch() && incoming.ack_relaunch());+ (current.arm_post_ack() && incoming.arm_post_ack()) || (current.arm_response() && incoming.arm_response());if ack_happened {crate::hollywood::irq::ack_ipc(sys);crate::starlet::schedule_drain(sys);diff --git a/crates/gecko/src/starlet.rs b/crates/gecko/src/starlet.rsindex f6d396a..121649c 100644--- a/crates/gecko/src/starlet.rs+++ b/crates/gecko/src/starlet.rs@@ -217,7 +217,7 @@ fn read_c_string(ctx: &mut DeviceContext<'_>, paddr: u32) -> String {}fn deliver_pending<const SYSTEM: SystemId>(sys: &mut System<SYSTEM>) {- if sys.hollywood.ipc.ppcctrl.ack_reply() {+ if sys.hollywood.ipc.ppcctrl.arm_response() {// PPC slot still occupied. Wait for the ack.return;}