aboutsummaryrefslogtreecommitdiffstats
path: root/z80irq.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-10-30 10:47:50 -0700
committerH. Peter Anvin <hpa@zytor.com>2018-10-30 10:47:50 -0700
commitd7f316b3c056e0c7021538d35a29e7f59b63aa32 (patch)
tree87d2899010fa98fe63938c5329caa8a92ad0964c /z80irq.h
parent64e32a88a18c3ff6790578a62249b40411c829d9 (diff)
downloadabc80sim-d7f316b3c056e0c7021538d35a29e7f59b63aa32.tar.gz
abc80sim-d7f316b3c056e0c7021538d35a29e7f59b63aa32.tar.xz
abc80sim-d7f316b3c056e0c7021538d35a29e7f59b63aa32.zip
irq: block specific interrupts until EOI received
Even if interrupts is enabled, the interrupting device will normally block interrupts until EOI is received; this is true for all actual Z80 series devices. If we ever have to deal with devices which don't, we can add a flag of some sort at that time (the only way this could happen on ABC80 or 800 is if an interrupt came from the external bus.)
Diffstat (limited to 'z80irq.h')
-rw-r--r--z80irq.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/z80irq.h b/z80irq.h
index f4f8c1e..74386b2 100644
--- a/z80irq.h
+++ b/z80irq.h
@@ -10,16 +10,22 @@ struct z80_irq {
irq_func intack;
irq_func eoi;
void *pvt; /* Available for user */
- int vector; /* Available for user if intack defined */
- unsigned int prio; /* Priority level */
+ int16_t vector; /* Available for user if intack defined */
+ uint8_t prio; /* Priority level */
+ bool handled; /* In handler (between INTACK and EOI) */
};
+#define IRQ(prio, intack, eoi, pvt) \
+ { (intack), (eoi), (pvt), -1, (prio), false }
+
#define MAX_IRQ 32
extern volatile unsigned int irq_pending;
+extern unsigned int irq_mask; /* 0 = inside handler (irq->handled == true) */
+
static inline bool poll_irq(void)
{
- return unlikely(irq_pending != 0);
+ return unlikely(irq_pending & irq_mask);
}
void z80_register_irq(struct z80_irq *irq);