comp.lang.ada
 help / color / mirror / Atom feed
From: "SteveD" <nospam_steved94@attbi.com>
Subject: Re: implementation approach
Date: Wed, 31 Jul 2002 13:59:04 GMT
Date: 2002-07-31T13:59:04+00:00	[thread overview]
Message-ID: <I2S19.101867$uh7.16891@sccrnsc03> (raw)
In-Reply-To: a5ae824.0207301854.3295f3a2@posting.google.com

"Mark" <ma740988@pegasus.cc.ucf.edu> wrote in message
news:a5ae824.0207301854.3295f3a2@posting.google.com...
[snip]
>
> I suspect I'll need two semaphores on both processors.  Once the flag
> gets passed from processor B to processor A, the routine in A will
> enter the semaphore command the device, release the flag, etc.
>
> Thanks in advance

In Ada an interrupt is associated with a protected procedure in a protected
type.  An example of how to set this up is in the LRM C.3.2(28).

I haven't done any Ada Interrupt handling myself, but I believe this is the
way it's done.

With Ada.Interrupts;

Package Body Interrupt_Test Is

  Protected Type Device_Interface(Int_Id : Ada.Interrupts.Interrupt_ID) Is
    Procedure Handler;
    Pragma Attach_Handler( Handler, Int_Id );
    Entry Wait_Interrupt;
  Private
    Occurred : Boolean := False;
  End Device_Interface;

  Protected Body Device_Interface Is
    Procedure Handler Is
    Begin
      Occurred := TRUE;
    End Handler;
    Entry Wait_Interrupt When Occurred Is
    Begin
      Occurred := False;
    End Wait_Interrupt;
  End Device_Interface;

  Device_1_Driver : Device_Interface( 1 );

  Task Relay Is
  End Relay;

  Task Body Relay Is
  Begin
    Loop
      Device_1_Driver.Wait_Interrupt;
      -- Do something when the interrupt occurs
    End Loop;
  End Relay;

End Interrupt_Test;


I hope this helps,
SteveD





  reply	other threads:[~2002-07-31 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-31  2:54 implementation approach Mark
2002-07-31 13:59 ` SteveD [this message]
2002-08-01 19:18 ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox