root / hw / arm_pic.c @ 298e01b6
History | View | Annotate | Download (1 kB)
1 | 5fafdf24 | ths | /*
|
---|---|---|---|
2 | cdbdb648 | pbrook | * Generic ARM Programmable Interrupt Controller support.
|
3 | cdbdb648 | pbrook | *
|
4 | cdbdb648 | pbrook | * Copyright (c) 2006 CodeSourcery.
|
5 | cdbdb648 | pbrook | * Written by Paul Brook
|
6 | cdbdb648 | pbrook | *
|
7 | cdbdb648 | pbrook | * This code is licenced under the LGPL
|
8 | cdbdb648 | pbrook | */
|
9 | cdbdb648 | pbrook | |
10 | 87ecb68b | pbrook | #include "hw.h" |
11 | 87ecb68b | pbrook | #include "arm-misc.h" |
12 | cdbdb648 | pbrook | |
13 | cdbdb648 | pbrook | /* Stub functions for hardware that doesn't exist. */
|
14 | cdbdb648 | pbrook | void pic_info(void) |
15 | cdbdb648 | pbrook | { |
16 | cdbdb648 | pbrook | } |
17 | cdbdb648 | pbrook | |
18 | cdbdb648 | pbrook | void irq_info(void) |
19 | cdbdb648 | pbrook | { |
20 | cdbdb648 | pbrook | } |
21 | cdbdb648 | pbrook | |
22 | cdbdb648 | pbrook | |
23 | d537cf6c | pbrook | /* Input 0 is IRQ and input 1 is FIQ. */
|
24 | cdbdb648 | pbrook | static void arm_pic_cpu_handler(void *opaque, int irq, int level) |
25 | cdbdb648 | pbrook | { |
26 | d537cf6c | pbrook | CPUState *env = (CPUState *)opaque; |
27 | cdbdb648 | pbrook | switch (irq) {
|
28 | cdbdb648 | pbrook | case ARM_PIC_CPU_IRQ:
|
29 | cdbdb648 | pbrook | if (level)
|
30 | d537cf6c | pbrook | cpu_interrupt(env, CPU_INTERRUPT_HARD); |
31 | cdbdb648 | pbrook | else
|
32 | d537cf6c | pbrook | cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); |
33 | cdbdb648 | pbrook | break;
|
34 | cdbdb648 | pbrook | case ARM_PIC_CPU_FIQ:
|
35 | cdbdb648 | pbrook | if (level)
|
36 | d537cf6c | pbrook | cpu_interrupt(env, CPU_INTERRUPT_FIQ); |
37 | cdbdb648 | pbrook | else
|
38 | d537cf6c | pbrook | cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ); |
39 | cdbdb648 | pbrook | break;
|
40 | cdbdb648 | pbrook | default:
|
41 | d537cf6c | pbrook | cpu_abort(env, "arm_pic_cpu_handler: Bad interrput line %d\n", irq);
|
42 | cdbdb648 | pbrook | } |
43 | cdbdb648 | pbrook | } |
44 | cdbdb648 | pbrook | |
45 | d537cf6c | pbrook | qemu_irq *arm_pic_init_cpu(CPUState *env) |
46 | cdbdb648 | pbrook | { |
47 | d537cf6c | pbrook | return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2); |
48 | cdbdb648 | pbrook | } |