2 * Generic ARM Programmable Interrupt Controller support.
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licenced under the LGPL
13 /* Stub functions for hardware that doesn't exist. */
14 void pic_set_irq(int irq
, int level
)
16 cpu_abort(cpu_single_env
, "pic_set_irq");
28 void pic_set_irq_new(void *opaque
, int irq
, int level
)
30 arm_pic_handler
*p
= (arm_pic_handler
*)opaque
;
31 /* Call the real handler. */
32 (*p
)(opaque
, irq
, level
);
35 /* Model the IRQ/FIQ CPU interrupt lines as a two input interrupt controller.
36 Input 0 is IRQ and input 1 is FIQ. */
39 arm_pic_handler handler
;
43 static void arm_pic_cpu_handler(void *opaque
, int irq
, int level
)
45 arm_pic_cpu_state
*s
= (arm_pic_cpu_state
*)opaque
;
49 cpu_interrupt(s
->cpu_env
, CPU_INTERRUPT_HARD
);
51 cpu_reset_interrupt(s
->cpu_env
, CPU_INTERRUPT_HARD
);
55 cpu_interrupt(s
->cpu_env
, CPU_INTERRUPT_FIQ
);
57 cpu_reset_interrupt(s
->cpu_env
, CPU_INTERRUPT_FIQ
);
60 cpu_abort(s
->cpu_env
, "arm_pic_cpu_handler: Bad interrput line %d\n",
65 void *arm_pic_init_cpu(CPUState
*env
)
69 s
= (arm_pic_cpu_state
*)malloc(sizeof(arm_pic_cpu_state
));
70 s
->handler
= arm_pic_cpu_handler
;