- implementation of the edge triggered IRQ mode

- new functions raise_irq() and lower_irq()
- all trigger_irq() / untrigger_irq() calls are replaced by the new functions
- REMARK: timer IRQ handling is not correct but it works
- TODO: IOAPIC IRQ handling needs to be changed
This commit is contained in:
Volker Ruppert 2002-01-29 17:20:12 +00:00
parent 2933948216
commit ad072e2bc6
11 changed files with 114 additions and 83 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cmos.cc,v 1.15 2002-01-26 10:00:08 vruppert Exp $
// $Id: cmos.cc,v 1.16 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -62,7 +62,7 @@ bx_cmos_c::~bx_cmos_c(void)
bx_cmos_c::init(bx_devices_c *d)
{
unsigned i;
BX_DEBUG(("Init $Id: cmos.cc,v 1.15 2002-01-26 10:00:08 vruppert Exp $"));
BX_DEBUG(("Init $Id: cmos.cc,v 1.16 2002-01-29 17:20:11 vruppert Exp $"));
// CMOS RAM & RTC
@ -251,7 +251,7 @@ bx_cmos_c::read(Bit32u address, unsigned io_len)
// all bits of Register C are cleared after a read occurs.
if (BX_CMOS_THIS s.cmos_mem_address == 0x0c) {
BX_CMOS_THIS s.reg[0x0c] = 0x00;
BX_CMOS_THIS devices->pic->untrigger_irq(8);
BX_CMOS_THIS devices->pic->lower_irq(8);
}
return(ret8);
break;
@ -513,7 +513,7 @@ bx_cmos_c::periodic_timer()
// update status register C
if (BX_CMOS_THIS s.reg[0x0b] & 0x40) {
BX_CMOS_THIS s.reg[0x0c] |= 0xc0; // Interrupt Request, Periodic Int
BX_CMOS_THIS devices->pic->trigger_irq(8);
BX_CMOS_THIS devices->pic->raise_irq(8);
}
}
@ -542,7 +542,7 @@ bx_cmos_c::one_second_timer()
// update status register C
if (BX_CMOS_THIS s.reg[0x0b] & 0x10) {
BX_CMOS_THIS s.reg[0x0c] |= 0x90; // Interrupt Request, Update Ended
BX_CMOS_THIS devices->pic->trigger_irq(8);
BX_CMOS_THIS devices->pic->raise_irq(8);
}
// compare CMOS user copy of time/date to alarm time/date here
@ -566,7 +566,7 @@ bx_cmos_c::one_second_timer()
}
if (alarm_match) {
BX_CMOS_THIS s.reg[0x0c] |= 0xa0; // Interrupt Request, Alarm Int
BX_CMOS_THIS devices->pic->trigger_irq(8);
BX_CMOS_THIS devices->pic->raise_irq(8);
}
}
}

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////
// $Id: devices.cc,v 1.19 2001-12-18 13:12:45 vruppert Exp $
// $Id: devices.cc,v 1.20 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
// Copyright (C) 2002 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
@ -105,7 +105,7 @@ bx_devices_c::~bx_devices_c(void)
void
bx_devices_c::init(BX_MEM_C *newmem)
{
BX_DEBUG(("Init $Id: devices.cc,v 1.19 2001-12-18 13:12:45 vruppert Exp $"));
BX_DEBUG(("Init $Id: devices.cc,v 1.20 2002-01-29 17:20:11 vruppert Exp $"));
mem = newmem;
// Start with all IO port address registered to unmapped handler
// MUST be called first
@ -301,18 +301,18 @@ bx_devices_c::timer()
#if (BX_USE_NEW_PIT==0)
if ( pit->periodic( TIMER_DELTA ) ) {
pic->trigger_irq(0);
// This is a hack to make the IRQ0 work
pic->lower_irq(0);
pic->raise_irq(0);
}
#endif
retval = keyboard->periodic( TIMER_DELTA );
if (retval & 0x01) {
if (bx_dbg.keyboard)
BX_INFO(("keyboard: interrupt(1)"));
pic->trigger_irq(1);
}
if (retval & 0x01)
pic->raise_irq(1);
if (retval & 0x02)
pic->trigger_irq(12);
pic->raise_irq(12);
#if BX_SUPPORT_APIC
// update local APIC timers

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.31 2002-01-27 21:56:53 vruppert Exp $
// $Id: floppy.cc,v 1.32 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -87,7 +87,7 @@ bx_floppy_ctrl_c::~bx_floppy_ctrl_c(void)
void
bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
{
BX_DEBUG(("Init $Id: floppy.cc,v 1.31 2002-01-27 21:56:53 vruppert Exp $"));
BX_DEBUG(("Init $Id: floppy.cc,v 1.32 2002-01-29 17:20:11 vruppert Exp $"));
BX_FD_THIS devices = d;
BX_FD_THIS devices->register_irq(6, "Floppy Drive");
@ -315,7 +315,7 @@ bx_floppy_ctrl_c::read(Bit32u address, unsigned io_len)
BX_FD_THIS s.result_index = 0;
BX_FD_THIS s.result[0] = value;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ;
BX_FD_THIS devices->pic->untrigger_irq(6);
BX_FD_THIS devices->pic->lower_irq(6);
BX_FD_THIS s.pending_irq = 0;
}
return(value);
@ -737,7 +737,7 @@ bx_floppy_ctrl_c::floppy_command(void)
// 4 result bytes are unused
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
return;
}
@ -753,7 +753,7 @@ bx_floppy_ctrl_c::floppy_command(void)
// 4 result bytes are unused
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
return;
}
@ -821,7 +821,7 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
return;
}
@ -845,7 +845,7 @@ bx_floppy_ctrl_c::floppy_command(void)
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
return;
}
@ -1036,7 +1036,7 @@ bx_floppy_ctrl_c::timer()
/* write ready, not busy */
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | (1 << drive);
BX_FD_THIS s.status_reg0 = 0x20 | drive;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
goto reset_changeline;
break;
@ -1046,7 +1046,7 @@ bx_floppy_ctrl_c::timer()
/* write ready, not busy */
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | (1 << drive);
BX_FD_THIS s.status_reg0 = 0x20 | drive;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
goto reset_changeline;
break;
@ -1057,7 +1057,7 @@ bx_floppy_ctrl_c::timer()
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO;
BX_FD_THIS s.status_reg0 = 0x20 | drive;
BX_FD_THIS s.result[0] = BX_FD_THIS s.status_reg0;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
break;
@ -1069,7 +1069,7 @@ bx_floppy_ctrl_c::timer()
/* read ready, busy */
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY | (1 << drive);
BX_FD_THIS s.status_reg0 = 0x20 | drive;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
break;
@ -1077,7 +1077,7 @@ bx_floppy_ctrl_c::timer()
reset(BX_RESET_SOFTWARE);
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.status_reg0 = 0xc0;
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
break;
@ -1132,7 +1132,7 @@ bx_floppy_ctrl_c::dma_write(Bit8u *data_byte)
BX_INFO((" sector = %u", (unsigned) BX_FD_THIS s.sector[drive]));
}
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
bx_pc_system.set_DRQ(FLOPPY_DMA_CHAN, 0);
}
else { // more data to transfer
@ -1198,7 +1198,7 @@ bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
BX_FD_THIS s.result[1] = BX_FD_THIS s.status_reg1;
BX_FD_THIS s.result[2] = BX_FD_THIS s.status_reg2;
// 4 result bytes are unused
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
BX_FD_THIS s.pending_irq = 1;
bx_pc_system.set_DRQ(FLOPPY_DMA_CHAN, 0);
}
@ -1229,7 +1229,7 @@ bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
BX_FD_THIS s.pending_command = 0;
BX_FD_THIS s.main_status_reg = FD_MS_MRQ | FD_MS_DIO | FD_MS_BUSY | (1 << drive);
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
return;
}
floppy_xfer(drive, logical_sector*512, BX_FD_THIS s.floppy_buffer,
@ -1258,7 +1258,7 @@ bx_floppy_ctrl_c::dma_read(Bit8u *data_byte)
BX_INFO((" sector = %u", (unsigned) BX_FD_THIS s.sector[drive]));
}
BX_FD_THIS devices->pic->trigger_irq(6);
BX_FD_THIS devices->pic->raise_irq(6);
bx_pc_system.set_DRQ(FLOPPY_DMA_CHAN, 0);
}
else { // more data to transfer

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.44 2002-01-27 21:58:41 vruppert Exp $
// $Id: harddrv.cc,v 1.45 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -128,7 +128,7 @@ bx_hard_drive_c::~bx_hard_drive_c(void)
bx_hard_drive_c::init(bx_devices_c *d, bx_cmos_c *cmos)
{
BX_HD_THIS devices = d;
BX_DEBUG(("Init $Id: harddrv.cc,v 1.44 2002-01-27 21:58:41 vruppert Exp $"));
BX_DEBUG(("Init $Id: harddrv.cc,v 1.45 2002-01-29 17:20:11 vruppert Exp $"));
/* HARD DRIVE 0 */
@ -733,7 +733,7 @@ bx_hard_drive_c::read(Bit32u address, unsigned io_len)
BX_SELECTED_CONTROLLER.status.index_pulse_count = 0;
}
}
if (address == 0x1f7) BX_HD_THIS devices->pic->untrigger_irq(14);
if (address == 0x1f7) BX_HD_THIS devices->pic->lower_irq(14);
goto return_value8;
break;
@ -2579,7 +2579,7 @@ bx_hard_drive_c::raise_interrupt()
Bit32u irq = 14; // always 1st IDE controller
// for second controller, you would want irq 15
BX_DEBUG(("Raising interrupt %d {%s}", irq, DEVICE_TYPE_STRING));
BX_HD_THIS devices->pic->trigger_irq(irq);
BX_HD_THIS devices->pic->raise_irq(irq);
} else {
if (bx_dbg.disk || (CDROM_SELECTED && bx_dbg.cdrom))
BX_INFO(("Interrupt masked {%s}", DEVICE_TYPE_STRING));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.cc,v 1.43 2002-01-27 00:41:38 vruppert Exp $
// $Id: keyboard.cc,v 1.44 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -70,7 +70,7 @@ bx_keyb_c::bx_keyb_c(void)
memset( &s, 0, sizeof(s) );
BX_KEY_THIS put("KBD");
BX_KEY_THIS settype(KBDLOG);
BX_DEBUG(("Init $Id: keyboard.cc,v 1.43 2002-01-27 00:41:38 vruppert Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.44 2002-01-29 17:20:11 vruppert Exp $"));
}
bx_keyb_c::~bx_keyb_c(void)
@ -110,7 +110,7 @@ bx_keyb_c::resetinternals(Boolean powerup)
void
bx_keyb_c::init(bx_devices_c *d, bx_cmos_c *cmos)
{
BX_DEBUG(("Init $Id: keyboard.cc,v 1.43 2002-01-27 00:41:38 vruppert Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.44 2002-01-29 17:20:11 vruppert Exp $"));
Bit32u i;
BX_KEY_THIS devices = d;
@ -295,8 +295,8 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
(BX_KEY_THIS s.kbd_controller.sysf << 2) |
(BX_KEY_THIS s.kbd_controller.inpb << 1) |
BX_KEY_THIS s.kbd_controller.outb;
BX_KEY_THIS devices->pic->untrigger_irq(1);
BX_KEY_THIS devices->pic->untrigger_irq(12);
BX_KEY_THIS devices->pic->lower_irq(1);
BX_KEY_THIS devices->pic->lower_irq(12);
RETURN(val);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: ne2k.cc,v 1.28 2002-01-25 20:31:00 vruppert Exp $
// $Id: ne2k.cc,v 1.29 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -41,7 +41,7 @@ bx_ne2k_c::bx_ne2k_c(void)
{
put("NE2K");
settype(NE2KLOG);
BX_DEBUG(("Init $Id: ne2k.cc,v 1.28 2002-01-25 20:31:00 vruppert Exp $"));
BX_DEBUG(("Init $Id: ne2k.cc,v 1.29 2002-01-29 17:20:11 vruppert Exp $"));
// nothing for now
}
@ -207,7 +207,7 @@ bx_ne2k_c::write_cr(Bit32u value)
BX_NE2K_THIS s.remote_bytes == 0) {
BX_NE2K_THIS s.ISR.rdma_done = 1;
if (BX_NE2K_THIS s.IMR.rdma_inte) {
BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->raise_irq(BX_NE2K_THIS s.base_irq);
}
}
}
@ -306,7 +306,7 @@ bx_ne2k_c::asic_read(Bit32u offset, unsigned int io_len)
if (BX_NE2K_THIS s.remote_bytes == 0) {
BX_NE2K_THIS s.ISR.rdma_done = 1;
if (BX_NE2K_THIS s.IMR.rdma_inte) {
BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->raise_irq(BX_NE2K_THIS s.base_irq);
}
}
break;
@ -349,7 +349,7 @@ bx_ne2k_c::asic_write(Bit32u offset, Bit32u value, unsigned io_len)
if (BX_NE2K_THIS s.remote_bytes == 0) {
BX_NE2K_THIS s.ISR.rdma_done = 1;
if (BX_NE2K_THIS s.IMR.rdma_inte) {
BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->raise_irq(BX_NE2K_THIS s.base_irq);
}
}
break;
@ -546,7 +546,7 @@ bx_ne2k_c::page0_write(Bit32u offset, Bit32u value, unsigned io_len)
(BX_NE2K_THIS s.IMR.tx_inte << 1) |
(BX_NE2K_THIS s.IMR.rx_inte));
if (value == 0)
BX_NE2K_THIS devices->pic->untrigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->lower_irq(BX_NE2K_THIS s.base_irq);
break;
case 0x8: // RSAR0
@ -947,7 +947,7 @@ bx_ne2k_c::tx_timer(void)
// Generate an interrupt if not masked and not one in progress
if (BX_NE2K_THIS s.IMR.tx_inte && !BX_NE2K_THIS s.ISR.pkt_tx) {
BX_NE2K_THIS s.ISR.pkt_tx = 1;
BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->raise_irq(BX_NE2K_THIS s.base_irq);
}
BX_NE2K_THIS s.tx_timer_active = 0;
}
@ -1226,7 +1226,7 @@ bx_ne2k_c::rx_frame(const void *buf, unsigned io_len)
BX_NE2K_THIS s.ISR.pkt_rx = 1;
if (BX_NE2K_THIS s.IMR.rx_inte) {
BX_NE2K_THIS devices->pic->trigger_irq(BX_NE2K_THIS s.base_irq);
BX_NE2K_THIS devices->pic->raise_irq(BX_NE2K_THIS s.base_irq);
}
}
@ -1234,7 +1234,7 @@ bx_ne2k_c::rx_frame(const void *buf, unsigned io_len)
void
bx_ne2k_c::init(bx_devices_c *d)
{
BX_DEBUG(("Init $Id: ne2k.cc,v 1.28 2002-01-25 20:31:00 vruppert Exp $"));
BX_DEBUG(("Init $Id: ne2k.cc,v 1.29 2002-01-29 17:20:11 vruppert Exp $"));
BX_NE2K_THIS devices = d;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: parallel.cc,v 1.16 2002-01-18 16:33:07 vruppert Exp $
// $Id: parallel.cc,v 1.17 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -58,7 +58,7 @@ bx_parallel_c::~bx_parallel_c(void)
void
bx_parallel_c::init(bx_devices_c *d)
{
BX_DEBUG(("Init $Id: parallel.cc,v 1.16 2002-01-18 16:33:07 vruppert Exp $"));
BX_DEBUG(("Init $Id: parallel.cc,v 1.17 2002-01-29 17:20:11 vruppert Exp $"));
BX_PAR_THIS devices = d;
/* PARALLEL PORT 1 */
@ -104,7 +104,7 @@ bx_parallel_c::virtual_printer(void)
fflush (OUTPUT);
}
if (BX_PAR_THIS s.CONTROL.irq == 1) {
BX_PAR_THIS devices->pic->trigger_irq(7);
BX_PAR_THIS devices->pic->raise_irq(7);
}
BX_PAR_THIS s.STATUS.ack = 0;
BX_PAR_THIS s.STATUS.busy = 1;
@ -157,7 +157,7 @@ bx_parallel_c::read(Bit32u address, unsigned io_len)
if (BX_PAR_THIS s.STATUS.ack == 0) {
BX_PAR_THIS s.STATUS.ack = 1;
if (BX_PAR_THIS s.CONTROL.irq == 1) {
BX_PAR_THIS devices->pic->untrigger_irq(7);
BX_PAR_THIS devices->pic->lower_irq(7);
}
}
if (BX_PAR_THIS initmode == 1) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pic.cc,v 1.19 2002-01-26 12:03:55 vruppert Exp $
// $Id: pic.cc,v 1.20 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -520,21 +520,49 @@ bx_pic_c::write(Bit32u address, Bit32u value, unsigned io_len)
return;
}
// new IRQ signal handling routines (under construction)
// new IRQ signal handling routines
void
bx_pic_c::lower_irq(unsigned irq_no)
{
UNUSED(irq_no);
if ((irq_no <= 7) && (BX_PIC_THIS s.master_pic.IRQ_line[irq_no])) {
BX_DEBUG(("IRQ line %d now low", (unsigned) irq_no));
BX_PIC_THIS s.master_pic.IRQ_line[irq_no] = 0;
BX_PIC_THIS s.master_pic.irr &= ~(1 << irq_no);
if ((BX_PIC_THIS s.master_pic.irr & ~BX_PIC_THIS s.master_pic.imr) == 0) {
BX_SET_INTR(0);
BX_PIC_THIS s.master_pic.INT = 0;
}
} else if ((irq_no > 7) && (irq_no <= 15) &&
(BX_PIC_THIS s.slave_pic.IRQ_line[irq_no-8])) {
BX_DEBUG(("IRQ line %d now low", (unsigned) irq_no));
BX_PIC_THIS s.slave_pic.IRQ_line[irq_no - 8] = 0;
BX_PIC_THIS s.slave_pic.irr &= ~(1 << (irq_no - 8));
if ((BX_PIC_THIS s.slave_pic.irr & ~BX_PIC_THIS s.slave_pic.imr) == 0) {
BX_PIC_THIS s.slave_pic.INT = 0;
lower_irq(2);
}
}
}
void
bx_pic_c::raise_irq(unsigned irq_no)
{
UNUSED(irq_no);
if ((irq_no <= 7) && (!BX_PIC_THIS s.master_pic.IRQ_line[irq_no])) {
BX_DEBUG(("IRQ line %d now high", (unsigned) irq_no));
BX_PIC_THIS s.master_pic.IRQ_line[irq_no] = 1;
BX_PIC_THIS s.master_pic.irr |= (1 << irq_no);
service_master_pic();
} else if ((irq_no > 7) && (irq_no <= 15) &&
(!BX_PIC_THIS s.slave_pic.IRQ_line[irq_no-8])) {
BX_DEBUG(("IRQ line %d now high", (unsigned) irq_no));
BX_PIC_THIS s.slave_pic.IRQ_line[irq_no - 8] = 1;
BX_PIC_THIS s.slave_pic.irr |= (1 << (irq_no - 8));
service_slave_pic();
}
}
// current IRQ handling routines
// old IRQ handling routines (unused)
void
bx_pic_c::trigger_irq(unsigned irq_no)
@ -695,9 +723,8 @@ bx_pic_c::service_slave_pic(void)
BX_DEBUG(("slave: signalling IRQ(%u)",
(unsigned) 8 + irq));
BX_PIC_THIS s.slave_pic.INT = 1;
BX_PIC_THIS s.master_pic.irr |= 0x04; /* request IRQ 2 on master pic */
raise_irq(2); /* request IRQ 2 on master pic */
BX_PIC_THIS s.slave_pic.irq = irq;
service_master_pic();
return;
} /* if (unmasked_requests & ... */
} /* for (irq=7 ... */
@ -723,6 +750,7 @@ bx_pic_c::IAC(void)
}
else { /* IRQ2 = slave pic IRQ8..15 */
BX_PIC_THIS s.slave_pic.INT = 0;
BX_PIC_THIS s.master_pic.IRQ_line[2] = 0;
irq = BX_PIC_THIS s.slave_pic.irq;
vector = irq + BX_PIC_THIS s.slave_pic.interrupt_offset;
BX_PIC_THIS s.slave_pic.isr |= (1 << BX_PIC_THIS s.slave_pic.irq);

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pit_wrap.cc,v 1.10 2001-10-11 13:01:27 yakovlev Exp $
// $Id: pit_wrap.cc,v 1.11 2002-01-29 17:20:11 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
// Copyright (C) 2002 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
@ -131,7 +131,9 @@ bx_pit_c::handle_timer() {
BX_DEBUG(("pit: entering timer handler"));
if(time_passed32 && periodic(time_passed32)) {
bx_pic.trigger_irq(0);
// This is a hack to make the IRQ0 work
bx_pic.lower_irq(0);
bx_pic.raise_irq(0);
}
BX_PIT_THIS s.last_usec=BX_PIT_THIS s.last_usec + time_passed;
if(time_passed ||
@ -243,7 +245,9 @@ bx_pit_c::write( Bit32u address, Bit32u dvalue,
BX_DEBUG(("pit: entering write handler"));
if(time_passed32 && periodic(time_passed32)) {
bx_pic.trigger_irq(0);
// This is a hack to make the IRQ0 work
bx_pic.lower_irq(0);
bx_pic.raise_irq(0);
}
BX_PIT_THIS s.last_usec=BX_PIT_THIS s.last_usec + time_passed;
@ -347,7 +351,6 @@ bx_kbd_port61h_write(Bit8u value)
Boolean
bx_pit_c::periodic( Bit32u usec_delta )
{
Bit32u i=0;
Boolean prev_timer0_out = BX_PIT_THIS s.timer.read_OUT(0);
Boolean want_interrupt = 0;
Bit32u ticks_delta=(Bit32u)(USEC_TO_TICKS((Bit64u)(usec_delta)));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sb16.cc,v 1.17 2002-01-25 20:31:42 vruppert Exp $
// $Id: sb16.cc,v 1.18 2002-01-29 17:20:12 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -321,7 +321,7 @@ void bx_sb16_c::dsp_reset(Bit32u value)
if (DSP.irqpending != 0)
{
BX_SB16_THIS devices->pic->untrigger_irq(BX_SB16_IRQ);
BX_SB16_THIS devices->pic->lower_irq(BX_SB16_IRQ);
writelog(WAVELOG(4), "DSP reset: IRQ untriggered");
}
if (DSP.dma.mode != 0)
@ -855,7 +855,7 @@ void bx_sb16_c::dsp_datawrite(Bit32u value)
DSP.dataout.put(0xaa);
DSP.irqpending = 1;
MIXER.reg[0x82] |= 1; // reg 82 shows the kind of IRQ
BX_SB16_THIS devices->pic->trigger_irq(BX_SB16_IRQ);
BX_SB16_THIS devices->pic->raise_irq(BX_SB16_IRQ);
break;
// unknown command
@ -997,7 +997,7 @@ Bit32u bx_sb16_c::dsp_status()
writelog( WAVELOG(4), "8-bit DMA or SBMIDI IRQ acknowledged");
if (MIXER.reg[0x82] == 0) {
DSP.irqpending = 0;
BX_SB16_THIS devices->pic->untrigger_irq(BX_SB16_IRQ);
BX_SB16_THIS devices->pic->lower_irq(BX_SB16_IRQ);
}
}
@ -1020,7 +1020,7 @@ Bit32u bx_sb16_c::dsp_irq16ack()
MIXER.reg[0x82] &= (~0x02);
if (MIXER.reg[0x82] == 0) {
DSP.irqpending = 0;
BX_SB16_THIS devices->pic->untrigger_irq(BX_SB16_IRQ);
BX_SB16_THIS devices->pic->lower_irq(BX_SB16_IRQ);
}
writelog( WAVELOG(4), "16-bit DMA IRQ acknowledged");
}
@ -1145,7 +1145,7 @@ void bx_sb16_c::dsp_dmadone()
else
MIXER.reg[0x82] |= 2;
BX_SB16_THIS devices->pic->trigger_irq(BX_SB16_IRQ);
BX_SB16_THIS devices->pic->raise_irq(BX_SB16_IRQ);
DSP.irqpending = 1;
//if auto-DMA, reinitialize
@ -1430,7 +1430,7 @@ void bx_sb16_c::mpu_command(Bit32u value)
if (BX_SB16_IRQMPU != -1)
{
MIXER.reg[0x82] |= 4;
BX_SB16_THIS devices->pic->trigger_irq(BX_SB16_IRQMPU);
BX_SB16_THIS devices->pic->raise_irq(BX_SB16_IRQMPU);
}
break;
@ -1493,7 +1493,7 @@ Bit32u bx_sb16_c::mpu_dataread()
MPU.irqpending = 0;
MIXER.reg[0x82] &= (~4);
if (MIXER.reg[0x82] == 0)
BX_SB16_THIS devices->pic->untrigger_irq(BX_SB16_IRQMPU);
BX_SB16_THIS devices->pic->lower_irq(BX_SB16_IRQMPU);
writelog(MIDILOG(4), "MPU IRQ acknowledged");
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: serial.cc,v 1.16 2002-01-20 16:35:32 vruppert Exp $
// $Id: serial.cc,v 1.17 2002-01-29 17:20:12 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -272,7 +272,7 @@ bx_serial_c::read(Bit32u address, unsigned io_len)
if ((BX_SER_THIS s[0].tx_interrupt == 0) &&
(BX_SER_THIS s[0].ls_interrupt == 0) &&
(BX_SER_THIS s[0].ms_interrupt == 0)) {
BX_SER_THIS devices->pic->untrigger_irq(4);
BX_SER_THIS devices->pic->lower_irq(4);
}
BX_SER_THIS s[0].rx_interrupt = 0;
BX_SER_THIS s[0].rx_ipending = 0;
@ -315,7 +315,7 @@ bx_serial_c::read(Bit32u address, unsigned io_len)
if ((BX_SER_THIS s[0].rx_interrupt == 0) &&
(BX_SER_THIS s[0].ls_interrupt == 0) &&
(BX_SER_THIS s[0].ms_interrupt == 0)) {
BX_SER_THIS devices->pic->untrigger_irq(4);
BX_SER_THIS devices->pic->lower_irq(4);
}
BX_SER_THIS s[0].tx_interrupt = 0;
@ -359,7 +359,7 @@ bx_serial_c::read(Bit32u address, unsigned io_len)
if ((BX_SER_THIS s[0].rx_interrupt == 0) &&
(BX_SER_THIS s[0].tx_interrupt == 0) &&
(BX_SER_THIS s[0].ms_interrupt == 0)) {
BX_SER_THIS devices->pic->untrigger_irq(4);
BX_SER_THIS devices->pic->lower_irq(4);
}
BX_SER_THIS s[0].ls_interrupt = 0;
BX_SER_THIS s[0].ls_ipending = 0;
@ -382,7 +382,7 @@ bx_serial_c::read(Bit32u address, unsigned io_len)
if ((BX_SER_THIS s[0].rx_interrupt == 0) &&
(BX_SER_THIS s[0].tx_interrupt == 0) &&
(BX_SER_THIS s[0].ls_interrupt == 0)) {
BX_SER_THIS devices->pic->untrigger_irq(4);
BX_SER_THIS devices->pic->lower_irq(4);
}
BX_SER_THIS s[0].ms_interrupt = 0;
BX_SER_THIS s[0].ms_ipending = 0;
@ -459,7 +459,7 @@ bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
if ((BX_SER_THIS s[0].rx_interrupt == 0) &&
(BX_SER_THIS s[0].ls_interrupt == 0) &&
(BX_SER_THIS s[0].ms_interrupt == 0)) {
BX_SER_THIS devices->pic->untrigger_irq(4);
BX_SER_THIS devices->pic->lower_irq(4);
}
BX_SER_THIS s[0].tx_interrupt = 0;
BX_SER_THIS s[0].tx_ipending = 0;
@ -516,7 +516,7 @@ bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
}
}
if (gen_int == 1)
BX_SER_THIS devices->pic->trigger_irq(4);
BX_SER_THIS devices->pic->raise_irq(4);
}
break;
@ -708,7 +708,7 @@ bx_serial_c::tx_timer(void)
}
if (gen_int) {
BX_SER_THIS devices->pic->trigger_irq(4);
BX_SER_THIS devices->pic->raise_irq(4);
}
}
@ -777,7 +777,7 @@ bx_serial_c::rx_timer(void)
BX_SER_THIS s[0].rx_empty = 0;
if (BX_SER_THIS s[0].int_enable.rxdata_enable) {
BX_SER_THIS s[0].rx_interrupt = 1;
BX_SER_THIS devices->pic->trigger_irq(4);
BX_SER_THIS devices->pic->raise_irq(4);
} else {
BX_SER_THIS s[0].rx_ipending = 1;
}