2
0

arm_pic.c 963 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include "hw.h"
  10. #include "arm-misc.h"
  11. /* Input 0 is IRQ and input 1 is FIQ. */
  12. static void arm_pic_cpu_handler(void *opaque, int irq, int level)
  13. {
  14. ARMCPU *cpu = opaque;
  15. CPUARMState *env = &cpu->env;
  16. switch (irq) {
  17. case ARM_PIC_CPU_IRQ:
  18. if (level)
  19. cpu_interrupt(env, CPU_INTERRUPT_HARD);
  20. else
  21. cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
  22. break;
  23. case ARM_PIC_CPU_FIQ:
  24. if (level)
  25. cpu_interrupt(env, CPU_INTERRUPT_FIQ);
  26. else
  27. cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
  28. break;
  29. default:
  30. hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
  31. }
  32. }
  33. qemu_irq *arm_pic_init_cpu(ARMCPU *cpu)
  34. {
  35. return qemu_allocate_irqs(arm_pic_cpu_handler, cpu, 2);
  36. }