From 4ce85e28caac8d1893aa5890efbc8e6adfce6e10 Mon Sep 17 00:00:00 2001 From: yz70s Date: Sun, 24 Nov 2019 17:43:17 +0100 Subject: xbox_usb.cpp: remove some problems (nw) --- src/mame/includes/xbox_usb.h | 2 +- src/mame/machine/xbox_usb.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mame/includes/xbox_usb.h b/src/mame/includes/xbox_usb.h index 1e363823a0a..35f0d7782e7 100644 --- a/src/mame/includes/xbox_usb.h +++ b/src/mame/includes/xbox_usb.h @@ -355,7 +355,7 @@ public: void usb_ohci_device_address_changed(int old_address, int new_address); void set_cpu(cpu_device *cpu) { m_maincpu = cpu; } void set_timer(emu_timer *timer) { ohcist.timer = timer; } - void set_irq_callbaclk(std::function callback) { irq_callback = callback; } + void set_irq_callback(std::function callback) { irq_callback = callback; } void start(); void reset(); diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp index 995c3acc0f9..c272b3ded71 100644 --- a/src/mame/machine/xbox_usb.cpp +++ b/src/mame/machine/xbox_usb.cpp @@ -124,9 +124,12 @@ WRITE32_MEMBER(ohci_usb_controller::write) ohcist.state = hcfs; } if (offset == HcCommandStatus) { + ohcist.hc_regs[HcCommandStatus] |= data; if (data & 1) // HostControllerReset + { ohcist.hc_regs[HcControl] |= 3 << 6; - ohcist.hc_regs[HcCommandStatus] |= data; + ohcist.hc_regs[HcCommandStatus] &= ~1; + } return; } if (offset == HcInterruptStatus) { @@ -231,7 +234,8 @@ void ohci_usb_controller::timer(emu_timer &timer, device_timer_id id, int param, if (ohcist.state == UsbOperational) { // increment frame number ohcist.framenumber = (ohcist.framenumber + 1) & 0xffff; - ohcist.space->write_dword(hcca + 0x80, ohcist.framenumber); + if (hcca) + ohcist.space->write_dword(hcca + 0x80, ohcist.framenumber); ohcist.hc_regs[HcFmNumber] = ohcist.framenumber; } // port reset delay @@ -682,6 +686,8 @@ void ohci_usb_controller::timer(emu_timer &timer, device_timer_id id, int param, else list = 0; // if no control or bulk lists, go to periodic list } + else + list = 0; } } if (ohcist.framenumber == 0) @@ -695,7 +701,8 @@ void ohci_usb_controller::timer(emu_timer &timer, device_timer_id id, int param, if ((ohcist.hc_regs[HcInterruptStatus] & ohcist.hc_regs[HcInterruptEnable]) != WritebackDoneHead) b = 1; ohcist.hc_regs[HcInterruptStatus] |= WritebackDoneHead; - ohcist.space->write_dword(hcca + 0x84, ohcist.hc_regs[HcDoneHead] | b); + if (hcca) + ohcist.space->write_dword(hcca + 0x84, ohcist.hc_regs[HcDoneHead] | b); ohcist.hc_regs[HcDoneHead] = 0; ohcist.writebackdonehadcounter = 7; } -- cgit v1.2.3