Commit f901ed2c authored by yoogx's avatar yoogx
Browse files

* Reorganize examples to reduce code duplication

        For issue #18
parent 6e67bf23
SUBDIRS = d3.1.3-1 ping rma sunseeker producer-consumer some-types \
some-types-stdint flight-mgmt import monitor packet-store \
file-store lua cpp
some-types-stdint flight-mgmt import monitor lua cpp \
packet-store file-store
SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......
C_FILES = $(srcdir)/hello.cc
AADL_FILES = $(srcdir)/cpp_test.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl $(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common
......
......@@ -2,73 +2,85 @@ package CPP_Test
public
with Deployment;
-----------------
-- Subprograms --
-----------------
-----------------
-- Subprograms --
-----------------
subprogram Hello_Spg_1
properties
subprogram Hello_Spg_1
properties
source_language => (CPP);
source_name => "hello_world";
source_text => ("hello.cc");
end Hello_Spg_1;
end Hello_Spg_1;
-------------
-- Threads --
-------------
-------------
-- Threads --
-------------
thread Task
end Task;
thread Task
end Task;
thread implementation Task.impl_1
calls
Mycalls: {
thread implementation Task.impl_1
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_1;
};
properties
};
properties
Dispatch_Protocol => periodic;
Period => 1000ms;
end Task.impl_1;
end Task.impl_1;
---------------
-- Processor --
---------------
---------------
-- Processor --
---------------
processor cpurm
properties
processor cpurm
properties
Deployment::Execution_Platform => Native;
end cpurm;
end cpurm;
processor implementation cpurm.impl
properties
processor implementation cpurm.impl
properties
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end cpurm.impl;
end cpurm.impl;
---------------
-- Processes --
---------------
---------------
-- Processes --
---------------
process node_a
end node_a;
process node_a
end node_a;
process implementation node_a.impl
subcomponents
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
end node_a.impl;
end node_a.impl;
------------
-- System --
------------
------------
-- System --
------------
system cpp_test
end cpp_test;
system cpp_test
end cpp_test;
system implementation cpp_test.impl
subcomponents
node_a : process node_a.impl;
system implementation cpp_test.impl
subcomponents
cpptest : process node_a.impl;
cpu_rm : processor cpurm.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to node_a;
end cpp_test.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to cpptest;
end cpp_test.impl;
system implementation cpp_test.Xenomai
extends cpp_test.impl
properties
Deployment::Execution_Platform => linux32_xenomai_native applies to cpu_rm;
end cpp_test.Xenomai;
end CPP_Test;
system implementation cpp_test.RTEMS
extends cpp_test.impl
properties
Deployment::Execution_platform => LEON_RTEMS applies to cpu_rm;
end cpp_test.RTEMS;
end cpp_test;
......@@ -3,6 +3,7 @@ properties
Ocarina_Config::AADL_Files =>
("cpp_test.aadl");
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Root_System_Name => "cpp_test.impl";
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
......@@ -12,4 +13,3 @@ end cpp;
system implementation cpp.Impl
end cpp.Impl;
-- This is a scenario file describing the AADL application Flight
-- Management
-- $Id: scenario_local.aadl 424 2007-07-10 13:46:33Z zalila $
system cpptest
properties
Ocarina_Config::Timeout_Property => 1000ms;
Ocarina_Config::Referencial_Files =>
("cpptest", "cpptest.ref");
Ocarina_Config::AADL_Files =>
("cpp_test.aadl");
Ocarina_Config::Root_System_Name => "cpp_test.RTEMS";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end cpptest;
system implementation cpptest.Impl
end cpptest.Impl;
......@@ -3,7 +3,8 @@ AADL_FILES = $(srcdir)/toy_example.aadl
SCENARIO_FILES = $(srcdir)/scenario_local.aadl \
$(srcdir)/scenario_local_xenomai_posix.aadl \
$(srcdir)/scenario_local_xenomai_native.aadl
$(srcdir)/scenario_local_xenomai_native.aadl \
$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common
......
......@@ -17,6 +17,7 @@ properties
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end d3_1_3_1;
system implementation d3_1_3_1.Impl
......
-- This is a scenario file describing the AADL
-- application d3_1_3_1
-- $Id: scenario_local.aadl 407 2007-06-19 15:24:28Z delange $
system d3_1_3_1
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
("gnc_tmtc_pos", "gnc_tmtc_pos.ref");
Ocarina_Config::AADL_Files =>
("toy_example.aadl");
Ocarina_Config::Root_System_Name => "toy_example.RTEMS";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end d3_1_3_1;
system implementation d3_1_3_1.Impl
end d3_1_3_1.Impl;
......@@ -229,16 +229,20 @@ public
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;
system implementation toy_example.RTEMS
extends toy_example::toy_example.native
properties
Deployment::Execution_Platform => LEON_RTEMS applies to P1;
end toy_example.RTEMS;
end Toy_Example;
......@@ -3,8 +3,9 @@ AADL_FILES = \
$(srcdir)/software.aadl \
$(srcdir)/ping.aadl
SCENARIO_FILES = \
$(srcdir)/scenario.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl
# $(srcdir)/scenario_rtems.aadl $(srcdir)/scenario_local.aadl
include $(srcdir)/../../Makefile.common
......
-- This model completes the PING example by adding deployment
-- information.
--
-- In this deployment, two nodes are defined, one task per node.
--
-- $Id: ping.aadl 401 2007-06-07 15:04:01Z hugues $
package PING
public
with Software;
......@@ -11,65 +5,77 @@ public
with ocarina_drivers;
with ocarina_buses;
---------------
-- Processor --
---------------
---------------
-- Processor --
---------------
processor the_processor
properties
processor the_processor
properties
Deployment::location => "127.0.0.1";
Deployment::Execution_Platform => Native;
Priority_Range => 0 .. 255;
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end the_processor;
end the_processor;
---------
-- Bus --
---------
---------
-- Bus --
---------
bus Ethernet_Bus
properties
bus Ethernet_Bus
properties
Deployment::Transport_API => BSD_Sockets;
end Ethernet_Bus;
end Ethernet_Bus;
---------------
-- Processes --
---------------
---------------
-- Processes --
---------------
process A
features
process A
features
Out_Port : out event data port Software::Simple_Type;
end A;
end A;
process implementation A.Impl
subcomponents
process implementation A.Impl
subcomponents
Pinger : thread Software::P.Impl;
produce_pkts : thread software::packet_producer.i;
connections
connections
port Pinger.Data_Source -> Out_Port;
end A.Impl;
end A.Impl;
process B
features
process B
features
In_Port : in event data port Software::Simple_Type;
end B;
end B;
process implementation B.Impl
subcomponents
process implementation B.Impl
subcomponents
Ping_Me : thread Software::Q.Impl;
connections
connections
port In_Port -> Ping_Me.Data_Sink;
end B.Impl;
end B.Impl;
------------
-- System --
------------
process singleProcess
end singleProcess;
system PING
end PING;
process implementation singleProcess.Impl
subcomponents
Pinger : thread Software::P.Impl;
produce_pkts : thread software::packet_producer.i;
Ping_Me : thread Software::Q.Impl;
connections
port Pinger.Data_Source -> Ping_Me.Data_Sink;
end singleProcess.Impl;
------------
-- System --
------------
system implementation PING.Impl
subcomponents
system PING
end PING;
system implementation PING.Impl
subcomponents
Node_A : process A.Impl;
Node_B : process B.Impl;
......@@ -81,17 +87,38 @@ subcomponents
CPU_A : processor the_processor;
CPU_B : processor the_processor;
the_bus : bus ocarina_buses::ip.i;
connections
connections
bus access the_bus -> Device_A.link;
bus access the_bus -> Device_B.link;
port Node_A.Out_Port -> Node_B.In_Port
{Actual_Connection_Binding => (reference (the_bus));};
properties
properties
actual_processor_binding => reference (CPU_A) applies to Node_A;
actual_processor_binding => reference (CPU_B) applies to Node_B;
actual_processor_binding => (reference (CPU_A)) applies to Device_A;
actual_processor_binding => (reference (CPU_B)) applies to Device_B;
end PING.Impl;
end PING.Impl;
system implementation PING.Local
subcomponents
filestore : process singleProcess.Impl;
CPU_A : processor the_processor;
properties
actual_processor_binding => reference (CPU_A) applies to filestore;
end PING.Local;
system implementation PING.Xenomai
extends PING.Local
properties
Deployment::Execution_Platform => linux32_xenomai_native applies to CPU_A;
end PING.Xenomai;
system implementation PING.RTEMS
extends PING.local
properties
Deployment::Execution_platform => LEON_RTEMS applies to CPU_A ;
end PING.RTEMS;
end PING;
......@@ -2,6 +2,7 @@
#include <request.h>
#include <deployment.h>
#include <po_hi_storage.h>
#include <po_hi_gqueue.h>
#define FILENAME "pinger.dat"
......@@ -27,7 +28,6 @@ void user_produce_pkts_init ()
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
}
fflush (stdout);
}
......@@ -81,6 +81,7 @@ void user_do_ping_spg ()
fflush (stdout);
}
void recover (void)
{
printf ("*** RECOVER ACTION ***\n");
......
......@@ -5,9 +5,9 @@ void user_ping_spg (int i)
printf ("*** PING *** %d\n" ,i);
fflush (stdout);
}
/* redundant
void recover (void)
{
printf ("*** RECOVER ACTION ***\n");
fflush (stdout);
}
}*/
......@@ -7,6 +7,7 @@ properties
"node_b", "node_b.ref");
Ocarina_Config::AADL_Files =>
("ping.aadl" , "software.aadl");
Ocarina_Config::Root_System_Name => "PING.impl";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
......
system ping
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("ping.aadl" , "software.aadl");
Ocarina_Config::Root_System_Name => "PING.local";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end ping;
system implementation ping.impl
end ping.impl;
system ping
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("ping.aadl" , "software.aadl");
Ocarina_Config::Root_System_Name => "PING.RTEMS";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end ping;
system implementation ping.impl
end ping.impl;
C_FILES = $(srcdir)/flight-mgmt.c
AADL_FILES = $(srcdir)/flt_mgmt.aadl $(srcdir)/software.aadl
SCENARIO_FILES = $(srcdir)/scenario_local.aadl \
$(srcdir)/scenario_local_xenomai.aadl
$(srcdir)/scenario_local_xenomai.aadl \
$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common
......
......@@ -43,18 +43,24 @@ public
system Flight_Mgmt
end Flight_Mgmt;
system implementation Flight_Mgmt.Native
system implementation Flight_Mgmt.local
subcomponents
CPU : processor the_processor;
Mgmt : process Mgmt_T.RS;
fltMgmt : process Mgmt_T.RS;
properties
Actual_Processor_Binding => reference (CPU) applies to Mgmt;
end Flight_Mgmt.Native;
Actual_Processor_Binding => reference (CPU) applies to fltMgmt;
end Flight_Mgmt.local;
system implementation Flight_Mgmt.Xenomai
extends Flight_Mgmt.Native
extends Flight_Mgmt.local
properties
Deployment::Execution_Platform => linux32_xenomai_native applies to CPU;
end Flight_Mgmt.Xenomai;
system implementation Flight_Mgmt.RTEMS
extends Flight_Mgmt.local
properties
Deployment::Execution_platform => LEON_RTEMS applies to CPU;
end Flight_Mgmt.RTEMS;
end flight::mgmt;
......@@ -10,7 +10,7 @@ properties
("mgmt", "mgmt.ref");
Ocarina_Config::AADL_Files =>
("flt_mgmt.aadl", "software.aadl");
Ocarina_Config::Root_System_Name => "flight_mgmt.native";
Ocarina_Config::Root_System_Name => "flight_mgmt.local";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment