qemu/hw/arm_pic.c
<<
>>
Prefs
   1/*
   2 * Generic ARM Programmable Interrupt Controller support.
   3 *
   4 * Copyright (c) 2006 CodeSourcery.
   5 * Written by Paul Brook
   6 *
   7 * This code is licensed under the LGPL
   8 */
   9
  10#include "hw.h"
  11#include "arm-misc.h"
  12
  13/* Input 0 is IRQ and input 1 is FIQ.  */
  14static void arm_pic_cpu_handler(void *opaque, int irq, int level)
  15{
  16    CPUARMState *env = (CPUARMState *)opaque;
  17    switch (irq) {
  18    case ARM_PIC_CPU_IRQ:
  19        if (level)
  20            cpu_interrupt(env, CPU_INTERRUPT_HARD);
  21        else
  22            cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
  23        break;
  24    case ARM_PIC_CPU_FIQ:
  25        if (level)
  26            cpu_interrupt(env, CPU_INTERRUPT_FIQ);
  27        else
  28            cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
  29        break;
  30    default:
  31        hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
  32    }
  33}
  34
  35qemu_irq *arm_pic_init_cpu(CPUARMState *env)
  36{
  37    return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
  38}
  39