Blame view

hw/arm_pic.c 1.06 KB
1
/*
2
3
4
5
6
7
8
9
 * Generic ARM Programmable Interrupt Controller support.
 *
 * Copyright (c) 2006 CodeSourcery.
 * Written by Paul Brook
 *
 * This code is licenced under the LGPL
 */
pbrook authored
10
#include "hw.h"
11
#include "pc.h"
pbrook authored
12
#include "arm-misc.h"
13
14

/* Stub functions for hardware that doesn't exist.  */
15
void pic_info(Monitor *mon)
16
17
18
{
}
19
void irq_info(Monitor *mon)
20
21
22
23
{
}
pbrook authored
24
/* Input 0 is IRQ and input 1 is FIQ.  */
25
26
static void arm_pic_cpu_handler(void *opaque, int irq, int level)
{
pbrook authored
27
    CPUState *env = (CPUState *)opaque;
28
29
30
    switch (irq) {
    case ARM_PIC_CPU_IRQ:
        if (level)
pbrook authored
31
            cpu_interrupt(env, CPU_INTERRUPT_HARD);
32
        else
pbrook authored
33
            cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
34
35
36
        break;
    case ARM_PIC_CPU_FIQ:
        if (level)
pbrook authored
37
            cpu_interrupt(env, CPU_INTERRUPT_FIQ);
38
        else
pbrook authored
39
            cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
40
41
        break;
    default:
42
        hw_error("arm_pic_cpu_handler: Bad interrput line %d\n", irq);
43
44
45
    }
}
pbrook authored
46
qemu_irq *arm_pic_init_cpu(CPUState *env)
47
{
pbrook authored
48
    return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
49
}