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