ocarina-backends-properties.ads 32 KB
Newer Older
1
2
3
4
5
6
7
8
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--          O C A R I N A . B A C K E N D S . P R O P E R T I E S           --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
9
--    Copyright (C) 2008-2009 Telecom ParisTech, 2010-2016 ESA & ISAE.      --
10
--                                                                          --
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- Ocarina  is free software; you can redistribute it and/or modify under   --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
jhugues's avatar
jhugues committed
27
28
--                 Ocarina is maintained by the TASTE project               --
--                      (taste-users@lists.tuxfamily.org)                   --
29
30
31
32
33
34
35
36
37
38
--                                                                          --
------------------------------------------------------------------------------

--  This packege contains the Ada-side definition of all AADL
--  properties that are relevent to the code generation. It extracts
--  brute information and doeas only sonsistency check.

package Ocarina.Backends.Properties is

   type Name_Array is array (Nat range <>) of Name_Id;
39
40
   Empty_Name_Array : constant Name_Array;

41
   type ULL_Array is array (Nat range <>) of Unsigned_Long_Long;
yoogx's avatar
yoogx committed
42
   Empty_ULL_Array : constant ULL_Array;
43

44
   type LL_Array is array (Nat range <>) of Long_Long;
yoogx's avatar
yoogx committed
45
   Empty_LL_Array : constant LL_Array;
46

47
   type LD_Array is array (Nat range <>) of Long_Double;
yoogx's avatar
yoogx committed
48
   Empty_LD_Array : constant LD_Array;
49
50
51

   --  Common types to several components and entities

52
   type Size_Units is (Bit, Byte, Kilo_Byte, Mega_Byte, Giga_Byte, Tera_Byte);
53
54
55
56
57
58
59
60
61
62
63
64
65

   type Size_Type is record
      S : Unsigned_Long_Long;
      U : Size_Units;
   end record;

   Null_Size : constant Size_Type;

   type Supported_Source_Language is
     (Language_Ada_95,
      Language_ASN1,
      Language_C,
      Language_Esterel,
66
      Language_Device,
67
      Language_Gui,
68
      Language_Lua,
69
      Language_Lustre,
70
      Language_Rhapsody,
71
      Language_SDL_RTDS,
72
73
      Language_CPP,
      Language_SDL_OpenGEODE,
74
      Language_RTSJ,
75
76
77
      Language_Scade,
      Language_SDL,
      Language_Simulink,
78
79
      Language_QGenC,
      Language_QGenAda,
80
      Language_System_C,
yoogx's avatar
yoogx committed
81
      Language_VDM,
82
      Language_VHDL,
83
      Language_MicroPython,
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
      Language_None);

   type Supported_Scheduling_Protocol is
     (PARAMETRIC_PROTOCOL,
      EARLIEST_DEADLINE_FIRST_PROTOCOL,
      LEAST_LAXITY_FIRST_PROTOCOL,
      RATE_MONOTONIC_PROTOCOL,
      DEADLINE_MONOTONIC_PROTOCOL,
      ROUND_ROBIN_PROTOCOL,
      TIME_SHARING_BASED_ON_WAIT_TIME_PROTOCOL,
      POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL,
      D_OVER_PROTOCOL,
      MAXIMUM_URGENCY_FIRST_BASED_ON_LAXITY_PROTOCOL,
      MAXIMUM_URGENCY_FIRST_BASED_ON_DEADLINE_PROTOCOL,
      TIME_SHARING_BASED_ON_CPU_USAGE_PROTOCOL,
      NO_SCHEDULING_PROTOCOL,
      HIERARCHICAL_CYCLIC_PROTOCOL,
      HIERARCHICAL_ROUND_ROBIN_PROTOCOL,
      HIERARCHICAL_FIXED_PRIORITY_PROTOCOL,
      HIERARCHICAL_PARAMETRIC_PROTOCOL,
      Unknown_Scheduler);

   type Supported_POK_Scheduler is
107
     (RMS, EDF, LLF, RR, Static, Invalid_Scheduler);
108
109

   type Supported_POK_Architectures is
110
     (POK_Arch_x86, POK_Arch_Sparc, POK_Arch_Ppc, Invalid_Architecture);
111
112
113

   type Supported_POK_BSP is
     (POK_BSP_x86_qemu,
114
      POK_BSP_x86_qemu_vmm,
115
116
117
118
      POK_BSP_Leon,
      POK_BSP_prep,
      Invalid_BSP);

119
   type ARINC653_Queuing_Discipline is (Fifo, Priority_Based, Invalid);
120

121
   type ARINC653_Access_Type is (Read, Write, Read_Write, Invalid);
122

123
   type ARINC653_Memory_Kind is (Code, Data, Invalid);
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

   type Supported_POK_Error is
     (POK_Error_Deadline_Missed,
      POK_Error_Application,
      POK_Error_Numeric,
      POK_Error_Illegal_Request,
      POK_Error_Stack_Overflow,
      POK_Error_Memory_Violation,
      POK_Error_Hardware_Fault,
      POK_Error_Power_Fail,
      POK_Error_Partition_Configuration,
      POK_Error_Partition_Init,
      POK_Error_Partition_Scheduling,
      POK_Error_Kernel_Init,
      POK_Error_Kernel_Scheduling,
      POK_Error_Invalid);

   type POK_Handled_Errors is array (Nat range <>) of Supported_POK_Error;
142
   POK_Empty_Handled_Errors : constant POK_Handled_Errors;
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

   type Supported_ARINC653_Error is
     (ARINC653_Error_Deadline_Miss,
      ARINC653_Error_Application,
      ARINC653_Error_Numeric,
      ARINC653_Error_Illegal_Request,
      ARINC653_Error_Stack_Overflow,
      ARINC653_Error_Memory_Violation,
      ARINC653_Error_Hardware_Fault,
      ARINC653_Error_Power_Fail,
      ARINC653_Error_Partition_Config,
      ARINC653_Error_Partition_Handler,
      ARINC653_Error_Partition_Init,
      ARINC653_Error_Partition_Scheduling,
      ARINC653_Error_Module_Init,
      ARINC653_Error_Module_Config,
      ARINC653_Error_Module_Scheduling,
      ARINC653_Error_Invalid);

   type ARINC653_Errors is array (Nat range <>) of Supported_ARINC653_Error;
163
   ARINC653_Empty_Errors : constant ARINC653_Errors;
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

   type Supported_POK_Action is
     (POK_Action_Ignore,
      POK_Action_Confirm,
      POK_Action_Thread_Restart,
      POK_Action_Thread_Stop_And_Start_Another,
      POK_Action_Thread_Stop,
      POK_Action_Partition_Restart,
      POK_Action_Partition_stop,
      POK_Action_Kernel_Stop,
      POK_Action_Kernel_Restart,
      POK_Action_Nothing,
      POK_Action_Invalid);

   type POK_Handled_Actions is array (Nat range <>) of Supported_POK_Action;
179
   POK_Empty_Handled_Actions : constant POK_Handled_Actions;
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194

   type Supported_ARINC653_Action is
     (ARINC653_Action_Ignore,
      ARINC653_Action_Confirm,
      ARINC653_Action_Partition_Stop,
      ARINC653_Action_Module_Stop,
      ARINC653_Action_Process_Stop,
      ARINC653_Action_Process_Stop_And_Start_Another,
      ARINC653_Action_Process_Restart,
      ARINC653_Action_Partition_Restart,
      ARINC653_Action_Module_Restart,
      ARINC653_Action_Nothing,
      ARINC653_Action_Invalid);

   type ARINC653_Actions is array (Nat range <>) of Supported_ARINC653_Action;
195
   ARINC653_Empty_Actions : constant ARINC653_Actions;
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250

   function Get_Source_Language (E : Node_Id) return Supported_Source_Language;
   --  Return the language of the entity instance (subprogram, thread,
   --  data, port, etc...) implementation. Language_None is returned
   --  if no language has been specified bu the user. It is up to the
   --  user to interpret it as an error or to assign a default value.

   function Get_Source_Text (E : Node_Id) return Name_Array;
   --  Return the list of files (source, objects or libraries)
   --  involved in the implementation of the entity E (data
   --  subprogram, thread, port, etc...).

   function Get_Source_Name (E : Node_Id) return Name_Id;
   --  Return the implementation name of the entity instance E (data
   --  subprogram, thread, port, etc...). No_Name is returned if no
   --  implementation has been specified by the user.

   function Get_Transfo_Source_Name (E : Node_Id) return Name_Id;
   --  Same as above, but with the transformations::source_name
   --  generated by the transfo package.

   function Get_Type_Source_Name (E : Node_Id) return Name_Id;
   --  Return the implementation name of the entity instance E (data
   --  subprogram, thread, port, etc...). No_Name is returned if no
   --  implementation has been specified by the user.

   -------------------------------
   -- Data Component Properties --
   -------------------------------

   --  Supported data types

   type Supported_Data_Representation is
     (Data_Array,
      Data_Boolean,
      Data_Character,
      Data_Wide_Character,
      Data_Enum,
      Data_Float,
      Data_Fixed,
      Data_Integer,
      Data_String,
      Data_Wide_String,
      Data_Struct,
      Data_Union,
      Data_With_Accessors,
      Data_None); --  Leads to an error

   type Supported_Data_Access is
     (Access_Read_Only,
      Access_Write_Only,
      Access_Read_Write,
      Access_By_Method,
      Access_None);

251
   type Supported_Concurrency_Control_Protocol is --  XXX
252
     (None_Specified, Immediate_Priority_Ceiling_Protocol,
253
      Priority_Inheritance, Priority_Ceiling, Protected_Access);
254
255

   type Supported_IEEE754_Precision is
256
     (Precision_Simple, Precision_Double, Precision_None);
257

yoogx's avatar
yoogx committed
258
   type Supported_Number_Representation is (Signed, Unsigned, None);
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

   function Get_Base_Type (D : Node_Id) return List_Id;
   --  Return the component instance that defines the base data type
   --  of component instance D or the list of component instances in
   --  case of a data structure.

   function Get_Code_Set (D : Node_Id) return Unsigned_Long_Long;
   --  Return the code set associated to the data instance D

   function Get_Element_Names (D : Node_Id) return Name_Array;
   --  Return the element names of fields name of a data structure

   function Get_Enumerators (D : Node_Id) return Name_Array;
   --  Return the enumerators of enumeration type D

   function Get_IEEE754_Precision
275
     (D : Node_Id) return Supported_IEEE754_Precision;
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
   --  Return the precision of a floating point data type

   function Get_Initial_Value (D : Node_Id) return Name_Array;
   --  Return the initial value list of a data type

   function Get_Integer_Range (D : Node_Id) return LL_Array;
   --  Return the range associated to an integer data type

   function Get_Real_Range (D : Node_Id) return LD_Array;
   --  Return the range associated to an real data type

   function Get_Mesurement_Unit (D : Node_Id) return Name_Id;
   --  Return the measurement unit of a data being communicated

   function Get_Number_Representation
     (D : Node_Id) return Supported_Number_Representation;
   --  Return the return the number representation (signed, unsigned)
   --  of the data D.

   function Get_Data_Representation
     (D : Node_Id) return Supported_Data_Representation;
   --  Return the representation kind of a data component. If no
   --  representation kind has been specified by the user, returns
   --  Data_None.

   function Get_Data_Digits (D : Node_Id) return Unsigned_Long_Long;
   --  Return the value of the "data_digits" aadl property of a data
   --  component. Return 0 if the property is not defined for the
   --  component.

   function Get_Data_Scale (D : Node_Id) return Unsigned_Long_Long;
   --  Return the value of the "data_scale" aadl property of a data
   --  component. Return 0 if the property is not defined for the
   --  component.

   function Get_Data_Size (D : Node_Id) return Size_Type;
312
   --  Return the size of the data. Returns Null_Size if not defined.
313
314

   function Get_Provided_Data_Access
315
     (D : Node_Id) return Supported_Data_Access;
316
317
318
319
320
   --  Return the provided data access of a data component instance
   --  D. Access_None is returned when the provided data access
   --  property is not defined for D.

   function Get_Priority_Celing_Of_Data_Access
321
     (D : Node_Id) return Unsigned_Long_Long;
322
323
324
325
   --  Return the prioriry associated to the data component. Otherwise,
   --  return 0.

   function Get_Required_Data_Access
326
     (D : Node_Id) return Supported_Data_Access;
327
328
329
330
331
332
333
334
335
   --  Return the required data access of a data component instance
   --  D. Access_None is returned when the required data access
   --  property is not defined for D.

   function Get_Dimension (D : Node_Id) return ULL_Array;
   --  Return the maximum length for [wide] string types and the
   --  lengths for an array.

   function Get_Concurrency_Protocol
336
     (D : Node_Id) return Supported_Concurrency_Control_Protocol;
