5

在使用 Ada 中断处理程序时,到目前为止,我已经隔离了一些需要在代码中才能使它们工作的特定内容。

使用 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);

假设这一切都是正确的并且我已经在寄存器中启用了中断,我还需要添加其他与中断相关的代码吗?特别是,我是否需要直接与寄存器交互以以某种方式“链接”我的处理程序代码,或者我可以只设置寄存器的记录表示,直接向它们输出必要的设置,然后让 rip?

谢谢!

4

1 回答 1

6

我认为你走在正确的轨道上,但如果你以前没有这样做过,如果我是你,我会回顾一些已经发表的关于 Ada 中断处理的文章。例如:

于 2012-05-17T17:50:32.333 回答