Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
8d81de89
Commit
8d81de89
authored
Jan 03, 2015
by
yoogx
Browse files
Merge branch 'master' of
https://github.com/yoogx/ocarina
parents
1f2a0bb5
4f64f134
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-backends-c_common-mapping.adb
View file @
8d81de89
...
...
@@ -2986,8 +2986,8 @@ package body Ocarina.Backends.C_Common.Mapping is
end
if
;
Get_Name_String
(
Display_Name
(
Identifier
(
Parent
)));
Add_Str_To_Name_Buffer
(
"_"
);
else
if
Is_Out
(
E
)
then
F
:=
Item
(
AIN
.
First_Node
(
Get_Destination_Ports
(
E
)));
...
...
@@ -3026,7 +3026,30 @@ package body Ocarina.Backends.C_Common.Mapping is
is
N
:
Name_Id
;
begin
N
:=
Map_Port
(
E
,
Containing_Component
);
--
-- Typically, the following block of code is used
-- to prefix the port name by the parent subcomponent
-- name. For DeOS, we do not prefix by the subcomponent,
-- Port Name have to be the same.
--
if
Get_Connection_Pattern
(
E
)
=
Inter_Process
and
then
POK_Flavor
=
DEOS
then
if
Is_In
(
E
)
then
Get_Name_String
(
Display_Name
(
Identifier
(
E
)));
else
Get_Name_String
(
Display_Name
(
Identifier
(
Item
(
AIN
.
First_Node
(
Destinations
(
E
))))));
end
if
;
N
:=
Name_Find
;
else
N
:=
Map_Port
(
E
,
Containing_Component
);
end
if
;
if
Is_Global
then
Get_Name_String
(
N
);
...
...
src/backends/ocarina-backends-deos_conf-hm.adb
View file @
8d81de89
with
Ada
.
Strings
;
use
Ada
.
Strings
;
with
Ada
.
Strings
.
Fixed
;
use
Ada
.
Strings
.
Fixed
;
-- with Locations;
with
Ocarina
.
ME_AADL
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nutils
;
...
...
@@ -192,6 +196,7 @@ package body Ocarina.Backends.Deos_Conf.Hm is
System_Errors
:
Node_Id
;
Multi_Partition_HM
:
Node_Id
;
Partition_HM
:
Node_Id
;
Partition_Identifier
:
Unsigned_Long_Long
;
begin
U
:=
XTN
.
Unit
(
Backend_Node
(
Identifier
(
E
)));
P
:=
XTN
.
Node
(
Backend_Node
(
Identifier
(
E
)));
...
...
@@ -201,6 +206,8 @@ package body Ocarina.Backends.Deos_Conf.Hm is
Current_XML_Node
:=
XTN
.
Root_Node
(
XTN
.
XML_File
(
U
));
Partition_Identifier
:=
1
;
--
-- For now, just generate the default HM policy.
--
...
...
@@ -250,21 +257,6 @@ package body Ocarina.Backends.Deos_Conf.Hm is
Add_Error_Action
(
Multi_Partition_HM
,
"9"
,
"MODULE"
,
"IGNORE"
);
Add_Error_Action
(
Multi_Partition_HM
,
"10"
,
"MODULE"
,
"IGNORE"
);
--
-- The PartitionHM
--
Partition_HM
:=
Make_XML_Node
(
"PartitionHM"
);
Append_Node_To_List
(
Partition_HM
,
XTN
.
Subitems
(
HM_Node
));
XTU
.
Add_Attribute
(
"TableIdentifier"
,
"1"
,
Partition_HM
);
XTU
.
Add_Attribute
(
"TableName"
,
"1"
,
Partition_HM
);
XTU
.
Add_Attribute
(
"MultiPartitionHMTableNameRef"
,
"default MultiPartitionHM"
,
Partition_HM
);
if
not
AINU
.
Is_Empty
(
Subcomponents
(
E
))
then
S
:=
First_Node
(
Subcomponents
(
E
));
while
Present
(
S
)
loop
...
...
@@ -273,6 +265,29 @@ package body Ocarina.Backends.Deos_Conf.Hm is
if
AINU
.
Is_Virtual_Processor
(
Corresponding_Instance
(
S
))
then
Visit
(
Corresponding_Instance
(
S
));
--
-- The PartitionHM
--
Partition_HM
:=
Make_XML_Node
(
"PartitionHM"
);
Append_Node_To_List
(
Partition_HM
,
XTN
.
Subitems
(
HM_Node
));
XTU
.
Add_Attribute
(
"TableIdentifier"
,
Trim
(
Unsigned_Long_Long
'
Image
(
Partition_Identifier
),
Left
),
Partition_HM
);
XTU
.
Add_Attribute
(
"TableName"
,
"Unique name for partition "
&
Trim
(
Unsigned_Long_Long
'
Image
(
Partition_Identifier
),
Left
),
Partition_HM
);
XTU
.
Add_Attribute
(
"MultiPartitionHMTableNameRef"
,
"default MultiPartitionHM"
,
Partition_HM
);
Partition_Identifier
:=
Partition_Identifier
+
1
;
end
if
;
S
:=
Next_Node
(
S
);
end
loop
;
...
...
src/backends/ocarina-backends-deos_conf-mapping.adb
View file @
8d81de89
...
...
@@ -967,6 +967,50 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
return
Module_HM
;
end
Map_Processor_HM_Table
;
-----------------------
-- Map_Sampling_Port --
-----------------------
function
Map_Sampling_Port
(
Port
:
Node_Id
)
return
Node_Id
is
Sampling_Port
:
Node_Id
;
Size
:
Unsigned_Long_Long
;
begin
Sampling_Port
:=
Make_XML_Node
(
"SamplingPort"
);
Size
:=
To_Bytes
(
Get_Data_Size
(
Corresponding_Instance
(
Port
)));
if
Is_In
(
Port
)
then
XTU
.
Add_Attribute
(
"Name"
,
Get_Name_String
(
AIN
.
Name
(
Identifier
(
Port
))),
Sampling_Port
);
else
XTU
.
Add_Attribute
(
"Name"
,
Get_Name_String
(
AIN
.
Name
(
Identifier
(
Item
(
AIN
.
First_Node
(
Destinations
(
Port
)))))),
Sampling_Port
);
end
if
;
XTU
.
Add_Attribute
(
"MaxMessageSize"
,
Trim
(
Unsigned_Long_Long
'
Image
(
Size
),
Left
),
Sampling_Port
);
if
Is_In
(
Port
)
then
XTU
.
Add_Attribute
(
"Direction"
,
"DESTINATION"
,
Sampling_Port
);
elsif
Is_Out
(
Port
)
then
XTU
.
Add_Attribute
(
"Direction"
,
"SOURCE"
,
Sampling_Port
);
end
if
;
XTU
.
Add_Attribute
(
"SourcePartitionName"
,
""
,
Sampling_Port
);
XTU
.
Add_Attribute
(
"SourcePortName"
,
""
,
Sampling_Port
);
XTU
.
Add_Attribute
(
"CustomIOFunction"
,
""
,
Sampling_Port
);
XTU
.
Add_Attribute
(
"AccessRateInNanoseconds"
,
"12500000"
,
Sampling_Port
);
return
Sampling_Port
;
end
Map_Sampling_Port
;
-------------------
-- Map_Partition --
-------------------
...
...
@@ -1030,14 +1074,14 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
Trim
(
Unsigned_Long_Long
'
Image
(
Period_Ns
),
Left
)
&
"000000"
,
Left
),
Partition_Node
);
XTU
.
Add_Attribute
(
"Duration"
,
Trim
(
Unsigned_Long_Long
'
Image
(
Duration_Ns
),
Left
)
&
"000000"
,
Left
),
Partition_Node
);
XTU
.
Add_Attribute
(
"ExecutableImageName"
,
...
...
src/backends/ocarina-backends-deos_conf-mapping.ads
View file @
8d81de89
...
...
@@ -43,4 +43,6 @@ package Ocarina.Backends.Deos_Conf.Mapping is
function
Map_Processor_HM_Table
(
Processor
:
Node_Id
)
return
Node_Id
;
function
Map_Sampling_Port
(
Port
:
Node_Id
)
return
Node_Id
;
end
Ocarina
.
Backends
.
Deos_Conf
.
Mapping
;
src/backends/ocarina-backends-deos_conf-partitions.adb
View file @
8d81de89
...
...
@@ -31,8 +31,10 @@
-- --
------------------------------------------------------------------------------
with
Ada
.
Strings
;
use
Ada
.
Strings
;
with
Ada
.
Strings
.
Fixed
;
use
Ada
.
Strings
.
Fixed
;
-- with Ada.Strings; use Ada.Strings;
-- with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with
Ada
.
Text_IO
;
with
Ada
.
Integer_Text_IO
;
with
Ocarina
.
Backends
.
Messages
;
with
Ocarina
.
ME_AADL
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
...
...
@@ -41,13 +43,14 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with
Ocarina
.
Backends
.
Utils
;
with
Ocarina
.
Backends
.
Properties
;
with
Ocarina
.
Backends
.
XML_Values
;
with
Ocarina
.
Backends
.
XML_Tree
.
Nodes
;
with
Ocarina
.
Backends
.
XML_Tree
.
Nutils
;
with
Ocarina
.
Backends
.
Deos_Conf
.
Mapping
;
package
body
Ocarina
.
Backends
.
Deos_Conf
.
Partitions
is
use
Ada
.
Text_IO
;
use
Ada
.
Integer_Text_IO
;
use
Ocarina
.
ME_AADL
;
use
Ocarina
.
Backends
.
Utils
;
...
...
@@ -57,7 +60,6 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
use
Ocarina
.
Backends
.
XML_Tree
.
Nutils
;
use
Ocarina
.
Backends
.
Properties
;
use
Ocarina
.
Backends
.
Deos_Conf
.
Mapping
;
use
Ocarina
.
Backends
.
XML_Values
;
package
AIN
renames
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
package
AINU
renames
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nutils
;
...
...
@@ -94,6 +96,29 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
function
Make_Default_Memory_Region
return
Node_Id
;
function
Make_Memory_Region
(
Segment
:
Node_Id
)
return
Node_Id
;
function
Hex_Print
(
Num
:
in
Integer
;
Num_Of_Digits
:
in
Positive
)
return
String
;
function
Hex_Print
(
Num
:
in
Integer
;
Num_Of_Digits
:
in
Positive
)
return
String
is
Temp_Str
:
String
(
1
..
Num_Of_Digits
+
5
)
:=
(
others
=>
'0'
);
New_Str
:
String
(
1
..
Num_Of_Digits
)
:=
(
others
=>
'0'
);
First_Digit
:
Positive
;
begin
Put
(
To
=>
Temp_Str
,
Item
=>
Num
,
Base
=>
16
);
for
I
in
1
..
Num_Of_Digits
+
4
loop
if
Temp_Str
(
I
)
=
'#'
then
First_Digit
:=
I
+
1
;
exit
;
end
if
;
end
loop
;
New_Str
(
First_Digit
-
4
..
Num_Of_Digits
)
:=
Temp_Str
(
First_Digit
..
Num_Of_Digits
+
4
);
return
New_Str
;
end
Hex_Print
;
--------------------------------
-- Make_Default_Memory_Region --
...
...
@@ -126,15 +151,18 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
XTU
.
Add_Attribute
(
"Name"
,
"Initial RAM Pool"
,
N
);
XTU
.
Add_Attribute
(
"Type"
,
"Initial RAM Pool"
,
N
);
XTU
.
Add_Attribute
(
"Address"
,
New_Numeric_Value
(
Get_Base_Address
(
Segment
),
1
,
16
),
"0x"
&
Hex_Print
(
Integer
(
Get_Base_Address
(
Segment
)),
8
),
N
);
-- Put (Size_Str, To_Bytes
-- (Get_Memory_Size (Segment)), 16);
XTU
.
Add_Attribute
(
"Size"
,
Trim
(
Unsigned_Long_Long
'
Image
(
To_Bytes
(
Get_Memory_Size
(
Segment
))),
Left
),
"0x"
&
Hex_Print
(
Integer
(
To_Bytes
(
Get_Memory_Size
(
Segment
))),
8
),
N
);
XTU
.
Add_Attribute
(
"AccessRights"
,
"READ_WRITE"
,
N
);
XTU
.
Add_Attribute
(
"PlatformMemoryPool"
,
"0"
,
N
);
...
...
@@ -411,9 +439,11 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
procedure
Visit_Virtual_Processor_Instance
(
E
:
Node_Id
)
is
S
:
Node_Id
;
F
:
Node_Id
;
Corresponding_Process
:
Node_Id
:=
No_Node
;
Memory_Segment
:
Node_Id
:=
No_Node
;
Partition_Node
:
Node_Id
;
Sampling_Ports
:
Node_Id
:=
No_Node
;
begin
Corresponding_Process
:=
Find_Associated_Process
(
E
);
...
...
@@ -468,6 +498,42 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Append_Node_To_List
(
Memory_Regions
,
XTN
.
Subitems
(
Partition_Node
));
--
-- Then, we configure the inter-partitions communication
-- ports (sampling/queueing).
--
if
not
AINU
.
Is_Empty
(
Features
(
Corresponding_Process
))
then
Sampling_Ports
:=
Make_XML_Node
(
"SamplingPorts"
);
F
:=
First_Node
(
Features
(
Corresponding_Process
));
while
Present
(
F
)
loop
if
Kind
(
F
)
=
K_Port_Spec_Instance
and
then
Get_Connection_Pattern
(
F
)
=
Inter_Process
then
if
Is_Data
(
F
)
and
then
not
Is_Event
(
F
)
and
then
not
(
Is_In
(
F
)
and
then
Is_Out
(
F
))
then
Append_Node_To_List
(
Map_Sampling_Port
(
F
),
XTN
.
Subitems
(
Sampling_Ports
));
end
if
;
end
if
;
F
:=
Next_Node
(
F
);
end
loop
;
end
if
;
if
Sampling_Ports
/=
No_Node
and
then
XTN
.
Subitems
(
Sampling_Ports
)
/=
No_List
then
Append_Node_To_List
(
Sampling_Ports
,
XTN
.
Subitems
(
Partition_Node
));
end
if
;
Partition_Identifier
:=
Partition_Identifier
+
1
;
end
if
;
if
not
AINU
.
Is_Empty
(
Subcomponents
(
E
))
then
...
...
src/backends/ocarina-backends-deos_conf-schedule.adb
View file @
8d81de89
...
...
@@ -12,6 +12,7 @@ with Ocarina.Instances.Queries;
with
Ocarina
.
Backends
.
Properties
.
ARINC653
;
-- with Ocarina.Backends.Properties;
with
Ocarina
.
Backends
.
Utils
;
with
Ocarina
.
Backends
.
XML_Tree
.
Nodes
;
with
Ocarina
.
Backends
.
XML_Tree
.
Nutils
;
-- with Ocarina.Backends.Deos_Conf.Mapping;
...
...
@@ -26,6 +27,7 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
use
Ocarina
.
ME_AADL
.
AADL_Instances
.
Entities
;
use
Ocarina
.
Backends
.
XML_Tree
.
Nutils
;
use
Ocarina
.
Backends
.
Utils
;
use
Ocarina
.
Backends
.
Properties
.
ARINC653
;
-- use Ocarina.Backends.Properties;
-- use Ocarina.Backends.Deos_Conf.Mapping;
...
...
@@ -158,7 +160,10 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
Time_Window_Node
:
Node_Id
;
Module_Schedule
:
constant
Schedule_Window_Record_Term_Array
:=
Get_Module_Schedule_Property
(
Processor
);
Offset
:
Unsigned_Long_Long
;
Slot_Duration
:
Unsigned_Long_Long
;
begin
Offset
:=
0
;
for
J
in
Module_Schedule
'
Range
loop
Time_Window_Node
:=
Make_XML_Node
(
"PartitionTimeWindow"
);
...
...
@@ -172,13 +177,16 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
-- For now, we assume the partition duration
-- is in milliseconds.
--
Slot_Duration
:=
To_Milliseconds
(
Module_Schedule
(
J
).
Duration
)
*
1_000_000
;
XTU
.
Add_Attribute
(
"Duration"
,
Trim
(
Module_Schedule
(
J
).
Duration
.
T
'
Img
,
Left
)
&
"000000"
,
Trim
(
Unsigned_Long_Long
'
Image
(
Slot_Duration
),
Left
),
Time_Window_Node
);
XTU
.
Add_Attribute
(
"Offset"
,
Trim
(
Unsigned_Long_Long
'
Image
(
Offset
),
Left
),
Time_Window_Node
);
XTU
.
Add_Attribute
(
"Offset"
,
"0"
,
Time_Window_Node
);
XTU
.
Add_Attribute
(
"PeriodicProcessingStart"
,
"true"
,
Time_Window_Node
);
XTU
.
Add_Attribute
(
"RepeatWindowAtNanosecondInterval"
,
...
...
@@ -189,6 +197,7 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
Get_Name_String
(
Module_Schedule
(
J
).
Partition
),
Time_Window_Node
);
Offset
:=
Offset
+
Slot_Duration
;
end
loop
;
end
Fill_Scheduling_Slots
;
...
...
src/backends/ocarina-backends-pok_c-main.adb
View file @
8d81de89
...
...
@@ -648,7 +648,17 @@ package body Ocarina.Backends.POK_C.Main is
N
:=
Map_Time
(
Get_POK_Refresh_Time
(
F
));
end
if
;
else
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
0
,
1
,
10
));
if
POK_Flavor
=
DEOS
then
--
-- DeOS needs a value to refresh the port.
--
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
1_000_000
,
1
,
10
));
else
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
0
,
1
,
10
));
end
if
;
end
if
;
Append_Node_To_List
(
N
,
Call_Parameters
);
...
...
@@ -777,7 +787,17 @@ package body Ocarina.Backends.POK_C.Main is
end
if
;
else
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
0
,
1
,
10
));
if
POK_Flavor
=
DEOS
then
--
-- DeOS needs a value to refresh the port.
--
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
1_000_000
,
1
,
10
));
else
N
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
0
,
1
,
10
));
end
if
;
end
if
;
Append_Node_To_List
(
N
,
Call_Parameters
);
...
...
@@ -978,6 +998,7 @@ package body Ocarina.Backends.POK_C.Main is
Statements
:=
New_List
(
CTN
.
K_Statement_List
);
Add_Include
(
E
=>
RH
(
RH_Activity
));
Add_Include
(
E
=>
RH
(
RH_Gtypes
));
if
Use_ARINC653_API
then
Process_Variable_Type
:=
RE
(
RE_Process_Id_Type
);
...
...
src/backends/ocarina-backends-pok_c-runtime.adb
View file @
8d81de89
...
...
@@ -131,19 +131,28 @@ package body Ocarina.Backends.POK_C.Runtime is
if
POK_Flavor
=
DEOS
then
for
E
in
ART_Id
loop
RE_Header_Table
(
E
)
:=
RH_Apex
;
end
loop
;
RE_Header_Table
(
RE_Pok_Port_Kind_Sampling
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Source
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Destination
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Pok_Errno_Empty
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Null
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Normal
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Bool_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint8_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint16_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint32_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint64_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int8_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int16_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int32_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int64_T
)
:=
RH_Apex
;
for
E
in
ARF_Id
loop
RE_Header_Table
(
E
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Null
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Normal
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Bool_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint8_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint16_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint32_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Uint64_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int8_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int16_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int32_T
)
:=
RH_Apex
;
RE_Header_Table
(
RE_Int64_T
)
:=
RH_Apex
;
end
loop
;
for
E
in
ART_Id
loop
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment