Func *IRQInstall(int IRQNum, Func *ISRFun)
If the IRQNum is 0..7, the appropriate mask bit in the Status register will be enabled, together with the global IEC bit.
IRQNum (0..23) specifies which of the possible 24 exceptions vectors should be connected to this handler.
| IRQNum | Exception | IRQNum | Exception |
|---|---|---|---|
| 0 | - sw0 (low priority) | 12 | - AdEL |
| 1 | - sw1 | 13 | - AdES |
| 2 | - int0 | 14 | - IBE |
| 3 | - int1 | 15 | - DBE |
| 4 | - int2 | 16 | - Sys |
| 5 | - int3 | 17 | - Bp |
| 6 | - int4 | 18 | - RI |
| 7 | - int5 (high priority) | 19 | - CpU |
| 8 | - unused | 20 | - Ovf |
| 9 | - TLB MOD | 21 | - unused |
| 10 | - TLBL | 22 | - unused |
| 11 | - TLBS | 23 | - unused |
ISRFun is the address of the C function that should be called when the specified exception occurs. If a value of zero is specified, the current handler will be uninstalled and the interrupt will be disabled.
The ISRFun is passed the base address of the register save area, this permits the ISR to receive incoming register-based variables, and even change the address to which control will pass when the handler terminates.
Offsets in the savearea are 0 thru 31 where the offset equals the register number except for the following cases:
0 = EPC
26 = HI
27 = LO
28 = CAUSE
29 = SR
The ISRFun must return non-zero if it handled the exception.
If it returns zero, control will be passed to the ICEKernel or
PMON.There are actually two separate implementations of this command, lib/pmirq.c and lib/sairq.c. When you build a program for execution under PMON, your reference to IRQInstall will pull lib/irq.c from the library. This module then calls pmirq.c. It is different from sairq.c in that it uses onintr to add the handler to PMON's interrupt vector table.
main()
{
int isr();
IRQInstall(SIO_IRQNum,isr);
}
isr(Ulong *savearea)
{
/* acknowledge the interrupt */
/* do interrupt code */
return(1);
}
For more complete examples, see lib/p2681.c and lib/t1_4102.c.