337
338
339
340
341
342
343
344
345
346
347
348
349
   --  Return the concurrency protocol of a data type with
   --  accessors. Return Concurrency_NoneSpecified if the property is
   --  not defined.

   ---------------------------------
   -- Thread Component Properties --
   ---------------------------------

   type Supported_Thread_Dispatch_Protocol is
     (Thread_Periodic,
      Thread_Aperiodic,
      Thread_Sporadic,
      Thread_Hybrid,
yoogx's avatar
yoogx committed
350
      Thread_Timed,
351
      Thread_Background,
yoogx's avatar
yoogx committed
352
      Thread_ISR,
353
354
355
      Thread_None);

   type Time_Units is
356
     (Picosecond, Nanosecond, Microsecond, Millisecond, Second, Minute, Hour);
357
358
359
360
361
362
363
364

   type Time_Type is record
      T : Unsigned_Long_Long;
      U : Time_Units;
   end record;

   Null_Time : constant Time_Type;

365
366
   function Convert_Value_To_Time_Type (V : Node_Id) return Time_Type;

367
368
369
370
371
372
   type Supported_Thread_Implementation is
     (Thread_With_Call_Sequence,
      Thread_With_Compute_Entrypoint,
      Thread_With_Port_Compute_Entrypoint,
      Thread_Unknown);

373
374
375
   type Supported_POSIX_Scheduling_Policy is
     (SCHED_FIFO, SCHED_RR, SCHED_OTHERS, None);

376
377
378
379
   function Get_Dispatch_Offset (T : Node_Id) return Time_Type;
   --  Return the thread dispatch offset for periodic task.

   function Get_Thread_Dispatch_Protocol
380
     (T : Node_Id) return Supported_Thread_Dispatch_Protocol;
381
382
383
384
   --  Return the dispatching protocol of a given thread component. If
   --  no protocol has been specified by the user, then return
   --  Thread_None.

385
   function Get_Thread_POSIX_Scheduling_Policy
386
     (T : Node_Id) return Supported_POSIX_Scheduling_Policy;
387
388
389
   --  Return the POSIX scheduling policy of a given thread
   --  component. If no policy has been specified, then return none.

390
391
392
393
394
395
396
397
398
399
400
401
402
   function Get_Thread_Period (T : Node_Id) return Time_Type;
   --  Return the period (for periodic threads) or the minumum
   --  dispatch interval (for sporadic threads). The returned value is
   --  converted to the closest time unit depending on its unit in
   --  AADL. Raises an error if the thread is not periodic nor
   --  sporadic.

   function Get_Thread_Deadline (T : Node_Id) return Time_Type;
   --  Return the deadline of a thread. The returned value is
   --  converted to the closest time unit depending on its unit in
   --  AADL. If the thread has no deadline property defined, return
   --  the value of the thread period.

403
404
405
406
407
408
   function Get_Thread_First_Dispatch_Time (T : Node_Id) return Time_Type;
   --  Return the first dispact time of a thread. The returned value
   --  is converted to the closest time unit depending on its unit in
   --  AADL. If the thread has no deadline property defined, return
   --  the value of the thread period.

409
410
411
412
413
414
415
416
417
418
   function Get_Thread_Priority (T : Node_Id) return Unsigned_Long_Long;
   --  Return the thread priority given by the user. Otherwise, return
   --  0.

   function Get_Thread_Stack_Size (T : Node_Id) return Size_Type;
   --  Return the storage size of a thread component. The returned
   --  value is associated with its unit given in the AADL model. If
   --  the user did not give a storage size value, then returns 0 bits.

   function Get_Thread_Implementation_Kind
419
     (T : Node_Id) return Supported_Thread_Implementation;
420
421
422
423
424
   --  Return the kind of the thread implementation. Return
   --  Thread_Unknown if no valid kind can be deduced.

   function Get_Thread_Compute_Entrypoint
     (T       : Node_Id;
425
      In_Mode : Name_Id := No_Name) return Name_Id;
426
427
428
429
430
431
432
   --  Return the compute entry point of the given thread. Return
   --  No_Name in case the property is not defined for the thread.  If
   --  In_Mode is a valid mode name for the thread, return the
   --  property association declared in the contect of this mode.

   function Get_Thread_Compute_Entrypoint
     (T       : Node_Id;
433
      In_Mode : Name_Id := No_Name) return Node_Id;
434
435
436
437
438
439
   --  Same as above, but returns the whole property association

   function Get_Implementation (E : Node_Id) return Node_Id;
   --  Return the abstract component implementation attached to a
   --  component through the Implemented_As property.

440
441
442
443
444
445
446
447
   function Get_Thread_Activate_Entrypoint (T : Node_Id) return Name_Id;
   --  Return the activate entry point of the given thread. Return
   --  No_Name in case the property is not defined for the thread.

   function Get_Thread_Activate_Entrypoint (T : Node_Id) return Node_Id;
   --  Same as before but returns the classifier associated with the
   --  property (used in AADLv2).

448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
   function Get_Thread_Initialize_Entrypoint (T : Node_Id) return Name_Id;
   --  Return the initialize entry point of the given thread. Return
   --  No_Name in case the property is not defined for the thread.

   function Get_Thread_Initialize_Entrypoint (T : Node_Id) return Node_Id;
   --  Same as before but returns the classifier associated with the
   --  property (used in AADLv2).

   function Get_Thread_Recover_Entrypoint (T : Node_Id) return Name_Id;
   --  Return the recovery entry point of the given thread. Return
   --  No_Name in case the property is not defined for the thread.

   function Get_Thread_Recover_Entrypoint (T : Node_Id) return Node_Id;
   --  Same as before but returns the classifier associated with the
   --  property (used in AADLv2).

   function Is_Fusioned (E : Node_Id) return Boolean;
   --  Return True IFF the entity instance E results from a thread
   --  fusion.

468
   function Is_Priority_Shifter (E : Node_Id) return Boolean;
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
   --  Return True IFF the entity instance E is a priority shifter data.

   function Get_Thread_Scheduler (E : Node_Id) return Name_Id;
   --  Return the scheduler name

   function Get_Thread_Reference_Name (E : Node_Id) return Name_Id;
   --  Return the name original name, before without regard for later
   --  move operation

   -------------------------------------
   -- Subprogram Component Properties --
   -------------------------------------

   type Supported_Subprogram_Kind is
     (Subprogram_Unknown,
484
      Subprogram_Default,
485
486
487
488
      Subprogram_Empty,
      Subprogram_Opaque_Ada_95,
      Subprogram_Opaque_Ada_95_Transfo,
      Subprogram_Opaque_C,
yoogx's avatar
yoogx committed
489
      Subprogram_Opaque_CPP,
490
491
492
493
494
      Subprogram_Opaque_RTSJ,
      Subprogram_Simulink,
      Subprogram_Scade,
      Subprogram_Lustre,
      Subprogram_Esterel,
495
      Subprogram_Lua,
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
      Subprogram_Pure_Call_Sequence,
      Subprogram_Hybrid_Ada_95);

   function Get_Subprogram_Kind (S : Node_Id) return Supported_Subprogram_Kind;
   --  Return the kind of a subprogram depending on its internal
   --  structure. Subprogram_Unknown is returned if the subprogram
   --  kind cannot be deduced.

   ----------------------------------
   -- Process Component Properties --
   ----------------------------------

   function Get_Bound_Processor (P : Node_Id) return Node_Id;
   --  Return the processor component to which the process P is
   --  bound. Raises an error if P is not bound to any processor.

512
513
514
   function Get_Bound_Function (P : Node_Id) return Node_Id;
   --  Return the function bound to this component.

515
516
517
518
519
520
521
522
523
524
   function Get_Bound_Memory (P : Node_Id) return Node_Id;
   --  Return the memory component to which the process P is
   --  bound. Returns No_Node is no memory component is bounded.

   function Get_Needed_Memory_Size (P : Node_Id) return Unsigned_Long_Long;
   --  Return the needed memory size for a partition

   function Get_Port_Number (P : Node_Id) return Value_Id;
   --  Return the port number of the process or device P

525
526
   function Get_Byte_Count (S : Node_Id) return Unsigned_Long_Long;
   --  Get the Byte_Count property of a memory component. Return 0
527
528
529
530
531
532
533
   --  if the component is not set.

   function Get_Word_Size (S : Node_Id) return Size_Type;
   --  Get the Word_Size property of a memory component. Return Null_Size
   --  if the component is not set.

   function Get_Scheduling_Protocol
534
     (P : Node_Id) return Supported_Scheduling_Protocol;
