comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: Handling Addressing Errors
Date: 1999/03/04
Date: 1999-03-04T00:00:00+00:00	[thread overview]
Message-ID: <7bofa5$nfd$2@plug.news.pipex.net> (raw)
In-Reply-To: 1999Mar3.212443.1898@nosc.mil

Assuming you mean a memory board, the standard technique is something like
this:

   with System.Storage_Elements;
   use System, System.Storage_Elements;

   procedure Check_For_Board (Bottom, Top: in System.Address; Present: out
Boolean);
      Mask: array (1..4) of Storage_Element;
      Board: Storage_Array(0..Top-Bottom);
      for Board'Address use Bottom;
      pragma Volatile_Components(Board);
   begin
      Mask(1) := 0;
      Mask(2) := 16#A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5A5# and
(2**Storage_Unit-1);
      Mask(3) := not Mask(2);
      Mask(4) := not Mask(1);
      Present := False;
      for i in Board'Range loop
         for m in 1..4 loop
            Board(i) := Mask(m);
            if Board(i) /= Mask(m) then return; end if;
         end loop;
      end loop;
      Present := True;
   exception
       when Program_Error => Present := False; return; -- ?
   end Check_For_Board;

This is designed for all architectures, BTW, not just VME.

I believe some VME boards provide a way to detect their presence (and to
configure them) via I/O ports (usu memory mapped, as it happens), but, as
ever, they're all different!  VME memory boards tug the NMI to indicate
memory failure.  I take it that the RTOS your program ran on caught the NMI
and raised Program_Error.  If you could find a way to intercept the NMI
explicitly, so much the better.  (This might provide you with a more
graceful way to handle genuine memory failures, BTW.)

As for pragma Volatile, if you ever find a compiler which 'optimises' away a
reference to a volatile object, do us all a favour: (a) find the
person/people responsible for this compiler; (b) shoot them all, or commit
them to a secure mental institution; (c) destroy all copies of the compiler,
and any evidence that it ever existed.  (Thanks :-)

-------------------------------------
Nick Roberts
-------------------------------------








      parent reply	other threads:[~1999-03-04  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03  0:00 Handling Addressing Errors Charles H. Sampson
1999-03-04  0:00 ` robert_dewar
1999-03-18  0:00   ` Charles H. Sampson
1999-03-18  0:00     ` Nick Roberts
1999-03-21  0:00       ` robert_dewar
1999-03-18  0:00     ` Tucker Taft
1999-03-19  0:00       ` Mikko Levanto
1999-03-19  0:00         ` Nick Roberts
1999-03-20  0:00         ` Tucker Taft
1999-04-02  0:00       ` Charles H. Sampson
1999-03-19  0:00     ` robert_dewar
1999-03-04  0:00 ` Nick Roberts [this message]
replies disabled

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