arm_pic.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 "pc.h"
  11. #include "arm-misc.h"
  12. /* Stub functions for hardware that doesn't exist. */
  13. void pic_info(Monitor *mon)
  14. {
  15. }
  16. void irq_info(Monitor *mon)
  17. {
  18. }
  19. /* Input 0 is IRQ and input 1 is FIQ. */
  20. static void arm_pic_cpu_handler(void *opaque, int irq, int level)
  21. {
  22. CPUState *env = (CPUState *)opaque;
  23. switch (irq) {
  24. case ARM_PIC_CPU_IRQ:
  25. if (level)
  26. cpu_interrupt(env, CPU_INTERRUPT_HARD);
  27. else
  28. cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
  29. break;
  30. case ARM_PIC_CPU_FIQ:
  31. if (level)
  32. cpu_interrupt(env, CPU_INTERRUPT_FIQ);
  33. else
  34. cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
  35. break;
  36. default:
  37. hw_error("arm_pic_cpu_handler: Bad interrput line %d\n", irq);
  38. }
  39. }
  40. qemu_irq *arm_pic_init_cpu(CPUState *env)
  41. {
  42. return qemu_allocate_irqs(arm_pic_cpu_handler, env, 2);
  43. }