535
536
537
538
539
540
541
542
543
   --  Get the Scheduling_Protocol of process. Return
   --  Unknown_Scheduler if undefined.

   ------------------------------------
   -- Processor Component Properties --
   ------------------------------------

   type Supported_Execution_Platform is
     (Platform_Native,
544
      Platform_Native_Compcert,
545
      Platform_Bench,
546
547
548
549
      Platform_Gumstix_RTEMS,
      Platform_Gumstix_RTEMS_POSIX,
      Platform_NDS_RTEMS,
      Platform_NDS_RTEMS_POSIX,
550
      Platform_LEON_RTEMS,
551
      Platform_LEON_RTEMS_POSIX,
julien.delange's avatar
julien.delange committed
552
      Platform_X86_RTEMS,
553
      Platform_X86_RTEMS_POSIX,
554
      Platform_X86_LINUXTASTE,
555
      Platform_LEON_GNAT,
jdelange's avatar
   
jdelange committed
556
      Platform_LEON3_SCOC3,
557
      Platform_LEON3_XM3,
558
      Platform_LEON3_XTRATUM,
559
      Platform_LEON_ORK,
560
      Platform_WIN32,
561
      Platform_LINUX32,
562
563
      Platform_LINUX32_XENOMAI_NATIVE,
      Platform_LINUX32_XENOMAI_POSIX,
564
      Platform_LINUX64,
565
566
567
      Platform_ERC32_ORK,
      Platform_ARM_DSLINUX,
      Platform_ARM_N770,
568
      Platform_ARM_CrazyFlie,
569
      Platform_MARTE_OS,
570
      Platform_VxWorks,
571
      Platform_GNAT_Runtime,
572
573
574
      Platform_None); --  Unspecified

   function Get_Execution_Platform
575
     (P : Node_Id) return Supported_Execution_Platform;
yoogx's avatar
yoogx committed
576
   function Get_Execution_Platform (P : Node_Id) return Name_Id;
577
578
   --  Return the execution platform of the given processor P

579
   function Get_Ada_Runtime (P : Node_Id) return Name_Id;
580
581
582
583
   --  Return the name of the Ada runtime library for the processor P

   function Get_USER_CFLAGS (P : Node_Id) return Name_Id;
   function Get_USER_LDFLAGS (P : Node_Id) return Name_Id;
584
585
586
587
   --  Return USER_CFLAGS and USER_LDFLAGS property for processor P

   function Get_USER_ENV (P : Node_Id) return Name_Id;
   --  Return USER_ENV property
588

589
590
591
592
593
594
   function Get_Location (P : Node_Id) return Name_Id;
   --  Return the location of the processor or device P. No_Name is
   --  returned if the processor to which O is mapped does not have a
   --  location and an error is raised if P is not mapped to any
   --  processor.

595
596
   function Get_Scheduler_Quantum (P : Node_Id) return Time_Type;

597
598
599
600
601
602
603
604
605
   type Frequency_Units is (Hz, Khz, Mhz, Ghz);

   type Frequency_Type is record
      S : Unsigned_Long_Long;
      F : Frequency_Units;
   end record;

   function Get_Processor_Frequency (P : Node_Id) return Frequency_Type;

606
607
608
609
610
   --------------------------------
   -- AADL Connection Properties --
   --------------------------------

   function Get_Bound_Bus
611
612
     (C     : Node_Id;
      Check : Boolean := True) return Node_Id;
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
   --  Return the bus component to which the connection C is
   --  bound. Return an error if no bus is bound and Check is true,
   --  and No_Node if C is not bound to any bus and Check is false.

   ------------------------------
   -- Bus Component Properties --
   ------------------------------

   type Supported_Transport_APIs is
     (Transport_BSD_Sockets,
      Transport_User,
      Transport_SpaceWire,
      Transport_None); --  Leads to an error

   function Get_Transport_API
628
629
     (B : Node_Id;
      E : Node_Id := No_Node) return Supported_Transport_APIs;
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
   --  Return the transport layer supported by the bus B

   ----------------------
   --  Port properties --
   ----------------------

   type Supported_Port_Timing is
     (Port_Timing_Sampled,
      Port_Timing_Immediate,
      Port_Timing_Delayed,
      Port_Timing_None); --  Unspecified

   type Supported_Overflow_Handling_Protocol is
     (Overflow_Handling_Protocol_DropOldest,
      Overflow_Handling_Protocol_DropNewest,
      Overflow_Handling_Protocol_Error,
      Overflow_Handling_Protocol_None); --  Unspecified

   Default_Queue_Size : constant := 16;
   --  FIXME: Find a way to fetch the value from AADL_Project

   function Get_Queue_Size (P : Node_Id) return Long_Long;
   --  Return the size of the queue correspodning to and event [data]
   --  port. Return -1 if non specified by the user.

   function Get_Port_Timing (P : Node_Id) return Supported_Port_Timing;
   --  Return the timing (sampled, immediate or delayed) of the given
   --  port. Return Port_Timing_None in case the property is not defined
   --  for the port.

   function Get_Overflow_Handling_Protocol
     (P : Node_Id) return Supported_Overflow_Handling_Protocol;
   --  Return the overflow handling protocol of the given port. Return
   --  Overflow_Handling_Protocol_None in case the property is not
   --  defined.

   function Get_Port_Urgency (P : Node_Id) return Unsigned_Long_Long;
   --  Return the urgency of the given port. Return 0 in case the
   --  property is not defined.

   function Get_Port_Compute_Entrypoint
