mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
hw: Move declaration of IRQState to header and add init function
To allow embedding a qemu_irq in a struct move its definition to the header and add a function to init it in place without allocating it. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Message-Id: <e3ffd0f6ef8845d0f7247c9b6ff33f7ee8b432cf.1719690591.git.balaton@eik.bme.hu> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
This commit is contained in:
parent
2688e8df60
commit
e72a7f65c1
2 changed files with 29 additions and 14 deletions
|
@ -1,9 +1,20 @@
|
|||
#ifndef QEMU_IRQ_H
|
||||
#define QEMU_IRQ_H
|
||||
|
||||
#include "qom/object.h"
|
||||
|
||||
/* Generic IRQ/GPIO pin infrastructure. */
|
||||
|
||||
#define TYPE_IRQ "irq"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ)
|
||||
|
||||
struct IRQState {
|
||||
Object parent_obj;
|
||||
|
||||
qemu_irq_handler handler;
|
||||
void *opaque;
|
||||
int n;
|
||||
};
|
||||
|
||||
void qemu_set_irq(qemu_irq irq, int level);
|
||||
|
||||
|
@ -23,6 +34,13 @@ static inline void qemu_irq_pulse(qemu_irq irq)
|
|||
qemu_set_irq(irq, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Init a single IRQ. The irq is assigned with a handler, an opaque data
|
||||
* and the interrupt number.
|
||||
*/
|
||||
void qemu_init_irq(IRQState *irq, qemu_irq_handler handler, void *opaque,
|
||||
int n);
|
||||
|
||||
/* Returns an array of N IRQs. Each IRQ is assigned the argument handler and
|
||||
* opaque data.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue