ocarina-backends-properties.ads 31.2 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-2015 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
   type ULL_Array is array (Nat range <>) of Unsigned_Long_Long;
   type LL_Array is array (Nat range <>) of Long_Long;
41
42
43
44
   type LD_Array is array (Nat range <>) of Long_Double;

   --  Common types to several components and entities

45
   type Size_Units is (Bit, Byte, Kilo_Byte, Mega_Byte, Giga_Byte, Tera_Byte);
46
47
48
49
50
51
52
53
54
55
56
57
58

   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,
59
      Language_Device,
60
      Language_Gui,
61
      Language_Lua,
62
      Language_Lustre,
63
      Language_Rhapsody,
64
      Language_SDL_RTDS,
65
66
      Language_CPP,
      Language_SDL_OpenGEODE,
67
      Language_RTSJ,
68
69
70
      Language_Scade,
      Language_SDL,
      Language_Simulink,
71
72
      Language_System_C,
      Language_VHDL,
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
      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
96
     (RMS, EDF, LLF, RR, Static, Invalid_Scheduler);
97
98

   type Supported_POK_Architectures is
99
     (POK_Arch_x86, POK_Arch_Sparc, POK_Arch_Ppc, Invalid_Architecture);
100
101
102

   type Supported_POK_BSP is
     (POK_BSP_x86_qemu,
103
      POK_BSP_x86_qemu_vmm,
104
105
106
107
      POK_BSP_Leon,
      POK_BSP_prep,
      Invalid_BSP);

108
   type ARINC653_Queuing_Discipline is (Fifo, Priority_Based, Invalid);
109

110
   type ARINC653_Access_Type is (Read, Write, Read_Write, Invalid);
111

112
   type ARINC653_Memory_Kind is (Code, Data, Invalid);
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

   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;
131
   POK_Empty_Handled_Errors : constant POK_Handled_Errors;
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

   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;
152
   ARINC653_Empty_Errors : constant ARINC653_Errors;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

   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;
168
   POK_Empty_Handled_Actions : constant POK_Handled_Actions;
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

   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;
184
   ARINC653_Empty_Actions : constant ARINC653_Actions;
185
186
187
188
189
190
191
192
193
194
195
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

   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);

   type Supported_Concurrency_Control_Protocol is
     (Concurrency_NoneSpecified,
      Concurrency_Read_Only,
      Concurrency_Protected_Access,
244
245
      Concurrency_Immediate_Priority_Ceiling,
      Concurrency_Priority_Inheritance,
246
247
248
      Concurrency_Priority_Ceiling);

   type Supported_IEEE754_Precision is
249
     (Precision_Simple, Precision_Double, Precision_None);
250
251

   type Supported_Number_Representation is
252
     (Representation_Signed, Representation_Unsigned, Representation_None);
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268

   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
269
     (D : Node_Id) return Supported_IEEE754_Precision;
270
271
272
273
274
275
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
   --  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;
306
   --  Return the size of the data. Returns Null_Size if not defined.
307
308

   function Get_Provided_Data_Access
309
     (D : Node_Id) return Supported_Data_Access;
310
311
312
313
314
   --  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
315
     (D : Node_Id) return Unsigned_Long_Long;
316
317
318
319
   --  Return the prioriry associated to the data component. Otherwise,
   --  return 0.

   function Get_Required_Data_Access
320
     (D : Node_Id) return Supported_Data_Access;
321
322
323
324
325
326
327
328
329
   --  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
330
     (D : Node_Id) return Supported_Concurrency_Control_Protocol;
331
332
333
334
335
336
337
338
339
340
341
342
343
   --  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
344
      Thread_Timed,
345
      Thread_Background,
yoogx's avatar
yoogx committed
346
      Thread_ISR,
347
348
349
      Thread_None);

   type Time_Units is
350
     (Picosecond, Nanosecond, Microsecond, Millisecond, Second, Minute, Hour);
351
352
353
354
355
356
357
358

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

   Null_Time : constant Time_Type;

359
360
   function Convert_Value_To_Time_Type (V : Node_Id) return Time_Type;

361
362
363
364
365
366
   type Supported_Thread_Implementation is
     (Thread_With_Call_Sequence,
      Thread_With_Compute_Entrypoint,
      Thread_With_Port_Compute_Entrypoint,
      Thread_Unknown);

367
368
369
   type Supported_POSIX_Scheduling_Policy is
     (SCHED_FIFO, SCHED_RR, SCHED_OTHERS, None);

370
371
372
373
   function Get_Dispatch_Offset (T : Node_Id) return Time_Type;
   --  Return the thread dispatch offset for periodic task.

   function Get_Thread_Dispatch_Protocol
374
     (T : Node_Id) return Supported_Thread_Dispatch_Protocol;
375
376
377
378
   --  Return the dispatching protocol of a given thread component. If
   --  no protocol has been specified by the user, then return
   --  Thread_None.

379
   function Get_Thread_POSIX_Scheduling_Policy
380
     (T : Node_Id) return Supported_POSIX_Scheduling_Policy;
381
382
383
   --  Return the POSIX scheduling policy of a given thread
   --  component. If no policy has been specified, then return none.

384
385
386
387
388
389
390
391
392
393
394
395
396
   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.

397
398
399
400
401
402
   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.

403
404
405
406
407
408
409
410
411
412
   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