671
672
     (P       : Node_Id;
      In_Mode : Name_Id := No_Name) return Name_Id;
673
674
675
676
   --  Return the compute entry point of the given port. Return
   --  No_Name in case the property is not defined for the port.

   function Get_Port_Compute_Entrypoint
677
678
     (P       : Node_Id;
      In_Mode : Name_Id := No_Name) return Node_Id;
679
680
681
682
683
684
   --  Same as above, but returns the whole property association

   ---------------------------------
   -- System component properties --
   ---------------------------------

685
   type Protocol_Type is (Protocol_IIOP, Protocol_DIOP, Protocol_None);
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700

   function Get_Protocol (S : Node_Id) return Protocol_Type;
   --  Return the protocol of a distributed application.

   ----------
   -- Misc --
   ----------

   procedure Init;
   --  Initialize some internal parts of the package

   No_Value : constant Value_Id := 0;
   --  Used to indicate a null value. This value does not depend on
   --  whether we use AADL values or other language values.

701
702
   function Get_ARINC653_Queuing_Discipline
     (Port : Node_Id) return ARINC653_Queuing_Discipline;
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
   --  Returns the corresponding Queuing_Discipline for the ARINC653
   --  property set.

   function Get_POK_Recovery_Errors (E : Node_Id) return POK_Handled_Errors;
   --  Returns the list of handled errors.

   function Get_POK_Recovery_Actions (E : Node_Id) return POK_Handled_Actions;
   --  Returns the list of handled actions for each error.

   function Get_ARINC653_HM_Errors (E : Node_Id) return ARINC653_Errors;
   --  Returns the list of errors declared in the Health Monitoring service
   --  of ARINC653.

   function Get_ARINC653_HM_Actions (E : Node_Id) return ARINC653_Actions;
   --  Returns the list of actions used to recover error with ARINC653.

719
720
   function Get_POK_Architecture
     (P : Node_Id) return Supported_POK_Architectures;
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
   --  Returns the value of POK_Architecture value bounded to a
   --  processor.

   function Get_POK_BSP (P : Node_Id) return Supported_POK_BSP;
   --  Returns the value of the POK_BSP property.

   function Get_POK_Scheduler (P : Node_Id) return Supported_POK_Scheduler;
   --  Returns the value of the POK::Scheduler property.

   function Get_Source_Location (E : Node_Id) return Name_Id;
   --  Returns the value of the property POK::Source_Location.

   function Get_Timeslice (T : Node_Id) return Time_Type;
   --  Returns the Time_Type associated with the property
   --  POK::Timeslice.

   function Get_Provided_Virtual_Bus_Class (E : Node_Id) return Node_Id;

   function Get_Security_Level (E : Node_Id) return Unsigned_Long_Long;

741
742
   function Get_Security_Level_Through_Virtual_Bus
     (E : Node_Id) return Unsigned_Long_Long;
743
744

   type Time_Array is array (Nat range <>) of Time_Type;
