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
0229a69d
Commit
0229a69d
authored
Dec 07, 2014
by
Julien
Browse files
Code that can compile on deos
parent
45ac55a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-backends-c_common-mapping.adb
View file @
0229a69d
...
...
@@ -3357,6 +3357,33 @@ package body Ocarina.Backends.C_Common.Mapping is
return
Make_Call_Profile
(
S
,
Parameters
);
end
Map_Time
;
----------------------------
-- Map_Time_To_Nanosecond --
----------------------------
function
Map_Time_To_Nanosecond
(
T
:
Time_Type
)
return
Node_Id
is
Time
:
Unsigned_Long_Long
;
begin
case
T
.
U
is
when
Millisecond
=>
Time
:=
T
.
T
*
1000_000
;
when
Second
=>
Time
:=
T
.
T
*
1000_000_000
;
when
Microsecond
=>
Time
:=
T
.
T
*
1000
;
when
Nanosecond
=>
Time
:=
T
.
T
;
when
others
=>
raise
Program_Error
with
"time value not handled at this time"
;
end
case
;
return
Make_Literal
(
New_Int_Value
(
Time
,
1
,
10
));
end
Map_Time_To_Nanosecond
;
-----------------------------
-- Map_Time_To_Millisecond --
-----------------------------
...
...
src/backends/ocarina-backends-c_common-mapping.ads
View file @
0229a69d
...
...
@@ -209,6 +209,9 @@ package Ocarina.Backends.C_Common.Mapping is
function
Map_Time_To_Millisecond
(
T
:
Time_Type
)
return
Node_Id
;
-- Return a amount of millisecond from a time
function
Map_Time_To_Nanosecond
(
T
:
Time_Type
)
return
Node_Id
;
-- Return a amount of nanosecond from a time
function
Map_Simulink_Var
(
Corresponding_Feature
:
Node_Id
)
return
Node_Id
;
-- Map simulink variable name
...
...
src/backends/ocarina-backends-c_tree-nutils.adb
View file @
0229a69d
...
...
@@ -2265,7 +2265,7 @@ package body Ocarina.Backends.C_Tree.Nutils is
(
Defining_Identifier
=>
Make_Defining_Identifier
(
VN
(
V_Ret
)),
Used_Type
=>
RE
(
RE_Pok_Ret_T
));
Append_Node_To_List
(
N
,
Declarations
);
elsif
POK_Flavor
=
ARINC653
then
elsif
Use_
ARINC653
_API
then
N
:=
Make_Variable_Declaration
(
Defining_Identifier
=>
Make_Defining_Identifier
(
VN
(
V_Ret
)),
...
...
src/backends/ocarina-backends-pok_c-main.adb
View file @
0229a69d
...
...
@@ -207,41 +207,54 @@ package body Ocarina.Backends.POK_C.Main is
end
if
;
if
Get_Thread_Deadline
(
E
)
/=
Null_Time
then
if
Use_
ARINC653
_API
then
if
POK_Flavor
=
ARINC653
then
Member_Value
:=
Map_Time_To_Millisecond
(
Get_Thread_Deadline
(
E
));
els
e
els
if
POK_Flavor
=
POK
then
Member_Value
:=
Map_Time
(
Get_Thread_Deadline
(
E
));
else
Member_Value
:=
No_Node
;
end
if
;
N
:=
Make_Expression
(
Left_Expr
=>
Make_Member_Designator
(
RE
(
RE_Deadline
),
Copy_Node
(
Tattr
)),
Operator
=>
Op_Equal
,
Right_Expr
=>
Member_Value
);
Append_Node_To_List
(
N
,
Statements
);
if
Member_Value
/=
No_Node
then
N
:=
Make_Expression
(
Left_Expr
=>
Make_Member_Designator
(
RE
(
RE_Deadline
),
Copy_Node
(
Tattr
)),
Operator
=>
Op_Equal
,
Right_Expr
=>
Member_Value
);
Append_Node_To_List
(
N
,
Statements
);
end
if
;
else
Display_Error
(
"Deadline not specified"
,
Fatal
=>
False
);
end
if
;
if
Get_Thread_Period
(
E
)
/=
Null_Time
then
if
Use_ARINC653_API
then
Member_Value
:=
Map_Time_To_Millisecond
(
Get_Thread_Period
(
E
));
if
POK_Flavor
=
POK
then
Member_Value
:=
Map_Time_To_Millisecond
(
Get_Thread_Period
(
E
));
elsif
POK_Flavor
=
DEOS
then
Member_Value
:=
Map_Time_To_Nanosecond
(
Get_Thread_Period
(
E
));
end
if
;
else
Member_Value
:=
Map_Time
(
Get_Thread_Period
(
E
));
end
if
;
N
:=
Make_Expression
(
Left_Expr
=>
Make_Member_Designator
(
RE
(
RE_Period
),
Copy_Node
(
Tattr
)),
Operator
=>
Op_Equal
,
Right_Expr
=>
Member_Value
);
if
Member_Value
/=
No_Node
then
N
:=
Make_Expression
(
Left_Expr
=>
Make_Member_Designator
(
RE
(
RE_Period
),
Copy_Node
(
Tattr
)),
Operator
=>
Op_Equal
,
Right_Expr
=>
Member_Value
);
Append_Node_To_List
(
N
,
Statements
);
Append_Node_To_List
(
N
,
Statements
);
end
if
;
else
Display_Error
(
"Period not specified"
,
Fatal
=>
True
);
end
if
;
...
...
@@ -270,7 +283,13 @@ package body Ocarina.Backends.POK_C.Main is
begin
if
TA
/=
Empty_Time_Array
then
if
Use_ARINC653_API
then
Capacity
:=
Map_Time_To_Millisecond
(
TA
(
1
));
if
POK_Flavor
=
ARINC653
then
Capacity
:=
Map_Time_To_Millisecond
(
TA
(
1
));
elsif
POK_Flavor
=
DEOS
then
Capacity
:=
Map_Time_To_Nanosecond
(
TA
(
1
));
else
Capacity
:=
No_Node
;
end
if
;
else
Capacity
:=
Map_Time
(
TA
(
1
));
end
if
;
...
...
@@ -282,6 +301,9 @@ package body Ocarina.Backends.POK_C.Main is
-- By default, we allocate 1 ms for thread execution.
Capacity
:=
CTU
.
Make_Literal
(
CV
.
New_Int_Value
(
Thread_Id
,
1
,
10
));
-- DeOS works with Nanoseconds
end
if
;
N
:=
Make_Expression
...
...
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