Showing changes from revision #4 to #5:
Added | Removed | Changed
Entry | |
---|---|
R0 | Device number and flag in bit 31 |
R1 | Address of device driver routine |
R2 | Value to be passed in R12 when driver is called |
R3 | Address of interrupt status if R0 = podule “IRQ” or “FIQ as IRQ” on entry |
R4 | Interrupt mask to use, if R0 = podule “IRQ” or “FIQ as IRQ” on entry |
Exit | |
---|---|
R0 | Preserved |
R1 | Preserved |
R2 | Preserved |
R3 | Preserved |
R4 | Preserved |
The purpose of this call is to claim a device vector.
This installs the device driver. If the same driver has already been installed on the vector then the old copy is removed from the vector. This does not enable interrupts from the device. The previous driver is added to the list of earlier claimants. Your driver is called if the interrupt controller receives an interrupt from the appropriate device and your driver was the last to claim the vector.
For IO expansion cards (device numbers 8 or 13) there may be multiple cards all sharing the same interrupt line (and therefore device number) the values in R3 and R4 will be used to determine the true owner. A byte read will be performed of the interrupt status and your driver will be called if (status AND R4) is non zero. From RISC OS 5.00, bits 8-15 of R4 can specify an EOR mask to permit active low interrupts to be supported, ie. when ((status EOR R4[15:8]) AND R4[7:0]) is non zero.
When Under your code is being called, you’ll find the following entry conditions:RISC OS 5, your driver routine will be called as follows:
Your On routine exit: should:
MOV PC, R14
If the interrupt is caused by your device, your routine should:
If the interrupt is not caused by your device (i.e. it’s a different device which is on the same shared IRQ line as your device), your routine should return to the kernel by MOV PC,R14
or similar. The kernel will then call the next routine on the device vector chain.
Note that if an interrupt is received for a device which has no drivers registered, or (for a shared IRQ line) if the end of the chain is reached without any driver handling the IRQ, the kernel will automatically disable the IRQ via HAL_IRQDisable. This behaviour is necessary so that devices which request an interrupt when no driver is loaded will not hang the system. However it does mean that a buggy device driver on a shared IRQ line may accidentally cause that IRQ line to be disabled for all drivers on that line – be aware of this when developing/debugging your drivers.
You should ensure: