blob: 5daae449096a652739f8ff934c364ca5a7b4932d [file] [log] [blame]
pbrook87ecb682007-11-17 17:14:51 +00001#ifndef QEMU_IRQ_H
2#define QEMU_IRQ_H
3
pbrookd537cf62007-04-07 18:14:41 +00004/* Generic IRQ/GPIO pin infrastructure. */
5
pbrook87ecb682007-11-17 17:14:51 +00006/* FIXME: Rmove one of these. */
pbrookd537cf62007-04-07 18:14:41 +00007typedef void (*qemu_irq_handler)(void *opaque, int n, int level);
pbrook87ecb682007-11-17 17:14:51 +00008typedef void SetIRQFunc(void *opaque, int irq_num, int level);
pbrookd537cf62007-04-07 18:14:41 +00009
10void qemu_set_irq(qemu_irq irq, int level);
11
12static inline void qemu_irq_raise(qemu_irq irq)
13{
14 qemu_set_irq(irq, 1);
15}
16
17static inline void qemu_irq_lower(qemu_irq irq)
18{
19 qemu_set_irq(irq, 0);
20}
21
balrog106627d2007-12-05 03:23:39 +000022static inline void qemu_irq_pulse(qemu_irq irq)
23{
24 qemu_set_irq(irq, 1);
25 qemu_set_irq(irq, 0);
26}
27
pbrookd537cf62007-04-07 18:14:41 +000028/* Returns an array of N IRQs. */
29qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n);
aliguori51bf9e72009-02-11 15:21:04 +000030void qemu_free_irqs(qemu_irq *s);
pbrookd537cf62007-04-07 18:14:41 +000031
balrogb50a6562007-10-29 10:59:29 +000032/* Returns a new IRQ with opposite polarity. */
33qemu_irq qemu_irq_invert(qemu_irq irq);
pbrook87ecb682007-11-17 17:14:51 +000034
35#endif