2
0

arm_pic.c 944 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. CPUState *env = (CPUState *)opaque;
  15. switch (irq) {
  16. case ARM_PIC_CPU_IRQ:
  17. if (level)
  18. cpu_interrupt(env, CPU_INTERRUPT_HARD);
  19. else
  20. cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
  21. break;
  22. case ARM_PIC_CPU_FIQ:
  23. if (level)
  24. cpu_interrupt(env, CPU_INTERRUPT_FIQ);
  25. else
  26. cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
  27. break;
  28. default:
  29. hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
  30. }
  31. }
  32. qemu_irq *arm_pic_init_cpu(CPUState *env)
  33. {
  34. return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
  35. }