xbox_pci.cpp: support io port 61 (nw)

This commit is contained in:
yz70s 2019-11-24 17:45:01 +01:00
parent 4ce85e28ca
commit 48393e5de8
2 changed files with 61 additions and 4 deletions

View File

@ -118,12 +118,17 @@ protected:
DECLARE_WRITE_LINE_MEMBER(interrupt_ouptut_changed);
DECLARE_READ8_MEMBER(get_slave_ack);
DECLARE_WRITE_LINE_MEMBER(pit8254_out0_changed);
DECLARE_WRITE_LINE_MEMBER(pit8254_out1_changed);
DECLARE_WRITE_LINE_MEMBER(pit8254_out2_changed);
private:
void internal_io_map(address_map &map);
void lpc_io(address_map &map);
void update_smi_line();
void speaker_set_spkrdata(uint8_t data);
DECLARE_READ8_MEMBER(portb_r);
DECLARE_WRITE8_MEMBER(portb_w);
devcb_write_line m_smi_callback;
devcb_write_line m_interrupt_output;
@ -141,6 +146,11 @@ private:
uint16_t m_global_smi_control;
uint8_t m_smi_command_port;
lpcbus_device_interface *lpcdevices[16];
uint8_t m_speaker;
bool m_refresh;
uint8_t m_pit_out2;
uint8_t m_spkrdata;
uint8_t m_channel_check;
};
DECLARE_DEVICE_TYPE(MCPX_ISALPC, mcpx_isalpc_device)

View File

@ -106,6 +106,7 @@ void mcpx_isalpc_device::internal_io_map(address_map &map)
{
map(0x0020, 0x0023).rw("pic8259_1", FUNC(pic8259_device::read), FUNC(pic8259_device::write));
map(0x0040, 0x0043).rw("pit8254", FUNC(pit8254_device::read), FUNC(pit8254_device::write));
map(0x0061, 0x0061).rw(FUNC(mcpx_isalpc_device::portb_r), FUNC(mcpx_isalpc_device::portb_w));
map(0x0070, 0x0073).rw("rtc", FUNC(ds12885ext_device::read_extended), FUNC(ds12885ext_device::write_extended));
map(0x0080, 0x0080).w(FUNC(mcpx_isalpc_device::boot_state_w));
map(0x00a0, 0x00a3).rw("pic8259_2", FUNC(pic8259_device::read), FUNC(pic8259_device::write));
@ -141,7 +142,12 @@ mcpx_isalpc_device::mcpx_isalpc_device(const machine_config &mconfig, const char
m_gpe0_status(0),
m_gpe0_enable(0),
m_global_smi_control(0),
m_smi_command_port(0)
m_smi_command_port(0),
m_speaker(0),
m_refresh(false),
m_pit_out2(0),
m_spkrdata(0),
m_channel_check(0)
{
}
@ -186,6 +192,9 @@ void mcpx_isalpc_device::device_start()
void mcpx_isalpc_device::device_reset()
{
pci_device::device_reset();
m_refresh = false;
m_pit_out2 = 1;
m_spkrdata = 0;
}
void mcpx_isalpc_device::device_add_mconfig(machine_config &config)
@ -202,7 +211,8 @@ void mcpx_isalpc_device::device_add_mconfig(machine_config &config)
pit8254_device &pit8254(PIT8254(config, "pit8254", 0));
pit8254.set_clk<0>(1125000); /* heartbeat IRQ */
pit8254.out_handler<0>().set(FUNC(mcpx_isalpc_device::pit8254_out0_changed));
pit8254.set_clk<1>(1125000); /* (unused) dram refresh */
pit8254.set_clk<1>(1125000); /* originally dram refresh, now only legacy support */
pit8254.out_handler<1>().set(FUNC(mcpx_isalpc_device::pit8254_out1_changed));
pit8254.set_clk<2>(1125000); /* (unused) pio port c pin 4, and speaker polling enough */
pit8254.out_handler<2>().set(FUNC(mcpx_isalpc_device::pit8254_out2_changed));
@ -300,9 +310,16 @@ WRITE_LINE_MEMBER(mcpx_isalpc_device::pit8254_out0_changed)
pic8259_1->ir0_w(state);
}
WRITE_LINE_MEMBER(mcpx_isalpc_device::pit8254_out1_changed)
{
if (state)
m_refresh = !m_refresh;
}
WRITE_LINE_MEMBER(mcpx_isalpc_device::pit8254_out2_changed)
{
//xbox_speaker_set_input( state ? 1 : 0 );
m_pit_out2 = state ? 1 : 0;
//xbox_speaker_set_input(m_at_spkrdata & m_pit_out2);
}
WRITE_LINE_MEMBER(mcpx_isalpc_device::irq1)
@ -335,11 +352,41 @@ WRITE_LINE_MEMBER(mcpx_isalpc_device::irq15)
pic8259_2->ir7_w(state);
}
READ8_MEMBER(mcpx_isalpc_device::portb_r)
{
uint8_t data = m_speaker;
data &= ~0xd0; /* AT BIOS don't likes this being set */
/* 0x10 is the dram refresh line bit on the 5170, just a timer here, 15.085us. */
data |= m_refresh ? 0x10 : 0;
if (m_pit_out2)
data |= 0x20;
else
data &= ~0x20; /* ps2m30 wants this */
return data;
}
WRITE8_MEMBER(mcpx_isalpc_device::portb_w)
{
m_speaker = data;
pit8254->write_gate2(BIT(data, 0));
speaker_set_spkrdata(BIT(data, 1));
m_channel_check = BIT(data, 3);
//if (m_channel_check) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
uint32_t mcpx_isalpc_device::acknowledge()
{
return pic8259_1->acknowledge();
}
void mcpx_isalpc_device::speaker_set_spkrdata(uint8_t data)
{
m_spkrdata = data ? 1 : 0;
//xbox_speaker_set_input(m_at_spkrdata & m_pit_out2);
}
void mcpx_isalpc_device::debug_generate_irq(int irq, int state)
{
set_virtual_line(irq, state);
@ -601,7 +648,7 @@ void mcpx_ohci_device::device_start()
status = 0x00b0;
ohci_usb = new ohci_usb_controller();
ohci_usb->set_cpu(maincpu.target());
ohci_usb->set_irq_callbaclk(
ohci_usb->set_irq_callback(
[&](int state)
{
m_interrupt_handler(state);