buildsupport_utils.ads 4.85 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
--  *************************** buildsupport ****************************  --
Maxime Perrotin's avatar
Maxime Perrotin committed
2
--  (c) 2017 European Space Agency - maxime.perrotin@esa.int
Maxime Perrotin's avatar
Maxime Perrotin committed
3
4
5
--  LGPL license, see LICENSE file

--  Set of helper functions for buildsupport
Maxime Perrotin's avatar
Maxime Perrotin committed
6
with Ocarina,
7
8
9
     --  Ocarina.Types,
     Types,
     Ocarina.Backends.Properties,
10
     Ada.Containers.Indefinite_Ordered_Maps,
11
12
     Ada.Containers.Indefinite_Vectors,
     Ada.Strings.Unbounded;
Maxime Perrotin's avatar
Maxime Perrotin committed
13

Maxime Perrotin's avatar
Maxime Perrotin committed
14
use Ocarina,
15
16
17
    Ocarina.Backends.Properties,
    Ada.Containers,
    Ada.Strings.Unbounded;
Maxime Perrotin's avatar
Maxime Perrotin committed
18
19
20

package Buildsupport_Utils is

21
22
--   use Ocarina.Types;
   use Types;
Maxime Perrotin's avatar
Maxime Perrotin committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

   procedure Banner;

   procedure Usage;

   procedure Exit_On_Error (Error : Boolean; Reason : String);

   type Synchronism is (Sync, Async);

   procedure Init;

   type Supported_RCM_Operation_Kind is (Unprotected_Operation,
                                         Protected_Operation,
                                         Variator_Operation,
                                         Modifier_Operation,
                                         Cyclic_Operation,
                                         Sporadic_Operation,
                                         Unknown_Operation);

42
   function Get_RCM_Operation_Kind (E : Node_Id)
Maxime Perrotin's avatar
Maxime Perrotin committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
     return Supported_RCM_Operation_Kind;

   function Get_RCM_Operation (E : Node_Id) return Node_Id;

   function Get_RCM_Period (D : Node_Id) return Unsigned_Long_Long;

   function Get_APLC_Binding (E : Node_Id) return List_Id;

   type Supported_ASN1_Encoding is (Default, Native, UPER, ACN);

   function Get_ASN1_Encoding (E : Node_Id) return Supported_ASN1_Encoding;

   type Supported_ASN1_Basic_Type is (ASN1_Sequence,
                                      ASN1_SequenceOf,
                                      ASN1_Enumerated,
                                      ASN1_Set,
                                      ASN1_SetOf,
                                      ASN1_Integer,
                                      ASN1_Boolean,
                                      ASN1_Real,
                                      ASN1_OctetString,
                                      ASN1_Choice,
                                      ASN1_String,
                                      ASN1_Unknown);

68
   package Property_Maps is new Indefinite_Ordered_Maps (String, String);
69
70
   use Property_Maps;
   package String_Vectors is new Indefinite_Vectors (Natural, String);
71

Maxime Perrotin's avatar
Maxime Perrotin committed
72
73
74
75
76
77
78
79
80
81
   function Get_ASN1_Basic_Type (E : Node_Id) return Supported_ASN1_Basic_Type;

   function Get_Ada_Package_Name (D : Node_Id) return Name_Id;

   function Get_Ellidiss_Tool_Version (D : Node_Id) return Name_Id;

   function Get_Interface_Name (D : Node_Id) return Name_Id;

   function Get_ASN1_Module_Name (D : Node_Id) return String;

Maxime Perrotin's avatar
Maxime Perrotin committed
82
83
   function Get_Properties_Map (D : Node_Id) return Property_Maps.Map;

84
85
86
87
   --  Types needed to build the AST of the TASTE Interface View in Ada
   type Parameter_Direction is (param_in, param_out);

   type ASN1_Parameter is
88
       record
89
90
91
92
93
94
95
           Name            : Unbounded_String;
           Sort            : Unbounded_String;
           ASN1_Module     : Unbounded_String;
           ASN1_Basic_Type : Supported_ASN1_Basic_Type;
           ASN1_File_Name  : Unbounded_String;
           Encoding        : Supported_ASN1_Encoding;
           Direction       : Parameter_Direction;
96
97
       end record;

98
   package Parameters is new Indefinite_Vectors (Natural, ASN1_Parameter);
99

100
101
102
103
104
105
106
107
108
109
110
111
112
   type Taste_Interface is
       record
           Name           : Unbounded_String;
           In_Parameters  : Parameters.Vector;
           Out_Parameters : Parameters.Vector;
           RCM            : Supported_RCM_Operation_Kind;
           Period_Or_MIAT : Natural;
           WCET           : Natural;
           WCET_Unit      : Unbounded_String;
           Queue_Size     : Natural;
       end record;

   package Interfaces is new Indefinite_Vectors (Natural, Taste_Interface);
113

114
   type Taste_Terminal_Function is
115
       record
116
           Name           : Unbounded_String;
117
           Language       : Supported_Source_Language;
118
           Zip_File       : Unbounded_String;
119
120
121
122
123
124
           Context_Params : Property_Maps.Map;
           Timers         : String_Vectors.Vector;
           Provided       : Interfaces.Vector;
           Required       : Interfaces.Vector;
       end record;

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
   package Functions is new Indefinite_Vectors (Natural,
                                                Taste_Terminal_Function);

   type Connection is
       record
           Source_Function : Taste_Terminal_Function;
           Dest_Function   : Taste_Terminal_Function;
           Source_RI       : Taste_Interface;
           Dest_PI         : Taste_Interface;
       end record;

   package Channels is new Indefinite_Vectors (Natural, Connection);

   type Complete_Interface_View is limited
       record
           Flat_Functions : Functions.Vector;
           Connections    : Channels.Vector;
       end record;

Maxime Perrotin's avatar
Maxime Perrotin committed
144
end Buildsupport_Utils;