Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
53ec44c6
Commit
53ec44c6
authored
Jul 15, 2019
by
Maxime Perrotin
Browse files
Add support for protected calls
parent
13ef2d81
Changes
10
Hide whitespace changes
Inline
Side-by-side
templates/concurrency_view/pohic_wrappers_body/block.tmplt
View file @
53ec44c6
...
@@ -7,5 +7,8 @@
...
@@ -7,5 +7,8 @@
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@IF@@ @_Required_@ /= ""
// Required interfaces of function @_Name_@
// Required interfaces of function @_Name_@
@_Required_@
@_Required_@
@@END_IF@@
@_Protected_PIs_@
templates/concurrency_view/pohic_wrappers_body/pi.tmplt
View file @
53ec44c6
...
@@ -7,31 +7,40 @@
...
@@ -7,31 +7,40 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_Param_Names'Length_@ > 0
@@-- @_Remote_Function_Names_@ : List of callers
procedure @_CAPITALIZE:Name_@
@@-- @_Remote_Interface_Names_@ : |_ caller's interface name
@@INLINE( \()(;\n )(\) is\n)@@
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@TABLE'ALIGN_ON(":")@@
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@()
@@END_TABLE@@
@@ELSE@@ @@-- contains param(s)
@@END_INLINE@@
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@
procedure C_@_CAPITALIZE:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@INLINE( \()(;\n )(\)\n)@@
@@TABLE@@
@@TABLE'ALIGN_ON(":")@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
void *IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
void *OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_@_LOWER:Name_@";
@@END_IF@@
begin
@@-- Works only for one param: for more than one param, use a table section
C_@_CAPITALIZE:Name_@ (@_CAPITALIZE:Param_Names_@, @_CAPITALIZE:Param_Names_@_Size);
end @_CAPITALIZE:Name_@;
@@ELSE@@
procedure @_CAPITALIZE:Name_@ is
procedure C_@_CAPITALIZE:Name_@
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_@_LOWER:Name_@";
begin
-- PI has no parameter - could directly call user code (add _PI_ above)
C_@_CAPITALIZE:Name_@;
end @_CAPITALIZE:Name_@;
@@END_IF@@
@@END_IF@@
{
extern process_package__taste_protected_object @_LOWER:Parent_Function_@_protected;
__po_hi_protected_lock (@_LOWER:Parent_Function_@_protected.protected_id);
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@_LOWER:Parent_Function_@_@_LOWER:Name_@();
@@ELSE@@
@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
__po_hi_protected_unlock (@_LOWER:Parent_Function_@_protected.protected_id);
}
templates/concurrency_view/pohic_wrappers_body/ri.tmplt
View file @
53ec44c6
...
@@ -38,7 +38,19 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
...
@@ -38,7 +38,19 @@ void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@END_TABLE@@
@@END_TABLE@@
@@ELSE@@ @@-- Protected call
@@ELSE@@ @@-- Protected call
puts("Protected call of @_Name_@");
puts("[TASTE] Protected call of @_Name_@");
@@TABLE@@
pro_@_LOWER:Remote_Function_Names_@_@_LOWER:Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
IN_buf_@_LOWER:Param_Names_@, size_IN_buf_@_LOWER:Param_Names_@
@@ELSE@@
OUT_buf_@_LOWER:Param_Names_@, size_OUT_buf_@_LOWER:Param_Names_@
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
@@END_TABLE@@
@@END_IF@@
@@END_IF@@
}
}
templates/concurrency_view/pohic_wrappers_header/block.tmplt
View file @
53ec44c6
...
@@ -7,9 +7,14 @@
...
@@ -7,9 +7,14 @@
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
// prototypes for the provided interfaces
@@IF@@ @_Protected_PIs_@ /= ""
// Protected provided interfaces of function @_Name_@
@_Protected_PIs_@
@_Protected_PIs_@
@_Unprotected_PIs_@
// End of the protected provided interfaces of function @_Name_@
@@END_IF@@
@@IF@@ @_Required_@ /= ""
//
prototypes for the required interfaces
//
Required interfaces of function @_Name_@
@_Required_@
@_Required_@
// End of the required interfaces of function @_Name_@
@@END_IF@@
templates/concurrency_view/pohic_wrappers_header/pi.tmplt
View file @
53ec44c6
@@-- The following tags are available in this template:
@@-- The following tags are available in this template:
@@--
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Name_@
: The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Direction_@
: "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Kind_@
: The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Parent_Function_@
: The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Names_@
: List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Types_@
: |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Directions_@
: |_ Corresponding direction
@@
IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@@
-- @_Remote_Function_Names_@ : List of callers
@@
IF@@ @_Kind_@ = "PROTECTED_OPERATION" or @_Kind_@ = "UNPROTECTED_OPERATION"
@@
-- @_Remote_Interface_Names_@ : |_ caller's interface name
void sync_@_LOWER:Parent_Function_@_@_LOWER:Name_@();
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@ELSE@@ @@-- cyclic/sporadic: entry point for polyorb-hi-c (maybe cyclic has no task_id!!)
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void po
_hi_c
_@_LOWER:Parent_Function_@_@_LOWER:Name_@
(__po_hi_task_id
);
void p
r
o_@_LOWER:Parent_Function_@_@_LOWER:Name_@
(
);
@@END_IF@@
@@ELSE@@ @@-- contains param(s)
@@ELSE@@ @@-- contains param(s)
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@IF@@ @_Kind_@ = "PROTECTED_OPERATION" or @_Kind_@ = "UNPROTECTED_OPERATION"
@@INLINE( \()(,\n )(\);)@@
void sync_@_LOWER:Parent_Function_@_@_LOWER:Name_
@
@@TABLE@
@
@@INLINE( \()(,\n )(\);)@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
@@TABLE'ALIGN_ON(",")@
@
void *IN_buf_@_LOWER:Param_Names_@, size_t size_IN_buf_@_LOWER:Param_Names_
@
void *@_LOWER:Param_Names_@, size_t @_LOWER:Param_Names_@_len
@@ELSE@@
@@END_TABLE@
@
void *OUT_buf_@_LOWER:Param_Names_@, size_t *size_OUT_buf_@_LOWER:Param_Names_
@
@@END_I
NLINE
@@
@@END_I
F
@@
@@ELSE@@ @@-- sporadic: entry point for polyorb-hi-c (one param)
@@END_TABLE@@
void po_hi_c_@_LOWER:Parent_Function_@_@_LOWER:Name_@ (__po_hi_task_id, dataview__@_LOWER_Param_Types_@_buffer_impl);
@@END_INLINE@@
@@END_IF@@
@@END_IF@@
@@END_IF@@
@@END_IF@@
templates/concurrency_view/pohic_wrappers_header/ri.tmplt
View file @
53ec44c6
...
@@ -7,7 +7,10 @@
...
@@ -7,7 +7,10 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
// Required interface @_Name_@ in function @_Parent_Function_@
// Required interface @_Name_@ in function @_Parent_Function_@
// This RI is connected to: @_Remote_Function_Names_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@@TABLE@@
...
...
templates/concurrency_view/pohic_wrappers_header/thread.tmplt
View file @
53ec44c6
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
//#include "@_LOWER:Pro_Block_Name_@_block.h"
@@INLINE()(\n)(\n)@@
@@INLINE()(\n)(\n)@@
@@IF@@ @_Param_Names'Length_@ > 0
@@IF@@ @_Param_Names'Length_@ > 0
@@TABLE@@
@@TABLE@@
...
...
test/test-cv/InterfaceView.aadl
View file @
53ec44c6
...
@@ -60,6 +60,16 @@ END RI_result;
...
@@ -60,6 +60,16 @@ END RI_result;
SUBPROGRAM IMPLEMENTATION RI_result.others
SUBPROGRAM IMPLEMENTATION RI_result.others
END RI_result.others;
END RI_result.others;
SUBPROGRAM RI_get_pro_data
FEATURES
outp : OUT PARAMETER DataView::T_Boolean {
Taste::encoding => UPER;
};
END RI_get_pro_data;
SUBPROGRAM IMPLEMENTATION RI_get_pro_data.others
END RI_get_pro_data.others;
SYSTEM obsw
SYSTEM obsw
FEATURES
FEATURES
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::obsw::PI_pulse.others {
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::obsw::PI_pulse.others {
...
@@ -88,6 +98,12 @@ FEATURES
...
@@ -88,6 +98,12 @@ FEATURES
Taste::InterfaceName => "result";
Taste::InterfaceName => "result";
Taste::labelInheritance => "true";
Taste::labelInheritance => "true";
};
};
RI_get_pro_data : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::GNC::PI_get_pro_data.others {
Taste::coordinates => "118422 63306";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "get_pro_data";
Taste::labelInheritance => "true";
};
PROPERTIES
PROPERTIES
Source_Language => (SDL);
Source_Language => (SDL);
Taste::Active_Interfaces => any;
Taste::Active_Interfaces => any;
...
@@ -121,6 +137,18 @@ PROPERTIES
...
@@ -121,6 +137,18 @@ PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_guidance.others;
END PI_guidance.others;
SUBPROGRAM PI_get_pro_data
FEATURES
outp : OUT PARAMETER DataView::T_Boolean {
Taste::encoding => UPER;
};
END PI_get_pro_data;
SUBPROGRAM IMPLEMENTATION PI_get_pro_data.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_get_pro_data.others;
SYSTEM GNC
SYSTEM GNC
FEATURES
FEATURES
PI_guidance : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::GNC::PI_guidance.others {
PI_guidance : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::GNC::PI_guidance.others {
...
@@ -130,6 +158,11 @@ FEATURES
...
@@ -130,6 +158,11 @@ FEATURES
Taste::Deadline => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "guidance";
Taste::InterfaceName => "guidance";
};
};
PI_get_pro_data : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::GNC::PI_get_pro_data.others {
Taste::coordinates => "142673 63306";
Taste::RCMoperationKind => protected;
Taste::InterfaceName => "get_pro_data";
};
PROPERTIES
PROPERTIES
Source_Language => (C);
Source_Language => (C);
Taste::Active_Interfaces => any;
Taste::Active_Interfaces => any;
...
@@ -232,6 +265,9 @@ CONNECTIONS
...
@@ -232,6 +265,9 @@ CONNECTIONS
ground_PI_result_obsw_RI_result : SUBPROGRAM ACCESS ground.PI_result -> obsw.RI_result {
ground_PI_result_obsw_RI_result : SUBPROGRAM ACCESS ground.PI_result -> obsw.RI_result {
Taste::coordinates => "118422 71181 132598 71181 132598 89446";
Taste::coordinates => "118422 71181 132598 71181 132598 89446";
};
};
GNC_PI_get_pro_data_obsw_RI_get_pro_data : SUBPROGRAM ACCESS GNC.PI_get_pro_data -> obsw.RI_get_pro_data {
Taste::coordinates => "118422 63306 130547 63306 130547 63306 142673 63306";
};
END interfaceview.others;
END interfaceview.others;
PROPERTIES
PROPERTIES
...
...
test/test-cv/input_data/gnc.c
View file @
53ec44c6
...
@@ -26,5 +26,10 @@ void gnc_PI_guidance
...
@@ -26,5 +26,10 @@ void gnc_PI_guidance
*
OUT_result
=
(
42
==
*
IN_a
);
*
OUT_result
=
(
42
==
*
IN_a
);
}
}
void
gnc_PI_get_pro_data
(
asn1SccT_Boolean
*
OUT_outp
)
{
puts
(
"[GNC] get_pro_data called"
);
static
asn1SccT_Boolean
toggle
=
false
;
*
OUT_outp
=
toggle
;
toggle
=
toggle
?
false
:
true
;
}
test/test-cv/input_data/obsw.pr
View file @
53ec44c6
...
@@ -6,6 +6,8 @@ process Obsw;
...
@@ -6,6 +6,8 @@ process Obsw;
dcl p t_boolean;
dcl p t_boolean;
dcl inp t_uint32 := 42;
dcl inp t_uint32 := 42;
dcl p2 t_boolean;
/* CIF ENDTEXT */
/* CIF ENDTEXT */
/* CIF START (320, 10), (70, 35) */
/* CIF START (320, 10), (70, 35) */
START;
START;
...
@@ -15,11 +17,11 @@ process Obsw;
...
@@ -15,11 +17,11 @@ process Obsw;
NEXTSTATE Wait;
NEXTSTATE Wait;
/* CIF state (320, 115), (70, 35) */
/* CIF state (320, 115), (70, 35) */
state Wait;
state Wait;
/* CIF input (1
99
, 170), (78, 35) */
/* CIF input (1
24
, 170), (78, 35) */
input Run(p);
input Run(p);
/* CIF output (19
5
, 225), (86, 35) */
/* CIF output (1
1
9, 225), (86, 35) */
output Result(42);
output Result(42);
/* CIF NEXTSTATE (
203
, 275), (70, 35) */
/* CIF NEXTSTATE (
128
, 275), (70, 35) */
NEXTSTATE wait;
NEXTSTATE wait;
/* CIF input (369, 170), (70, 35) */
/* CIF input (369, 170), (70, 35) */
input Pulse;
input Pulse;
...
@@ -29,7 +31,13 @@ process Obsw;
...
@@ -29,7 +31,13 @@ process Obsw;
call writeln('[SDL] Result: ', p);
call writeln('[SDL] Result: ', p);
/* CIF task (291, 330), (224, 35) */
/* CIF task (291, 330), (224, 35) */
task inp := if inp = 42 then 0 else 42 fi;
task inp := if inp = 42 then 0 else 42 fi;
/* CIF NEXTSTATE (369, 380), (70, 35) */
/* CIF PROCEDURECALL (331, 385), (145, 35) */
call Get_Pro_Data (p2);
/* CIF PROCEDURECALL (217, 435), (374, 35) */
call writeln('[SDL] Protected call result: ', p2);
/* CIF output (355, 490), (98, 35) */
output Result(inp);
/* CIF NEXTSTATE (369, 540), (70, 35) */
NEXTSTATE wait;
NEXTSTATE wait;
endstate;
endstate;
/* CIF state (450, 10), (70, 35) */
/* CIF state (450, 10), (70, 35) */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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