pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 1 | #ifndef QEMU_IRQ_H |
| 2 | #define QEMU_IRQ_H |
| 3 | |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 4 | /* Generic IRQ/GPIO pin infrastructure. */ |
| 5 | |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 6 | /* FIXME: Rmove one of these. */ |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 7 | typedef void (*qemu_irq_handler)(void *opaque, int n, int level); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 8 | typedef void SetIRQFunc(void *opaque, int irq_num, int level); |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 9 | |
| 10 | void qemu_set_irq(qemu_irq irq, int level); |
| 11 | |
| 12 | static inline void qemu_irq_raise(qemu_irq irq) |
| 13 | { |
| 14 | qemu_set_irq(irq, 1); |
| 15 | } |
| 16 | |
| 17 | static inline void qemu_irq_lower(qemu_irq irq) |
| 18 | { |
| 19 | qemu_set_irq(irq, 0); |
| 20 | } |
| 21 | |
balrog | 106627d | 2007-12-05 03:23:39 +0000 | [diff] [blame] | 22 | static inline void qemu_irq_pulse(qemu_irq irq) |
| 23 | { |
| 24 | qemu_set_irq(irq, 1); |
| 25 | qemu_set_irq(irq, 0); |
| 26 | } |
| 27 | |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 28 | /* Returns an array of N IRQs. */ |
| 29 | qemu_irq *qemu_allocate_irqs(qemu_irq_handler handler, void *opaque, int n); |
aliguori | 51bf9e7 | 2009-02-11 15:21:04 +0000 | [diff] [blame] | 30 | void qemu_free_irqs(qemu_irq *s); |
pbrook | d537cf6 | 2007-04-07 18:14:41 +0000 | [diff] [blame] | 31 | |
balrog | b50a656 | 2007-10-29 10:59:29 +0000 | [diff] [blame] | 32 | /* Returns a new IRQ with opposite polarity. */ |
| 33 | qemu_irq qemu_irq_invert(qemu_irq irq); |
pbrook | 87ecb68 | 2007-11-17 17:14:51 +0000 | [diff] [blame] | 34 | |
| 35 | #endif |