Reading interrupt status
Dave Higton (1515) 3534 posts |
OK, we have OS_IntOff and OS_IntOn to disable and enable interrupts as a whole. But is there a call that tells us whether they are currently enabled or not? I’d like to disable interrupts for a short time, BUT I don’t know in principle whether they are currently enabled. So I can call OS_IntOff alright, but I don’t know whether I have to call OS_IntOn. It would be handly if OS_IntOff were to return the prior status. |
Chris Johnson (125) 825 posts |
There is the call _kernel_irqs_disabled() in CLIb (h.kernel). |
Rick Murray (539) 13850 posts |
Is there any option that doesn’t involve meeting with IRQs? That’s one of RISC OS’ bad habits… |
Dave Higton (1515) 3534 posts |
Sorry, Rick, I’ve read that again and again and I still don’t understand what you mean. |
Rick Murray (539) 13850 posts |
Stupid autocorrect… Let’s try again: Is there any option that doesn’t involve messing with IRQs? That’s one of RISC OS’ bad habits… ;-) |
Jeffrey Lee (213) 6048 posts |
Not really. We don’t have good support for threading, so fiddling with interrupts is often going to be required (especially for interrupt-based device drivers). About the best you can do is abstract over it by using a support library like SyncLib (which in some cases can shrink or eliminate areas where IRQs are disabled) |
Dave Higton (1515) 3534 posts |
This is one of the areas of difference between desktop apps, on the one hand, and device drivers and real time systems or subsystems on the other. Desktop apps don’t have any specific time constraints. Device drivers normally need to respond quickly in order to provide best service to clients of the OS. MIDI is a special case of real time (in this case, a small real time subsystem) in that its response has to be quick and measuredly so. What I and Rick and Colin are dealing with here is something that isn’t difficult in principle. However, not many people need to be aware of these depths and details of the OS, so the knowledge isn’t widely shared. It’s also difficult when something just crashes, and you can’t instrument it to find out where and why. |