2007-09-17 01:08:06 +04:00
|
|
|
/*
|
2006-04-09 05:32:52 +04:00
|
|
|
* Generic ARM Programmable Interrupt Controller support.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 CodeSourcery.
|
|
|
|
* Written by Paul Brook
|
|
|
|
*
|
2011-06-26 06:21:35 +04:00
|
|
|
* This code is licensed under the LGPL
|
2006-04-09 05:32:52 +04:00
|
|
|
*/
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
#include "hw.h"
|
|
|
|
#include "arm-misc.h"
|
2006-04-09 05:32:52 +04:00
|
|
|
|
2007-04-07 22:14:41 +04:00
|
|
|
/* Input 0 is IRQ and input 1 is FIQ. */
|
2006-04-09 05:32:52 +04:00
|
|
|
static void arm_pic_cpu_handler(void *opaque, int irq, int level)
|
|
|
|
{
|
2012-05-14 06:21:52 +04:00
|
|
|
ARMCPU *cpu = opaque;
|
|
|
|
CPUARMState *env = &cpu->env;
|
|
|
|
|
2006-04-09 05:32:52 +04:00
|
|
|
switch (irq) {
|
|
|
|
case ARM_PIC_CPU_IRQ:
|
|
|
|
if (level)
|
2007-04-07 22:14:41 +04:00
|
|
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
2006-04-09 05:32:52 +04:00
|
|
|
else
|
2007-04-07 22:14:41 +04:00
|
|
|
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
2006-04-09 05:32:52 +04:00
|
|
|
break;
|
|
|
|
case ARM_PIC_CPU_FIQ:
|
|
|
|
if (level)
|
2007-04-07 22:14:41 +04:00
|
|
|
cpu_interrupt(env, CPU_INTERRUPT_FIQ);
|
2006-04-09 05:32:52 +04:00
|
|
|
else
|
2007-04-07 22:14:41 +04:00
|
|
|
cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
|
2006-04-09 05:32:52 +04:00
|
|
|
break;
|
|
|
|
default:
|
2011-10-10 03:27:01 +04:00
|
|
|
hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
|
2006-04-09 05:32:52 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-14 06:21:52 +04:00
|
|
|
qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
|
2006-04-09 05:32:52 +04:00
|
|
|
{
|
2012-05-14 06:21:52 +04:00
|
|
|
return qemu_allocate_irqs(arm_pic_cpu_handler, cpu, 2);
|
2006-04-09 05:32:52 +04:00
|
|
|
}
|