CHECKPATCH: Add --debug adv_apw
[qemu/ar7.git] / hw / arm_pic.c
blobffb4d4171a587249fa01acdc01ee06765a7b7a4b
1 /*
2 * Generic ARM Programmable Interrupt Controller support.
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licensed under the LGPL
8 */
10 #include "hw.h"
11 #include "arm-misc.h"
13 /* Input 0 is IRQ and input 1 is FIQ. */
14 static void arm_pic_cpu_handler(void *opaque, int irq, int level)
16 ARMCPU *cpu = opaque;
17 CPUARMState *env = &cpu->env;
19 switch (irq) {
20 case ARM_PIC_CPU_IRQ:
21 if (level)
22 cpu_interrupt(env, CPU_INTERRUPT_HARD);
23 else
24 cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
25 break;
26 case ARM_PIC_CPU_FIQ:
27 if (level)
28 cpu_interrupt(env, CPU_INTERRUPT_FIQ);
29 else
30 cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
31 break;
32 default:
33 hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
37 qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
39 return qemu_allocate_irqs(arm_pic_cpu_handler, cpu, 2);