target-i386: Add API to get note's size
[qemu/ar7.git] / hw / arm_pic.c
blob109496528cc64dabe826d4ec884c9f038c3b1843
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 CPUARMState *env = (CPUARMState *)opaque;
17 switch (irq) {
18 case ARM_PIC_CPU_IRQ:
19 if (level)
20 cpu_interrupt(env, CPU_INTERRUPT_HARD);
21 else
22 cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
23 break;
24 case ARM_PIC_CPU_FIQ:
25 if (level)
26 cpu_interrupt(env, CPU_INTERRUPT_FIQ);
27 else
28 cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
29 break;
30 default:
31 hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
35 qemu_irq *arm_pic_init_cpu(CPUARMState *env)
37 return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);