2007-09-17 05:08:06 +08:00
|
|
|
/*
|
2006-04-09 09:32:52 +08:00
|
|
|
* Generic ARM Programmable Interrupt Controller support.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 CodeSourcery.
|
|
|
|
* Written by Paul Brook
|
|
|
|
*
|
2011-06-26 10:21:35 +08:00
|
|
|
* This code is licensed under the LGPL
|
2006-04-09 09:32:52 +08:00
|
|
|
*/
|
|
|
|
|
2007-11-18 01:14:51 +08:00
|
|
|
#include "hw.h"
|
2009-03-06 07:01:23 +08:00
|
|
|
#include "pc.h"
|
2007-11-18 01:14:51 +08:00
|
|
|
#include "arm-misc.h"
|
2006-04-09 09:32:52 +08:00
|
|
|
|
|
|
|
/* Stub functions for hardware that doesn't exist. */
|
2009-03-06 07:01:23 +08:00
|
|
|
void pic_info(Monitor *mon)
|
2006-04-09 09:32:52 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-03-06 07:01:23 +08:00
|
|
|
void irq_info(Monitor *mon)
|
2006-04-09 09:32:52 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-08 02:14:41 +08:00
|
|
|
/* Input 0 is IRQ and input 1 is FIQ. */
|
2006-04-09 09:32:52 +08:00
|
|
|
static void arm_pic_cpu_handler(void *opaque, int irq, int level)
|
|
|
|
{
|
2007-04-08 02:14:41 +08:00
|
|
|
CPUState *env = (CPUState *)opaque;
|
2006-04-09 09:32:52 +08:00
|
|
|
switch (irq) {
|
|
|
|
case ARM_PIC_CPU_IRQ:
|
|
|
|
if (level)
|
2007-04-08 02:14:41 +08:00
|
|
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
2006-04-09 09:32:52 +08:00
|
|
|
else
|
2007-04-08 02:14:41 +08:00
|
|
|
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
2006-04-09 09:32:52 +08:00
|
|
|
break;
|
|
|
|
case ARM_PIC_CPU_FIQ:
|
|
|
|
if (level)
|
2007-04-08 02:14:41 +08:00
|
|
|
cpu_interrupt(env, CPU_INTERRUPT_FIQ);
|
2006-04-09 09:32:52 +08:00
|
|
|
else
|
2007-04-08 02:14:41 +08:00
|
|
|
cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
|
2006-04-09 09:32:52 +08:00
|
|
|
break;
|
|
|
|
default:
|
2009-05-08 09:35:15 +08:00
|
|
|
hw_error("arm_pic_cpu_handler: Bad interrput line %d\n", irq);
|
2006-04-09 09:32:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-08 02:14:41 +08:00
|
|
|
qemu_irq *arm_pic_init_cpu(CPUState *env)
|
2006-04-09 09:32:52 +08:00
|
|
|
{
|
2007-04-08 02:14:41 +08:00
|
|
|
return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
|
2006-04-09 09:32:52 +08:00
|
|
|
}
|