When using Ada interrupt handlers, I have so far isolated some specific things that need to be in the code for them to work.
Using Ada.Interrupts:
protected Int_Handler is --a protected object to handle interrupts
procedure Handler_1; --A procedure which handles interrupts from your first device (with a body, of course)
pragma Interrupt_Handler (Handler_1); --To tell the compiler this is an interrupt handler
--Later in the program:
begin
Attach_Handler (Int_Handler.Handler_1'access, Serial_1);
Assuming this is all correct and I've enabled interrupts in the registers, is there any other interrupt-related code I would need to add to this? Particularly, would I need to interact with the registers directly to in some way 'link up' my handler code, or can I just set up a record representation of the registers, output to them directly the necessary settings, and let rip?
Thanks!
I think you're on the right track, but if you haven't done this before, I would, if I were you, review some of the articles that have been published on interrupt handling with Ada. E.g.:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With