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