root / hw / arm_pic.c @ be40edcd
History | View | Annotate | Download (944 Bytes)
1 |
/*
|
---|---|
2 |
* Generic ARM Programmable Interrupt Controller support.
|
3 |
*
|
4 |
* Copyright (c) 2006 CodeSourcery.
|
5 |
* Written by Paul Brook
|
6 |
*
|
7 |
* This code is licensed under the LGPL
|
8 |
*/
|
9 |
|
10 |
#include "hw.h" |
11 |
#include "arm-misc.h" |
12 |
|
13 |
/* Input 0 is IRQ and input 1 is FIQ. */
|
14 |
static void arm_pic_cpu_handler(void *opaque, int irq, int level) |
15 |
{ |
16 |
CPUState *env = (CPUState *)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);
|
32 |
} |
33 |
} |
34 |
|
35 |
qemu_irq *arm_pic_init_cpu(CPUState *env) |
36 |
{ |
37 |
return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2); |
38 |
} |