diff --git a/src/CxbxKrnl/EmuNV2A.cpp b/src/CxbxKrnl/EmuNV2A.cpp index 47f8d580d..0327926a1 100644 --- a/src/CxbxKrnl/EmuNV2A.cpp +++ b/src/CxbxKrnl/EmuNV2A.cpp @@ -90,6 +90,11 @@ struct { uint32_t video_clock_coeff; } pramdac; +struct { + uint32_t pending_interrupts; + uint32_t enabled_interrupts; +} pgraph; + static void update_irq() { /* PFIFO */ @@ -99,20 +104,39 @@ static void update_irq() else { pmc.pending_interrupts &= ~NV_PMC_INTR_0_PFIFO; } + + /* PCRTC */ if (pcrtc.pending_interrupts & pcrtc.enabled_interrupts) { pmc.pending_interrupts |= NV_PMC_INTR_0_PCRTC; } else { pmc.pending_interrupts &= ~NV_PMC_INTR_0_PCRTC; } - /* TODO PGRAPH */ - /* + + /* PGRAPH */ if (pgraph.pending_interrupts & pgraph.enabled_interrupts) { pmc.pending_interrupts |= NV_PMC_INTR_0_PGRAPH; } else { pmc.pending_interrupts &= ~NV_PMC_INTR_0_PGRAPH; + } + + /* TODO : PBUS * / + if (pbus.pending_interrupts & pbus.enabled_interrupts) { + pmc.pending_interrupts |= NV_PMC_INTR_0_PBUS; + } + else { + pmc.pending_interrupts &= ~NV_PMC_INTR_0_PBUS; } */ + + /* TODO : SOFTWARE * / + if (user.pending_interrupts & user.enabled_interrupts) { + pmc.pending_interrupts |= NV_PMC_INTR_0_SOFTWARE; + } + else { + pmc.pending_interrupts &= ~NV_PMC_INTR_0_SOFTWARE; + } */ + if (pmc.pending_interrupts && pmc.enabled_interrupts) { // TODO Raise IRQ EmuWarning("EmuNV2A: update_irq : Raise IRQ Not Implemented"); @@ -713,6 +737,14 @@ DEVICE_READ32(PGRAPH) DEVICE_WRITE32(PGRAPH) { DEVICE_WRITE32_SWITCH(PGRAPH, addr) { + case NV_PGRAPH_INTR: + pgraph.pending_interrupts &= ~value; + update_irq(); + break; + case NV_PGRAPH_INTR_EN: + pgraph.enabled_interrupts = value; + update_irq(); + break; default: DEBUG_WRITE32_UNHANDLED(PGRAPH); } diff --git a/src/CxbxKrnl/device.cpp b/src/CxbxKrnl/device.cpp index 9c1e94dea..36c383b75 100644 --- a/src/CxbxKrnl/device.cpp +++ b/src/CxbxKrnl/device.cpp @@ -122,13 +122,13 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_execute->device().tag(), m_linen // if we're full of events, flush the queue and log a message int event_index = m_qindex++; -/* + if (event_index >= ARRAY_LENGTH(m_queue)) { m_qindex--; - empty_event_queue(nullptr,0); +// empty_event_queue(nullptr,0); event_index = m_qindex++; - m_execute->device().logerror("Exceeded pending input line event queue on device '%s'!\n", m_execute->device().tag()); +// m_execute->device().logerror("Exceeded pending input line event queue on device '%s'!\n", m_execute->device().tag()); } // enqueue the event @@ -140,8 +140,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_execute->device().tag(), m_linen // if this is the first one, set the timer if (event_index == 0) - m_execute->scheduler().synchronize(timer_expired_delegate(FUNC(device_execute_interface::device_input::empty_event_queue),this), 0, this); +;// m_execute->scheduler().synchronize(timer_expired_delegate(FUNC(device_execute_interface::device_input::empty_event_queue),this), 0, this); } -*/ } diff --git a/src/CxbxKrnl/device.h b/src/CxbxKrnl/device.h index ed00ca653..dfb65b07b 100644 --- a/src/CxbxKrnl/device.h +++ b/src/CxbxKrnl/device.h @@ -142,7 +142,7 @@ protected: void set_vector(int vector) { m_stored_vector = vector; } int default_irq_callback(); - //device_execute_interface *m_execute;// pointer to the execute interface +// device_execute_interface *m_execute;// pointer to the execute interface int m_linenum; // which input line we are int32_t m_stored_vector; // most recently written vector @@ -152,11 +152,11 @@ protected: int m_qindex; // index within the queue private: - //TIMER_CALLBACK_MEMBER(empty_event_queue); +// TIMER_CALLBACK_MEMBER(empty_event_queue); }; // input states and IRQ callbacks - //device_irq_acknowledge_delegate m_driver_irq; // driver-specific IRQ callback +// device_irq_acknowledge_delegate m_driver_irq; // driver-specific IRQ callback device_input m_input[MAX_INPUT_LINES]; // data about inputs };