Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ada interrupt handlers

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!

like image 996
Leon Avatar asked May 17 '12 16:05

Leon


1 Answers

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.:

  • Catching and Handling Interrupts in Ada
  • Gem #13: Interrupt Handling Idioms (Part 1)
  • Gem #14: Interrupt Handling Idioms (Part 2)
like image 106
Marc C Avatar answered Oct 20 '22 09:10

Marc C