blob: 64da2fd601763f02f8c6fdfa4354c7c5f1a3f270 [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
6typedef void (*qemu_irq_handler)(void *opaque, int n, int level);
pbrookd537cf62007-04-07 18:14:41 +00007
8void qemu_set_irq(qemu_irq irq, int level);
9
10static inline void qemu_irq_raise(qemu_irq irq)
11{
12 qemu_set_irq(irq, 1);
13}
14
15static inline void qemu_irq_lower(qemu_irq irq)
16{
17 qemu_set_irq(irq, 0);
18}
19
balrog106627d2007-12-05 03:23:39 +000020static inline void qemu_irq_pulse(qemu_irq irq)
21{
22 qemu_set_irq(irq, 1);
23 qemu_set_irq(irq, 0);
24}
25
pbrookd537cf62007-04-07 18:14:41 +000026/* Returns an array of N IRQs. */
27qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n);
aliguori51bf9e72009-02-11 15:21:04 +000028void qemu_free_irqs(qemu_irq *s);
pbrookd537cf62007-04-07 18:14:41 +000029
balrogb50a6562007-10-29 10:59:29 +000030/* Returns a new IRQ with opposite polarity. */
31qemu_irq qemu_irq_invert(qemu_irq irq);
pbrook87ecb682007-11-17 17:14:51 +000032
Peter Maydell97932122011-02-21 20:57:52 +000033/* Returns a new IRQ which feeds into both the passed IRQs */
34qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
35
Avi Kivity22ec3282011-09-18 15:58:26 +030036/* Returns a new IRQ set which connects 1:1 to another IRQ set, which
37 * may be set later.
38 */
39qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
40
pbrook87ecb682007-11-17 17:14:51 +000041#endif