File : s-macres-p55.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . M A C H I N E _ R E S E T --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2011-2016, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 with Interfaces;
33
34 package body System.Machine_Reset is
35 procedure Os_Exit (Status : Integer);
36 pragma No_Return (Os_Exit);
37 pragma Export (Ada, Os_Exit, "_exit");
38 -- Shutdown or restart the board
39
40 procedure Os_Abort;
41 pragma No_Return (Os_Abort);
42 pragma Export (Ada, Os_Abort, "abort");
43 -- Likewise
44
45 --------------
46 -- Os_Abort --
47 --------------
48
49 procedure Os_Abort is
50 begin
51 Os_Exit (1);
52 end Os_Abort;
53
54 -------------
55 -- Os_Exit --
56 -------------
57
58 procedure Os_Exit (Status : Integer) is
59 pragma Unreferenced (Status);
60 -- The parameter is just for ISO-C compatibility
61
62 SIU_SRCR : Interfaces.Unsigned_32;
63 for SIU_SRCR'Address use 16#C3F9_0010#;
64 pragma Import (Ada, SIU_SRCR);
65 pragma Volatile (SIU_SRCR);
66
67 begin
68 SIU_SRCR := 16#8000_0000#;
69 loop
70 null;
71 end loop;
72 end Os_Exit;
73
74 ----------
75 -- Stop --
76 ----------
77
78 procedure Stop is
79 begin
80 Os_Exit (0);
81 end Stop;
82 end System.Machine_Reset;