Skip to content
GitLab
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 @@
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@IF@@ @_Required_@ /= ""
// Required interfaces of function @_Name_@
@_Required_@
@@END_IF@@
@_Protected_PIs_@
templates/concurrency_view/pohic_wrappers_body/pi.tmplt
View file @
53ec44c6
...
...
@@ -7,31 +7,40 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_Param_Names'Length_@ > 0
procedure @_CAPITALIZE:Name_@
@@INLINE( \()(;\n )(\) is\n)@@
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
@@END_TABLE@@
@@END_INLINE@@
procedure C_@_CAPITALIZE:Name_@
@@INLINE( \()(;\n )(\)\n)@@
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
@@-- @_Remote_Function_Names_@ : List of callers
@@-- @_Remote_Interface_Names_@ : |_ caller's interface name
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@()
@@ELSE@@ @@-- contains param(s)
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\)\n)@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
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_INLINE@@
with Import, Convention => C, Link_Name => "@_LOWER:Parent_Function_@_@_LOWER:Name_@";
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_@
@@END_TABLE@@
@@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@@
}
templates/concurrency_view/pohic_wrappers_header/block.tmplt
View file @
53ec44c6
...
...
@@ -7,9 +7,14 @@
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
// prototypes for the provided interfaces
@@IF@@ @_Protected_PIs_@ /= ""
// Protected provided interfaces of function @_Name_@
@_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_@
// 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:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@
IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
@@
IF@@ @_Kind_@ = "PROTECTED_OPERATION" or @_Kind_@ = "UNPROTECTED_OPERATION"
void sync_@_LOWER:Parent_Function_@_@_LOWER:Name_@();
@@ELSE@@ @@-- cyclic/sporadic: entry point for polyorb-hi-c (maybe cyclic has no task_id!!)
void po
_hi_c
_@_LOWER:Parent_Function_@_@_LOWER:Name_@
(__po_hi_task_id
);
@@END_IF@@
@@ELSE@@ @@-- contains param(s)
@@IF@@ @_Kind_@ = "PROTECTED_OPERATION" or @_Kind_@ = "UNPROTECTED_OPERATION"
void sync_@_LOWER:Parent_Function_@_@_LOWER:Name_
@
@@INLINE( \()(,\n )(\);)@@
@@TABLE'ALIGN_ON(",")@
@
void *@_LOWER:Param_Names_@, size_t @_LOWER:Param_Names_@_len
@@END_TABLE@
@
@@END_I
NLINE
@@
@@ELSE@@ @@-- sporadic: entry point for polyorb-hi-c (one param)
void po_hi_c_@_LOWER:Parent_Function_@_@_LOWER:Name_@ (__po_hi_task_id, dataview__@_LOWER_Param_Types_@_buffer_impl);
@@END_IF@@
@@-- @_Name_@
: The name of the interface
@@-- @_Direction_@
: "PI" or "RI"
@@-- @_Kind_@
: The RCM Kind
@@-- @_Parent_Function_@
: The name of the function
@@-- @_Param_Names_@
: List of parameter names
@@-- @_Param_Types_@
: |_ Corresponding parameter types
@@-- @_Param_Directions_@
: |_ Corresponding direction
@@
-- @_Remote_Function_Names_@ : List of callers
@@
-- @_Remote_Interface_Names_@ : |_ caller's interface name
@@IF@@ @_Kind_@ = PROTECTED_OPERATION
@@IF@@ @_Param_Names'Length_@ = 0 @@-- zero param
void p
r
o_@_LOWER:Parent_Function_@_@_LOWER:Name_@
(
);
@@ELSE@@ @@-- contains param(s)
void pro_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);)@@
@@TABLE@
@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
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_I
F
@@
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
@@END_IF@@
templates/concurrency_view/pohic_wrappers_header/ri.tmplt
View file @
53ec44c6
...
...
@@ -7,7 +7,10 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
// Required interface @_Name_@ in function @_Parent_Function_@
// This RI is connected to: @_Remote_Function_Names_@
void vm_@_LOWER:Parent_Function_@_@_LOWER:Name_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
...
...
templates/concurrency_view/pohic_wrappers_header/thread.tmplt
View file @
53ec44c6
...
...
@@ -18,8 +18,6 @@
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
//#include "@_LOWER:Pro_Block_Name_@_block.h"
@@INLINE()(\n)(\n)@@
@@IF@@ @_Param_Names'Length_@ > 0
@@TABLE@@
...
...
test/test-cv/InterfaceView.aadl
View file @
53ec44c6
...
...
@@ -60,6 +60,16 @@ END RI_result;
SUBPROGRAM IMPLEMENTATION 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
FEATURES
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::obsw::PI_pulse.others {
...
...
@@ -88,6 +98,12 @@ FEATURES
Taste::InterfaceName => "result";
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
Source_Language => (SDL);
Taste::Active_Interfaces => any;
...
...
@@ -121,6 +137,18 @@ PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
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
FEATURES
PI_guidance : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::GNC::PI_guidance.others {
...
...
@@ -130,6 +158,11 @@ FEATURES
Taste::Deadline => 0 ms;
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
Source_Language => (C);
Taste::Active_Interfaces => any;
...
...
@@ -232,6 +265,9 @@ CONNECTIONS
ground_PI_result_obsw_RI_result : SUBPROGRAM ACCESS ground.PI_result -> obsw.RI_result {
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;
PROPERTIES
...
...
test/test-cv/input_data/gnc.c
View file @
53ec44c6
...
...
@@ -26,5 +26,10 @@ void gnc_PI_guidance
*
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;
dcl p t_boolean;
dcl inp t_uint32 := 42;
dcl p2 t_boolean;
/* CIF ENDTEXT */
/* CIF START (320, 10), (70, 35) */
START;
...
...
@@ -15,11 +17,11 @@ process Obsw;
NEXTSTATE Wait;
/* CIF state (320, 115), (70, 35) */
state Wait;
/* CIF input (1
99
, 170), (78, 35) */
/* CIF input (1
24
, 170), (78, 35) */
input Run(p);
/* CIF output (19
5
, 225), (86, 35) */
/* CIF output (1
1
9, 225), (86, 35) */
output Result(42);
/* CIF NEXTSTATE (
203
, 275), (70, 35) */
/* CIF NEXTSTATE (
128
, 275), (70, 35) */
NEXTSTATE wait;
/* CIF input (369, 170), (70, 35) */
input Pulse;
...
...
@@ -29,7 +31,13 @@ process Obsw;
call writeln('[SDL] Result: ', p);
/* CIF task (291, 330), (224, 35) */
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;
endstate;
/* CIF state (450, 10), (70, 35) */
...
...
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