1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--               OCARINA.BACKENDS.ARINC653_CONF.PARTITION_HM                --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--                  Copyright (C) 2009 Telecom ParisTech,                   --
10
--                 2010-2019 ESA & ISAE, 2019-2020 OpenAADL                 --
11
--                                                                          --
12
-- Ocarina  is free software; you can redistribute it and/or modify under   --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
16
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
17
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
--                    Ocarina is maintained by OpenAADL team                --
29
--                              (info@openaadl.org)                         --
30
--                                                                          --
31
------------------------------------------------------------------------------
32

33
with Ocarina.ME_AADL;
34
with Ocarina.ME_AADL.AADL_Instances.Nodes;
35
with Ocarina.ME_AADL.AADL_Instances.Nutils;
36
with Ocarina.ME_AADL.AADL_Instances.Entities;
37

38
with Ocarina.Backends.XML_Tree.Nodes;
39
with Ocarina.Backends.XML_Tree.Nutils;
40
with Ocarina.Backends.ARINC653_Conf.Mapping;
41

42
package body Ocarina.Backends.ARINC653_Conf.Partition_HM is
43

44
   use Ocarina.ME_AADL;
45
   use Ocarina.ME_AADL.AADL_Instances.Nodes;
46
   use Ocarina.ME_AADL.AADL_Instances.Entities;
47
   use Ocarina.Backends.XML_Tree.Nutils;
48
   use Ocarina.Backends.ARINC653_Conf.Mapping;
49

50
   package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
51
   package XTN renames Ocarina.Backends.XML_Tree.Nodes;
52

53
   procedure Visit_Architecture_Instance (E : Node_Id);
54
   procedure Visit_Component_Instance (E : Node_Id);
55
   procedure Visit_System_Instance (E : Node_Id);
56
   procedure Visit_Process_Instance (E : Node_Id);
57
   procedure Visit_Processor_Instance (E : Node_Id);
58
   procedure Visit_Virtual_Processor_Instance (E : Node_Id);
59

60
   -----------
61
   -- Visit --
62
   -----------
63

64 0
   procedure Visit (E : Node_Id) is
65
   begin
66 0
      case Kind (E) is
67 0
         when K_Architecture_Instance =>
68 0
            Visit_Architecture_Instance (E);
69

70 0
         when K_Component_Instance =>
71 0
            Visit_Component_Instance (E);
72

73 0
         when others =>
74 0
            null;
75 0
      end case;
76 0
   end Visit;
77

78
   ---------------------------------
79
   -- Visit_Architecture_Instance --
80
   ---------------------------------
81

82 0
   procedure Visit_Architecture_Instance (E : Node_Id) is
83
   begin
84 0
      Visit (Root_System (E));
85 0
   end Visit_Architecture_Instance;
86

87
   ------------------------------
88
   -- Visit_Component_Instance --
89
   ------------------------------
90

91 0
   procedure Visit_Component_Instance (E : Node_Id) is
92 0
      Category : constant Component_Category := Get_Category_Of_Component (E);
93
   begin
94 0
      case Category is
95 0
         when CC_System =>
96 0
            Visit_System_Instance (E);
97

98 0
         when CC_Process =>
99 0
            Visit_Process_Instance (E);
100

101 0
         when CC_Processor =>
102 0
            Visit_Processor_Instance (E);
103

104 0
         when CC_Virtual_Processor =>
105 0
            Visit_Virtual_Processor_Instance (E);
106

107 0
         when others =>
108 0
            null;
109 0
      end case;
110 0
   end Visit_Component_Instance;
111

112
   ----------------------------
113
   -- Visit_Process_Instance --
114
   ----------------------------
115

116 0
   procedure Visit_Process_Instance (E : Node_Id) is
117
   begin
118 0
      Append_Node_To_List
119 0
        (Map_Process_HM_Table (E),
120 0
         XTN.Subitems (Current_XML_Node));
121 0
   end Visit_Process_Instance;
122

123
   ---------------------------
124
   -- Visit_System_Instance --
125
   ---------------------------
126

127 0
   procedure Visit_System_Instance (E : Node_Id) is
128 0
      S : Node_Id;
129
   begin
130 0
      if not AINU.Is_Empty (Subcomponents (E)) then
131 0
         S := First_Node (Subcomponents (E));
132 0
         while Present (S) loop
133
            --  Visit the component instance corresponding to the
134
            --  subcomponent S.
135 0
            if AINU.Is_Processor (Corresponding_Instance (S)) then
136 0
               Visit (Corresponding_Instance (S));
137
            end if;
138

139 0
            S := Next_Node (S);
140 0
         end loop;
141
      end if;
142 0
   end Visit_System_Instance;
143

144
   ------------------------------
145
   -- Visit_Processor_Instance --
146
   ------------------------------
147

148 0
   procedure Visit_Processor_Instance (E : Node_Id) is
149 0
      S : Node_Id;
150 0
      U : Node_Id;
151 0
      P : Node_Id;
152
   begin
153 0
      U := XTN.Unit (Backend_Node (Identifier (E)));
154 0
      P := XTN.Node (Backend_Node (Identifier (E)));
155

156 0
      Push_Entity (U);
157 0
      Push_Entity (P);
158

159 0
      Current_XML_Node := XTN.Root_Node (XTN.XML_File (U));
160

161 0
      if not AINU.Is_Empty (Subcomponents (E)) then
162 0
         S := First_Node (Subcomponents (E));
163 0
         while Present (S) loop
164
            --  Visit the component instance corresponding to the
165
            --  subcomponent S.
166

167 0
            Visit (Corresponding_Instance (S));
168 0
            S := Next_Node (S);
169 0
         end loop;
170
      end if;
171

172 0
      Pop_Entity;
173 0
      Pop_Entity;
174 0
   end Visit_Processor_Instance;
175

176
   --------------------------------------
177
   -- Visit_Virtual_Processor_Instance --
178
   --------------------------------------
179

180 0
   procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
181 0
      S         : Node_Id;
182 0
      Processes : List_Id;
183
   begin
184 0
      if not AINU.Is_Empty (Subcomponents (E)) then
185 0
         S := First_Node (Subcomponents (E));
186 0
         while Present (S) loop
187
            --  Visit the component instance corresponding to the
188
            --  subcomponent S.
189

190 0
            Visit (Corresponding_Instance (S));
191 0
            S := Next_Node (S);
192 0
         end loop;
193
      end if;
194

195 0
      if Present (Backend_Node (Identifier (E))) then
196 0
         Processes := XTN.Processes (Backend_Node (Identifier (E)));
197 0
         S         := XTN.First_Node (Processes);
198 0
         while Present (S) loop
199 0
            Visit (XTN.Content (S));
200 0
            S := XTN.Next_Node (S);
201 0
         end loop;
202
      end if;
203 0
   end Visit_Virtual_Processor_Instance;
204

205
end Ocarina.Backends.ARINC653_Conf.Partition_HM;

Read our documentation on viewing source code .

Loading