mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
mc146818: correct interrupt polarity (nw) (#3627)
This change makes the MC146818/DS128x devices use the regular ASSERT_LINE/CLEAR_LINE protocol like almost all other devices, removing an unexpected surprise. The devices are fairly widely used, so I've tried to review all of those references and check if they're affected. A surprising number of systems appear to have the interrupt hooked up, but were not accounting for the inversion, so this change might possibly correct some behaviour. The following were modified to remove workarounds: * src/devices/machine/cs4031: removed inversion * src/devices/machine/wd7600: removed inversion * src/mame/drivers/apollo: hooked up interrupt * src/mame/drivers/micronic: removed inversion * src/mame/drivers/octopus: removed inversion * src/mame/machine/apollo: removed timer workaround * src/mame/machine/at: removed inversion * src/mame/machine/interpro_ioga: removed inversion The behaviour of the following might change: * src/devices/bus/econet/e01.cpp * src/devices/bus/electron/cart/click.cpp * src/devices/bus/lpci/southbridge.cpp * src/devices/machine/fdc37c93x.cpp * src/devices/machine/sis85c496.cpp * src/mame/drivers/at.cpp * src/mame/drivers/calchase.cpp * src/mame/drivers/hotstuff.cpp * src/mame/drivers/hx20.cpp * src/mame/drivers/mbee.cpp * src/mame/drivers/mtouchxl.cpp * src/mame/drivers/pc1512.cpp * src/mame/drivers/pcat_dyn.cpp * src/mame/drivers/pcd.cpp * src/mame/drivers/qx10.cpp * src/mame/drivers/su2000.cpp * src/mame/machine/pcshare.cpp
This commit is contained in:
parent
87e96248f1
commit
11b74321a4
@ -147,7 +147,7 @@ MACHINE_CONFIG_START(cs4031_device::device_add_mconfig)
|
||||
MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, cs4031_device, ctc_out2_w))
|
||||
|
||||
MCFG_DS12885_ADD("rtc")
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE(*this, cs4031_device, rtc_irq_w))
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("intc2", pic8259_device, ir0_w))
|
||||
MCFG_MC146818_CENTURY_INDEX(0x32)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
@ -433,11 +433,6 @@ READ8_MEMBER( cs4031_device::intc1_slave_ack_r )
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( cs4031_device::rtc_irq_w )
|
||||
{
|
||||
m_intc2->ir0_w(state ? 0 : 1); // inverted?
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( cs4031_device::iochck_w )
|
||||
{
|
||||
LOGIO("cs4031_device::iochck_w: %u\n", state);
|
||||
|
@ -276,7 +276,6 @@ private:
|
||||
DECLARE_READ8_MEMBER( intc1_slave_ack_r );
|
||||
DECLARE_WRITE_LINE_MEMBER( ctc_out1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ctc_out2_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( rtc_irq_w );
|
||||
};
|
||||
|
||||
|
||||
|
@ -490,18 +490,17 @@ int mc146818_device::get_timer_bypass()
|
||||
|
||||
void mc146818_device::update_irq()
|
||||
{
|
||||
// IRQ line is active low
|
||||
if (((m_data[REG_C] & REG_C_UF) && (m_data[REG_B] & REG_B_UIE)) ||
|
||||
((m_data[REG_C] & REG_C_AF) && (m_data[REG_B] & REG_B_AIE)) ||
|
||||
((m_data[REG_C] & REG_C_PF) && (m_data[REG_B] & REG_B_PIE)))
|
||||
{
|
||||
m_data[REG_C] |= REG_C_IRQF;
|
||||
m_write_irq(CLEAR_LINE);
|
||||
m_write_irq(ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_data[REG_C] &= ~REG_C_IRQF;
|
||||
m_write_irq(ASSERT_LINE);
|
||||
m_write_irq(CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ MACHINE_CONFIG_START(wd7600_device::device_add_mconfig)
|
||||
MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, wd7600_device, ctc_out2_w))
|
||||
|
||||
MCFG_DS12885_ADD("rtc")
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE(*this, wd7600_device, rtc_irq_w))
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("intc2", pic8259_device, ir0_w))
|
||||
MCFG_MC146818_CENTURY_INDEX(0x32)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
@ -268,11 +268,6 @@ WRITE8_MEMBER( wd7600_device::rtc_w )
|
||||
m_rtc->write(space, offset, data);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( wd7600_device::rtc_irq_w )
|
||||
{
|
||||
m_pic2->ir0_w(state ? 0 : 1); // inverted?
|
||||
}
|
||||
|
||||
READ8_MEMBER( wd7600_device::pic1_slave_ack_r )
|
||||
{
|
||||
if (offset == 2) // IRQ 2
|
||||
|
@ -134,7 +134,6 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
private:
|
||||
DECLARE_WRITE_LINE_MEMBER(rtc_irq_w);
|
||||
DECLARE_WRITE_LINE_MEMBER( pic1_int_w ) { m_write_intr(state); }
|
||||
DECLARE_READ8_MEMBER( pic1_slave_ack_r );
|
||||
DECLARE_WRITE_LINE_MEMBER( ctc_out1_w );
|
||||
|
@ -1128,6 +1128,10 @@ MACHINE_CONFIG_START(apollo_state::dn3000)
|
||||
MCFG_RAM_MODIFY("messram")
|
||||
MCFG_RAM_DEFAULT_SIZE("8M")
|
||||
MCFG_RAM_EXTRA_OPTIONS("4M")
|
||||
|
||||
// FIXME: is this interrupt really only connected on DN3000?
|
||||
MCFG_DEVICE_MODIFY(APOLLO_RTC_TAG)
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE(*this, apollo_state, apollo_rtc_irq_function))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(apollo_state::dsp3000)
|
||||
|
@ -346,7 +346,7 @@ void micronic_state::machine_reset()
|
||||
|
||||
WRITE_LINE_MEMBER( micronic_state::mc146818_irq )
|
||||
{
|
||||
m_maincpu->set_input_line(0, !state ? HOLD_LINE : CLEAR_LINE);
|
||||
m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -942,7 +942,7 @@ MACHINE_CONFIG_START(octopus_state::octopus)
|
||||
MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, octopus_state,gpo_w))
|
||||
|
||||
MCFG_DEVICE_ADD("rtc", MC146818, 32.768_kHz_XTAL)
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic_slave",pic8259_device, ir2_w)) MCFG_DEVCB_INVERT
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic_slave",pic8259_device, ir2_w))
|
||||
|
||||
// Keyboard UART
|
||||
MCFG_DEVICE_ADD("keyboard", I8251, 0)
|
||||
|
@ -224,6 +224,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( apollo_ptm_irq_function );
|
||||
DECLARE_WRITE_LINE_MEMBER( apollo_ptm_timer_tick );
|
||||
DECLARE_READ8_MEMBER( apollo_pic8259_get_slave_ack );
|
||||
DECLARE_WRITE_LINE_MEMBER( apollo_rtc_irq_function );
|
||||
|
||||
DECLARE_READ8_MEMBER(pc_dma8237_0_dack_r);
|
||||
DECLARE_READ8_MEMBER(pc_dma8237_1_dack_r);
|
||||
@ -247,7 +248,6 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(pc_dack5_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pc_dack6_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(pc_dack7_w);
|
||||
TIMER_CALLBACK_MEMBER( apollo_rtc_timer );
|
||||
|
||||
void apollo_pic_set_irq_line(int irq, int state);
|
||||
void select_dma_channel(int channel, bool state);
|
||||
@ -283,7 +283,6 @@ private:
|
||||
uint8_t sio_output_data;
|
||||
int m_dma_channel;
|
||||
bool m_cur_eop;
|
||||
emu_timer *m_dn3000_timer;
|
||||
};
|
||||
|
||||
/*----------- machine/apollo_config.c -----------*/
|
||||
|
@ -692,17 +692,9 @@ READ8_MEMBER(apollo_state::apollo_rtc_r)
|
||||
return data;
|
||||
}
|
||||
|
||||
// TODO: this is covering for missing mc146818 functionality
|
||||
TIMER_CALLBACK_MEMBER( apollo_state::apollo_rtc_timer )
|
||||
WRITE_LINE_MEMBER(apollo_state::apollo_rtc_irq_function)
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
|
||||
// FIXME: reading register 0x0c will clear all interrupt flags
|
||||
if ((apollo_rtc_r(space, 0x0c) & 0x80))
|
||||
{
|
||||
//SLOG2(("apollo_rtc_timer - set_irq_line %d", APOLLO_IRQ_RTC));
|
||||
apollo_pic_set_irq_line(APOLLO_IRQ_RTC, 1);
|
||||
}
|
||||
apollo_pic_set_irq_line(APOLLO_IRQ_RTC, state);
|
||||
}
|
||||
|
||||
//##########################################################################
|
||||
@ -1108,6 +1100,8 @@ MACHINE_CONFIG_START(apollo_state::common)
|
||||
MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, apollo_state, apollo_ptm_timer_tick))
|
||||
|
||||
MCFG_DEVICE_ADD(APOLLO_RTC_TAG, MC146818, 32.768_kHz_XTAL)
|
||||
// FIXME: is this interrupt really only connected on DN3000?
|
||||
//MCFG_MC146818_IRQ_HANDLER(WRITELINE(*this, apollo_state, apollo_rtc_irq_function))
|
||||
MCFG_MC146818_UTC(true)
|
||||
MCFG_MC146818_BINARY(false)
|
||||
MCFG_MC146818_24_12(false)
|
||||
@ -1195,13 +1189,6 @@ MACHINE_START_MEMBER(apollo_state,apollo)
|
||||
{
|
||||
MLOG1(("machine_start_apollo"));
|
||||
|
||||
if (apollo_is_dn3000())
|
||||
{
|
||||
//MLOG1(("faking mc146818 interrupts (DN3000 only)"));
|
||||
// fake mc146818 interrupts (DN3000 only)
|
||||
m_dn3000_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(apollo_state::apollo_rtc_timer),this));
|
||||
}
|
||||
|
||||
m_dma_channel = -1;
|
||||
m_cur_eop = false;
|
||||
}
|
||||
@ -1236,11 +1223,6 @@ MACHINE_RESET_MEMBER(apollo_state,apollo)
|
||||
|
||||
ptm_counter = 0;
|
||||
sio_output_data = 0xff;
|
||||
|
||||
if (apollo_is_dn3000())
|
||||
{
|
||||
m_dn3000_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef APOLLO_XXL
|
||||
|
@ -126,7 +126,7 @@ MACHINE_CONFIG_START(at_mb_device::device_add_mconfig)
|
||||
MCFG_ISA_OUT_DRQ7_CB(WRITELINE("dma8237_2", am9517a_device, dreq3_w))
|
||||
|
||||
MCFG_DEVICE_ADD("rtc", MC146818, 32.768_kHz_XTAL)
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir0_w)) MCFG_DEVCB_INVERT
|
||||
MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir0_w))
|
||||
MCFG_MC146818_CENTURY_INDEX(0x32)
|
||||
|
||||
/* sound hardware */
|
||||
|
@ -134,8 +134,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(ir6_w) { set_int_line(INT_HARD_EX, IRQ_VB, state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir7_w) { set_int_line(INT_HARD_EX, IRQ_9, state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir8_w) { set_int_line(INT_HARD_EX, IRQ_CBUS3, state); }
|
||||
// FIXME: mc146818 inverts the normal irq state convention
|
||||
DECLARE_WRITE_LINE_MEMBER(ir9_w) { set_int_line(INT_HARD_EX, IRQ_RTC, !state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir9_w) { set_int_line(INT_HARD_EX, IRQ_RTC, state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir10_w) { set_int_line(INT_HARD_EX, IRQ_60HZ, state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir11_w) { set_int_line(INT_HARD_EX, IRQ_SERIAL, state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(ir12_w) { set_int_line(INT_HARD_EX, IRQ_ETHERNET, state); }
|
||||
|
Loading…
Reference in New Issue
Block a user