mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
Unify IRQ handling.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2635 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
b6e27ab8b1
commit
d537cf6c86
71 changed files with 592 additions and 624 deletions
43
hw/arm_pic.c
43
hw/arm_pic.c
|
@ -11,11 +11,6 @@
|
|||
#include "arm_pic.h"
|
||||
|
||||
/* Stub functions for hardware that doesn't exist. */
|
||||
void pic_set_irq(int irq, int level)
|
||||
{
|
||||
cpu_abort(cpu_single_env, "pic_set_irq");
|
||||
}
|
||||
|
||||
void pic_info(void)
|
||||
{
|
||||
}
|
||||
|
@ -25,49 +20,29 @@ void irq_info(void)
|
|||
}
|
||||
|
||||
|
||||
void pic_set_irq_new(void *opaque, int irq, int level)
|
||||
{
|
||||
arm_pic_handler *p = (arm_pic_handler *)opaque;
|
||||
/* Call the real handler. */
|
||||
(*p)(opaque, irq, level);
|
||||
}
|
||||
|
||||
/* Model the IRQ/FIQ CPU interrupt lines as a two input interrupt controller.
|
||||
Input 0 is IRQ and input 1 is FIQ. */
|
||||
typedef struct
|
||||
{
|
||||
arm_pic_handler handler;
|
||||
CPUState *cpu_env;
|
||||
} arm_pic_cpu_state;
|
||||
|
||||
/* Input 0 is IRQ and input 1 is FIQ. */
|
||||
static void arm_pic_cpu_handler(void *opaque, int irq, int level)
|
||||
{
|
||||
arm_pic_cpu_state *s = (arm_pic_cpu_state *)opaque;
|
||||
CPUState *env = (CPUState *)opaque;
|
||||
switch (irq) {
|
||||
case ARM_PIC_CPU_IRQ:
|
||||
if (level)
|
||||
cpu_interrupt(s->cpu_env, CPU_INTERRUPT_HARD);
|
||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||
else
|
||||
cpu_reset_interrupt(s->cpu_env, CPU_INTERRUPT_HARD);
|
||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
||||
break;
|
||||
case ARM_PIC_CPU_FIQ:
|
||||
if (level)
|
||||
cpu_interrupt(s->cpu_env, CPU_INTERRUPT_FIQ);
|
||||
cpu_interrupt(env, CPU_INTERRUPT_FIQ);
|
||||
else
|
||||
cpu_reset_interrupt(s->cpu_env, CPU_INTERRUPT_FIQ);
|
||||
cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
|
||||
break;
|
||||
default:
|
||||
cpu_abort(s->cpu_env, "arm_pic_cpu_handler: Bad interrput line %d\n",
|
||||
irq);
|
||||
cpu_abort(env, "arm_pic_cpu_handler: Bad interrput line %d\n", irq);
|
||||
}
|
||||
}
|
||||
|
||||
void *arm_pic_init_cpu(CPUState *env)
|
||||
qemu_irq *arm_pic_init_cpu(CPUState *env)
|
||||
{
|
||||
arm_pic_cpu_state *s;
|
||||
|
||||
s = (arm_pic_cpu_state *)malloc(sizeof(arm_pic_cpu_state));
|
||||
s->handler = arm_pic_cpu_handler;
|
||||
s->cpu_env = env;
|
||||
return s;
|
||||
return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue