Commit 47f1455b authored by yoogx's avatar yoogx
Browse files

* Reorganize examples to reduce code dupluiation

        For issue #18
parent 9024aa14
C_FILES = $(srcdir)/toy.c C_FILES = $(srcdir)/toy.c
AADL_FILES = $(srcdir)/toy_example.aadl \ AADL_FILES = $(srcdir)/toy_example.aadl
$(srcdir)/toy_example_xenomai_native.aadl \
$(srcdir)/toy_example_xenomai_posix.aadl
SCENARIO_FILES = $(srcdir)/scenario_local.aadl \ SCENARIO_FILES = $(srcdir)/scenario_local.aadl \
$(srcdir)/scenario_local_xenomai_posix.aadl \ $(srcdir)/scenario_local_xenomai_posix.aadl \
...@@ -11,4 +9,4 @@ include $(srcdir)/../../Makefile.common ...@@ -11,4 +9,4 @@ include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES) EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES)
CLEANDIRS = toy_example_sample_1 CLEANDIRS = toy_example_native toy_example_xenomai toy_example_xenomai_posix
-- This is a scenario file describing the AADL -- This is a scenario file describing the AADL
-- application d3_1_3_1 -- application d3_1_3_1
-- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $ -- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $
...@@ -8,10 +8,11 @@ properties ...@@ -8,10 +8,11 @@ properties
Ocarina_Config::Timeout_Property => 4000ms; Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files => Ocarina_Config::Referencial_Files =>
("gnc_tmtc_pos", "gnc_tmtc_pos.ref"); ("gnc_tmtc_pos", "gnc_tmtc_pos.ref");
Ocarina_Config::AADL_Files => Ocarina_Config::AADL_Files =>
("toy_example.aadl"); ("toy_example.aadl");
Ocarina_Config::Root_System_Name => "toy_example.native";
Ocarina_Config::Generator => polyorb_hi_c; Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets => Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model), (value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment), value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties)); value (Ocarina_Config::Cheddar_Properties));
...@@ -20,4 +21,3 @@ end d3_1_3_1; ...@@ -20,4 +21,3 @@ end d3_1_3_1;
system implementation d3_1_3_1.Impl system implementation d3_1_3_1.Impl
end d3_1_3_1.Impl; end d3_1_3_1.Impl;
-- This is a scenario file describing the AADL -- This is a scenario file describing the AADL
-- application d3_1_3_1 -- application d3_1_3_1
-- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $ -- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $
...@@ -8,10 +8,10 @@ properties ...@@ -8,10 +8,10 @@ properties
Ocarina_Config::Timeout_Property => 4000ms; Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files => Ocarina_Config::Referencial_Files =>
("gnc_tmtc_pos", "gnc_tmtc_pos.ref"); ("gnc_tmtc_pos", "gnc_tmtc_pos.ref");
Ocarina_Config::AADL_Files => Ocarina_Config::AADL_Files => ("toy_example.aadl");
("toy_example_xenomai_native.aadl"); Ocarina_Config::Root_System_Name => "toy_example.xenomai";
Ocarina_Config::Generator => polyorb_hi_c; Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets => Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model), (value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment), value (Ocarina_Config::Deployment),
value (Ocarina_Config::ARINC653_Properties), value (Ocarina_Config::ARINC653_Properties),
...@@ -21,4 +21,3 @@ end d3_1_3_1; ...@@ -21,4 +21,3 @@ end d3_1_3_1;
system implementation d3_1_3_1.Impl system implementation d3_1_3_1.Impl
end d3_1_3_1.Impl; end d3_1_3_1.Impl;
-- This is a scenario file describing the AADL -- This is a scenario file describing the AADL
-- application d3_1_3_1 -- application d3_1_3_1
-- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $ -- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $
...@@ -8,10 +8,11 @@ properties ...@@ -8,10 +8,11 @@ properties
Ocarina_Config::Timeout_Property => 4000ms; Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files => Ocarina_Config::Referencial_Files =>
("gnc_tmtc_pos", "gnc_tmtc_pos.ref"); ("gnc_tmtc_pos", "gnc_tmtc_pos.ref");
Ocarina_Config::AADL_Files => Ocarina_Config::AADL_Files =>
("toy_example_xenomai_posix.aadl"); ("toy_example.aadl");
Ocarina_Config::Root_System_Name => "toy_example.xenomai_posix";
Ocarina_Config::Generator => polyorb_hi_c; Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets => Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model), (value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment), value (Ocarina_Config::Deployment),
value (Ocarina_Config::ARINC653_Properties), value (Ocarina_Config::ARINC653_Properties),
...@@ -21,4 +22,3 @@ end d3_1_3_1; ...@@ -21,4 +22,3 @@ end d3_1_3_1;
system implementation d3_1_3_1.Impl system implementation d3_1_3_1.Impl
end d3_1_3_1.Impl; end d3_1_3_1.Impl;
-- This AADL model is derived from the AADL model published in the -- This AADL model is derived from the AADL model published in the
-- IST-ASSERT d3.3.1-3 deliverable. -- IST-ASSERT d3.3.1-3 deliverable.
-- $Id: toy_example.aadl 407 2007-06-19 15:24:28Z delange $ package Toy_Example
package TOY_Example
public public
with Cheddar_Properties, Deployment, Data_Model;
with Deployment;
----------------- with Data_Model;
-- Subprograms --
----------------- ----------
-- Data --
subprogram Update ----------
features
this : requires data access POS.Impl; -- POS_Internal_Type is the internal type of the POS shared variable
properties
source_language => C; data POS_Internal_Type
source_name => "user_update"; properties
source_text => ("toy.c"); Data_Model::Data_Representation => Integer;
end Update; end POS_Internal_Type;
-- This subprogram updates the internal value of POS
-- POS is a shared variable between the nodes GNC and TMTC. Its
subprogram Read_POS -- internal type is defined in POS.Impl. Therefore, POS.Impl is the
features -- data component types that should be used in the remaining of the
this : requires data access POS.Impl; -- model.
properties
source_language => C; data POS
source_name => "user_read"; features
source_text => ("toy.c"); Update : provides subprogram access Update;
end Read_POS; Read : provides subprogram access Read_POS;
-- This subprogram displays the internal value of POS properties
Priority => 250;
subprogram GNC_Job end POS;
properties
source_language => C; data implementation POS.Impl
source_name => "user_gnc_job"; subcomponents
source_text => ("toy.c"); Field : data POS_Internal_Type;
end GNC_Job; spgUpdate : subprogram Update;
-- This subprogram consumes the CPU during a given amount of time spgRead : subprogram Read_POS;
subprogram TMTC_Job connections
properties Cnx_Pos_1 : subprogram access SpgUpdate -> Update;
source_language => C; Cnx_Pos_2 : subprogram access SpgRead -> Read;
source_name => "user_tmtc_job";
source_text => ("toy.c"); properties
end TMTC_Job; Data_Model::Data_Representation => Struct;
-- This subprogram consumes the CPU during a given amount of time end POS.Impl;
-- The two subprogram below are used for analyze purpose -----------------
-- Subprograms --
subprogram GNC_Identity -----------------
properties
source_language => C; subprogram Update
source_name => "user_gnc_identity"; features
source_text => ("toy.c"); this : requires data access POS.Impl;
end GNC_Identity; properties
source_language => C;
subprogram TMTC_Identity source_name => "user_update";
properties source_text => ("toy.c");
source_language => C; end Update;
source_name => "user_tmtc_identity"; -- This subprogram updates the internal value of POS
source_text => ("toy.c");
end TMTC_Identity; subprogram Read_POS
features
-------------------------- this : requires data access POS.Impl;
-- Subprogram Wrappers -- properties
-------------------------- source_language => C;
source_name => "user_read";
subprogram GNC_Thread_Wrapper source_text => ("toy.c");
features end Read_POS;
GNC_POS : requires data access POS.Impl; -- This subprogram displays the internal value of POS
end GNC_Thread_Wrapper;
subprogram GNC_Job
subprogram implementation GNC_Thread_Wrapper.Impl properties
calls source_language => C;
Mycalls: { source_name => "user_gnc_job";
Welcome : subprogram GNC_Identity; source_text => ("toy.c");
Update_POS : subprogram POS.Update; end GNC_Job;
GNC_Job : subprogram GNC_Job; -- This subprogram consumes the CPU during a given amount of time
Read_POS : subprogram POS.Read;
Bye : subprogram GNC_Identity; subprogram TMTC_Job
}; properties
connections source_language => C;
Cnx_GNC_1 : data access GNC_POS -> Update_POS.this; source_name => "user_tmtc_job";
Cnx_GNC_2 : data access GNC_POS -> Read_POS.this; source_text => ("toy.c");
end GNC_Thread_Wrapper.Impl; end TMTC_Job;
-- This subprogram consumes the CPU during a given amount of time
subprogram TMTC_Thread_Wrapper
features -- The two subprogram below are used for analyze purpose
TMTC_POS : requires data access POS.Impl;
end TMTC_Thread_Wrapper; subprogram GNC_Identity
properties
subprogram implementation TMTC_Thread_Wrapper.Impl source_language => C;
calls source_name => "user_gnc_identity";
Mycalls: { source_text => ("toy.c");
Welcome : subprogram TMTC_Identity; end GNC_Identity;
TMTC_Job : subprogram TMTC_Job;
Update : subprogram POS.Update; subprogram TMTC_Identity
Bye : subprogram TMTC_Identity; properties
}; source_language => C;
connections source_name => "user_tmtc_identity";
Cnx_TMTC_1 : data access TMTC_POS -> Update.this; source_text => ("toy.c");
end TMTC_Thread_Wrapper.Impl; end TMTC_Identity;
------------- -------------------------
-- Threads -- -- Subprogram Wrappers --
------------- -------------------------
thread GNC_Thread subprogram GNC_Thread_Wrapper
features features
GNC_POS : requires data access POS.Impl; GNC_POS : requires data access POS.Impl;
end GNC_Thread; end GNC_Thread_Wrapper;
thread implementation GNC_Thread.Impl subprogram implementation GNC_Thread_Wrapper.Impl
calls calls
Mycalls: { Mycalls: {
GNC_Thread_Wrapper : subprogram GNC_Thread_Wrapper.Impl; Welcome : subprogram GNC_Identity;
}; Update_POS : subprogram POS.Update;
connections GNC_Job : subprogram GNC_Job;
Cnx_GNC_1 : data access GNC_POS -> GNC_Thread_Wrapper.GNC_POS; Read_POS : subprogram POS.Read;
properties Bye : subprogram GNC_Identity;
Dispatch_Protocol => Periodic; };
Period => 1000 ms; connections
Compute_Execution_time => 0 ms .. 600 ms; Cnx_GNC_1 : data access GNC_POS -> Update_POS.this;
Deadline => 1000 ms; Cnx_GNC_2 : data access GNC_POS -> Read_POS.this;
Cheddar_Properties::Fixed_Priority => 250; end GNC_Thread_Wrapper.Impl;
end GNC_thread.Impl;
subprogram TMTC_Thread_Wrapper
thread TMTC_Thread features
features TMTC_POS : requires data access POS.Impl;
TMTC_POS : requires data access POS.Impl; end TMTC_Thread_Wrapper;
end TMTC_Thread;
subprogram implementation TMTC_Thread_Wrapper.Impl
thread implementation TMTC_Thread.Impl calls
calls Mycalls: {
Mycalls: { Welcome : subprogram TMTC_Identity;
TMTC_Thread_Wrapper : subprogram TMTC_Thread_Wrapper.Impl; TMTC_Job : subprogram TMTC_Job;
}; Update : subprogram POS.Update;
connections Bye : subprogram TMTC_Identity;
Cnx_TMTC_1 : data access TMTC_POS -> TMTC_Thread_Wrapper.TMTC_POS; };
properties connections
Dispatch_Protocol => Periodic; Cnx_TMTC_1 : data access TMTC_POS -> Update.this;
Period => 100 ms; end TMTC_Thread_Wrapper.Impl;
Compute_Execution_time => 0 ms .. 50 ms;
Deadline => 100 ms; -------------
Cheddar_Properties::Fixed_Priority => 190; -- Threads --
end TMTC_Thread.Impl; -------------
--------------- thread GNC_Thread
-- Processes -- features
--------------- GNC_POS : requires data access POS.Impl;
end GNC_Thread;
process Toy_Example_Proc
end Toy_Example_Proc; thread implementation GNC_Thread.Impl
calls
process implementation Toy_Example_Proc.Impl Mycalls: {
subcomponents GNC_Thread_Wrapper : subprogram GNC_Thread_Wrapper.Impl;
GNC_Th : thread GNC_thread.Impl; };
TMTC_Th : thread TMTC_Thread.Impl; connections
POS_Data : data POS.Impl; Cnx_GNC_1 : data access GNC_POS -> GNC_Thread_Wrapper.GNC_POS;
connections properties
Cnx_Proc_2 : data access POS_Data -> GNC_Th.GNC_POS; Dispatch_Protocol => Periodic;
Cnx_Proc_3 : data access POS_Data -> TMTC_Th.TMTC_POS; Period => 1000 ms;
end Toy_Example_Proc.Impl; Compute_Execution_Time => 0 ms .. 600 ms;
Deadline => 1000 ms;
--------------- Priority => 250;
-- Processor -- end GNC_thread.Impl;
---------------
thread TMTC_Thread
processor the_processor features
properties TMTC_POS : requires data access POS.Impl;
Deployment::Execution_Platform => native; end TMTC_Thread;
Priority_Range => 0 .. 255;
end the_processor; thread implementation TMTC_Thread.Impl
calls
------------ Mycalls: {
-- System -- TMTC_Thread_Wrapper : subprogram TMTC_Thread_Wrapper.Impl;
------------ };
connections
system toy_example Cnx_TMTC_1 : data access TMTC_POS -> TMTC_Thread_Wrapper.TMTC_POS;
end toy_example; properties
Dispatch_Protocol => Periodic;
system implementation toy_example.sample_1 Period => 100 ms;
subcomponents Compute_Execution_Time => 0 ms .. 50 ms;
P1 : processor the_processor; Deadline => 100 ms;
GNC_TMTC_POS : process Toy_Example_Proc.Impl; Priority => 190;
properties end TMTC_Thread.Impl;
Actual_Processor_Binding => reference (P1) applies to GNC_TMTC_POS;
end toy_example.sample_1; ---------------
-- Processes --
---------- ---------------
-- Data --
---------- process Toy_Example_Proc
end Toy_Example_Proc;
-- POS_Internal_Type is the internal type of the POS shared variable
process implementation Toy_Example_Proc.Impl
data POS_Internal_Type subcomponents
properties GNC_Th : thread GNC_thread.Impl;
Data_Model::Data_Representation => Integer; TMTC_Th : thread TMTC_Thread.Impl;
end POS_Internal_Type; POS_Data : data POS.Impl;
connections
-- POS is a shared variable between the nodes GNC and TMTC. Its Cnx_Proc_2 : data access POS_Data -> GNC_Th.GNC_POS;
-- internal type is defined in POS.Impl. Therefore, POS.Impl is the Cnx_Proc_3 : data access POS_Data -> TMTC_Th.TMTC_POS;
-- data component types that should be used in the remaining of the end Toy_Example_Proc.Impl;
-- model.
---------------
data POS -- Processor --
features ---------------
Update : provides subprogram access Update;
Read : provides subprogram access Read_POS; processor the_processor
properties properties
Priority => 250; Deployment::Execution_Platform => native;
end POS; Priority_Range => 0 .. 255;
end the_processor;
data implementation POS.Impl
subcomponents ------------
Field : data POS_Internal_Type; -- System --
spgUpdate : subprogram Update; ------------
spgRead : subprogram Read_POS;
system toy_example
connections end toy_example;
Cnx_Pos_1 : subprogram access SpgUpdate -> Update;
Cnx_Pos_2 : subprogram access SpgRead -> Read; system implementation toy_example.native
subcomponents
properties P1 : processor the_processor;
Data_Model::Data_Representation => Struct; GNC_TMTC_POS : process Toy_Example_Proc.Impl;
end POS.Impl; properties
Actual_Processor_Binding => reference (P1) applies to GNC_TMTC_POS;
end TOY_Example; end toy_example.native;
system implementation toy_example.xenomai
extends toy_example::toy_example.native
properties
Deployment::Execution_Platform => LINUX32_XENOMAI_NATIVE applies to P1;
end toy_example.xenomai;
system implementation toy_example.xenomai_posix
extends toy_example::toy_example.native
properties
Deployment::Execution_Platform => LINUX32_XENOMAI_POSIX applies to P1;
end toy_example.xenomai_posix;
end Toy_Example;
-- This AADL model is derived from the AADL model published in the
-- IST-ASSERT d3.3.1-3 deliverable.
-- $Id: toy_example.aadl 407 2007-06-19 15:24:28Z delange $
package TOY_Example
public
with Cheddar_Properties, Deployment, Data_Model;
-----------------
-- Subprograms --
-----------------
subprogram Update
features
this : requires data access POS.Impl;
properties
source_language => C;
source_name => "user_update";
source_text => ("toy.c");
end Update;
-- This subprogram updates the internal value of POS
subprogram Read_POS
features
this : requires data access POS.Impl;
properties
source_language => C;
source_name => "user_read";
source_text => ("toy.c");
end Read_POS;
-- This subprogram displays the internal value of POS
subprogram GNC_Job
properties
source_language => C;
source_name => "user_gnc_job";
source_text => ("toy.c");
end GNC_Job;
-- This subprogram consumes the CPU during a given amount of time
subprogram TMTC_Job
properties
source_language => C;
source_name => "user_tmtc_job";
source_text => ("toy.c");
end TMTC_Job;
-- This subprogram consumes the CPU during a given amount of time
-- The two subprogram below are used for analyze purpose
subprogram GNC_Identity
properties
source_language => C;
source_name => "user_gnc_identity";