413
     (T : Node_Id) return Supported_Thread_Implementation;
414
415
416
417
418
   --  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;
419
      In_Mode : Name_Id := No_Name) return Name_Id;
420
421
422
423
424
425
426
   --  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;
427
      In_Mode : Name_Id := No_Name) return Node_Id;
428
429
430
431
432
433
   --  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.

434
435
436
437
438
439
440
441
   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).

442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
   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.

462
   function Is_Priority_Shifter (E : Node_Id) return Boolean;
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
   --  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,
478
      Subprogram_Default,
479
480
481
482
      Subprogram_Empty,
      Subprogram_Opaque_Ada_95,
      Subprogram_Opaque_Ada_95_Transfo,
      Subprogram_Opaque_C,
yoogx's avatar
yoogx committed
483
      Subprogram_Opaque_CPP,
484
485
486
487
488
      Subprogram_Opaque_RTSJ,
      Subprogram_Simulink,
      Subprogram_Scade,
      Subprogram_Lustre,
      Subprogram_Esterel,
489
      Subprogram_Lua,
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
      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.

506
507
508
   function Get_Bound_Function (P : Node_Id) return Node_Id;
   --  Return the function bound to this component.

509
510
511
512
513
514
515
516
517
518
   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

519
520
   function Get_Byte_Count (S : Node_Id) return Unsigned_Long_Long;
   --  Get the Byte_Count property of a memory component. Return 0
521
522
523
524
525
526
527
   --  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
528
     (P : Node_Id) return Supported_Scheduling_Protocol;
529
530
531
532
533
534
535
536
537
   --  Get the Scheduling_Protocol of process. Return
   --  Unknown_Scheduler if undefined.

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

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

   function Get_Execution_Platform
567
     (P : Node_Id) return Supported_Execution_Platform;
yoogx's avatar
yoogx committed
568
   function Get_Execution_Platform (P : Node_Id) return Name_Id;
569
570
571
572
573
574
575
576
   --  Return the execution platform of the given processor P

   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.

577
578
   function Get_Scheduler_Quantum (P : Node_Id) return Time_Type;

579
580
581
582
583
   --------------------------------
   -- AADL Connection Properties --
   --------------------------------

   function Get_Bound_Bus
584
585
     (C     : Node_Id;
      Check : Boolean := True) return Node_Id;
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
   --  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
601
602
     (B : Node_Id;
      E : Node_Id := No_Node) return Supported_Transport_APIs;
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
   --  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
644
645
     (P       : Node_Id;
      In_Mode : Name_Id := No_Name) return Name_Id;
646
647
648
649
   --  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
650
651
     (P       : Node_Id;
      In_Mode : Name_Id := No_Name) return Node_Id;
652
653
654
655
656
657
   --  Same as above, but returns the whole property association

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

658
   type Protocol_Type is (Protocol_IIOP, Protocol_DIOP, Protocol_None);
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673

   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.

674
675
   function Get_ARINC653_Queuing_Discipline
     (Port : Node_Id) return ARINC653_Queuing_Discipline;
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
   --  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.

692
693
   function Get_POK_Architecture
     (P : Node_Id) return Supported_POK_Architectures;
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
   --  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;

714
715
   function Get_Security_Level_Through_Virtual_Bus
     (E : Node_Id) return Unsigned_Long_Long;
716
717

   type Time_Array is array (Nat range <>) of Time_Type;
718
   Empty_Time_Array : constant Time_Array;
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765

   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;
766
      In_Mode : Name_Id := No_Name) return Name_Id;
767
768
769
770
771
772
   --  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.

773
774
   function Get_ARINC653_Access_Type
     (Memory : Node_Id) return ARINC653_Access_Type;
775
776
   --  Returns the access_type property value of a memory component.

777
778
   function Get_ARINC653_Memory_Kind
     (Memory : Node_Id) return ARINC653_Memory_Kind;
779
780
   --  Returns the memory_kind property value of a memory component.

yoogx's avatar
yoogx committed
781
782
783
784
785
786
787
   -----------------------
   -- Device properties --
   -----------------------

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

788
789
790
   function Get_Driver_Name (Device : Node_Id) return Name_Id;
   --  Returns the name of the driver.

791
792
793
794
795
   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.

796
797
798
799
800
801
   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;

802
803
804
805
806
807
   --------------------------
   -- Processor properties --
   --------------------------

   function Get_Core_Id (D : Node_Id) return Unsigned_Long_Long;

808
809
810
private

   Empty_Name_Array : constant Name_Array (1 .. 0) := (others => No_Name);
811
812
813
814
815
   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));
816

817
818
   POK_Empty_Handled_Actions : constant POK_Handled_Actions (1 .. 0) :=
     (others => POK_Action_Invalid);
819

820
821
   POK_Empty_Handled_Errors : constant POK_Handled_Errors (1 .. 0) :=
     (others => POK_Error_Invalid);
822

823
824
   ARINC653_Empty_Actions : constant ARINC653_Actions (1 .. 0) :=
     (others => ARINC653_Action_Invalid);
825

826
827
   ARINC653_Empty_Errors : constant ARINC653_Errors (1 .. 0) :=
     (others => ARINC653_Error_Invalid);
828
829
830
831
832
833

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

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

end Ocarina.Backends.Properties;