745
   Empty_Time_Array : constant Time_Array;
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792

   function Get_Execution_Time (E : Node_Id) return Time_Array;
   --  Returns the Execution Time values associated with the
   --  Execution_Time property. Returns the value Empty_Time_Array
   --  if the property is not defined.

   function Get_Bounded_Virtual_Bus_Classes (E : Node_Id) return List_Id;
   --  Returns a list of classifier with the bounded Virtual bus classes.

   function Get_POK_Mils_Verified (E : Node_Id) return Boolean;
   --  Get the POK::Mils_Verifies property and tells if it is true
   --  or false. If the property is not defined, it returns false.

   function Get_Compute_Deadline (E : Node_Id) return Time_Type;
   --  Returns the Time associated with the Compute_Deadline property.
   --  If the component does not have this property, it returns
   --  the Null_Time value.

   function Get_ARINC653_Timeout (E : Node_Id) return Time_Type;
   --  Returns the Time associated with the ARINC653::Timeout
   --  property. Returns Null_Time if not set.

   function Get_POK_Refresh_Time (E : Node_Id) return Time_Type;
   --  Returns the value of the property POK::Refresh_Time associated
   --  to a data port.

   function Get_Wait_For_All_Events (E : Node_Id) return Boolean;
   --  Return the value of the property SEI::Wait_For_All_Events.
   --  Check if a thread must wait for all events port before the execution
   --  of its subprograms.

   function Get_Miss_Rate (E : Node_Id) return Unsigned_Long_Long;
   --  Return the value of the property SEI::Stream_Miss_Rate. Returns
   --  the value as an unsigned_long_long.

   function Get_POK_Slots (E : Node_Id) return Time_Array;
   --  Return the list of time slots

   function Get_POK_Slots_Allocation (E : Node_Id) return List_Id;
   --  Get the POK::Slots_Allocation property that describes the use
   --  of the slots

   function Get_POK_Major_Frame (E : Node_Id) return Time_Type;
   --  Return the major frame value specified on a processor

   function Get_Scade_Signal
     (E       : Node_Id;
793
      In_Mode : Name_Id := No_Name) return Name_Id;
794
795
796
797
798
799
   --  Returns the name_id that correspond to the scade::signal
   --  property on a parameter.

   function Get_Code_Size (E : Node_Id) return Size_Type;
   --  Returns the value of the Source_Code_Size property.

800
801
   function Get_ARINC653_Access_Type
     (Memory : Node_Id) return ARINC653_Access_Type;
802
803
   --  Returns the access_type property value of a memory component.

804
805
   function Get_ARINC653_Memory_Kind
     (Memory : Node_Id) return ARINC653_Memory_Kind;
806
807
   --  Returns the memory_kind property value of a memory component.

yoogx's avatar
yoogx committed
808
809
810
811
812
813
814
   -----------------------
   -- Device properties --
   -----------------------

   function Get_Configuration (Device : Node_Id) return Name_Id;
   --  Returns the configuraton string attached to a device

815
816
817
   function Get_Driver_Name (Device : Node_Id) return Name_Id;
   --  Returns the name of the driver.

818
819
820
821
822
   function Get_Send_Function_Name (Device : Node_Id) return Name_Id;
   --  Returns the sender function name of a device.
   --  It corresponds to the receiver subcomponent in the abstract
   --  device that models the content of the device.

823
824
825
826
827
828
   function Get_Execution_Time (T : Node_Id) return Time_Type;
   function Get_Period (T : Node_Id) return Time_Type;

   function Get_Base_Address (D : Node_Id) return Unsigned_Long_Long;
   function Get_Memory_Size (D : Node_Id) return Size_Type;

829
830
831
832
833
834
   --------------------------
   -- Processor properties --
   --------------------------

   function Get_Core_Id (D : Node_Id) return Unsigned_Long_Long;

835
836
837
private

   Empty_Name_Array : constant Name_Array (1 .. 0) := (others => No_Name);
838
839
840
841
842
   Empty_ULL_Array  : constant ULL_Array (1 .. 0)  := (others => 0);
   Empty_LL_Array   : constant LL_Array (1 .. 0)   := (others => 0);
   Empty_LD_Array   : constant LD_Array (1 .. 0)   := (others => 0.0);
   Empty_Time_Array : constant Time_Array (1 .. 0) :=
     (others => (0, Picosecond));
843

844
845
   POK_Empty_Handled_Actions : constant POK_Handled_Actions (1 .. 0) :=
     (others => POK_Action_Invalid);
846

847
848
   POK_Empty_Handled_Errors : constant POK_Handled_Errors (1 .. 0) :=
     (others => POK_Error_Invalid);
849

850
851
   ARINC653_Empty_Actions : constant ARINC653_Actions (1 .. 0) :=
     (others => ARINC653_Action_Invalid);
852

853
854
   ARINC653_Empty_Errors : constant ARINC653_Errors (1 .. 0) :=
     (others => ARINC653_Error_Invalid);
855
856
857
858
859
860

   Null_Size : constant Size_Type := (0, Bit);

   Null_Time : constant Time_Type := (0, Picosecond);

end Ocarina.Backends.Properties;