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 \ SUBDIRS = d3.1.3-1 ping rma sunseeker producer-consumer some-types \
some-types-stdint flight-mgmt import monitor packet-store \ some-types-stdint flight-mgmt import monitor lua cpp \
file-store lua cpp packet-store file-store
SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'} SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......
C_FILES = $(srcdir)/hello.cc C_FILES = $(srcdir)/hello.cc
AADL_FILES = $(srcdir)/cpp_test.aadl AADL_FILES = $(srcdir)/cpp_test.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl SCENARIO_FILES = $(srcdir)/scenario.aadl $(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common include $(srcdir)/../../Makefile.common
......
...@@ -2,73 +2,85 @@ package CPP_Test ...@@ -2,73 +2,85 @@ package CPP_Test
public public
with Deployment; with Deployment;
----------------- -----------------
-- Subprograms -- -- Subprograms --
----------------- -----------------
subprogram Hello_Spg_1 subprogram Hello_Spg_1
properties properties
source_language => (CPP); source_language => (CPP);
source_name => "hello_world"; source_name => "hello_world";
source_text => ("hello.cc"); source_text => ("hello.cc");
end Hello_Spg_1; end Hello_Spg_1;
------------- -------------
-- Threads -- -- Threads --
------------- -------------
thread Task thread Task
end Task; end Task;
thread implementation Task.impl_1 thread implementation Task.impl_1
calls calls
Mycalls: { Mycalls: {
P_Spg : subprogram Hello_Spg_1; P_Spg : subprogram Hello_Spg_1;
}; };
properties properties
Dispatch_Protocol => periodic; Dispatch_Protocol => periodic;
Period => 1000ms; Period => 1000ms;
end Task.impl_1; end Task.impl_1;
--------------- ---------------
-- Processor -- -- Processor --
--------------- ---------------
processor cpurm processor cpurm
properties properties
Deployment::Execution_Platform => Native; Deployment::Execution_Platform => Native;
end cpurm; end cpurm;
processor implementation cpurm.impl processor implementation cpurm.impl
properties properties
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol); Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end cpurm.impl; end cpurm.impl;
---------------
-- Processes --
---------------
process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
end node_a.impl;
------------
-- System --
------------
system cpp_test
end cpp_test;
system implementation cpp_test.impl ---------------
subcomponents -- Processes --
node_a : process node_a.impl; ---------------
cpu_rm : processor cpurm.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to node_a;
end cpp_test.impl;
end CPP_Test; process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
end node_a.impl;
------------
-- System --
------------
system cpp_test
end cpp_test;
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 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;
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;
...@@ -8,5 +8,5 @@ extern "C" { ...@@ -8,5 +8,5 @@ extern "C" {
void hello_world (void) void hello_world (void)
{ {
std::cout << "Hello, new world!\n"; std::cout << "Hello, new world!\n";
} }
...@@ -3,6 +3,7 @@ properties ...@@ -3,6 +3,7 @@ properties
Ocarina_Config::AADL_Files => Ocarina_Config::AADL_Files =>
("cpp_test.aadl"); ("cpp_test.aadl");
Ocarina_Config::Generator => polyorb_hi_c; Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Root_System_Name => "cpp_test.impl";
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),
...@@ -12,4 +13,3 @@ end cpp; ...@@ -12,4 +13,3 @@ end cpp;
system implementation cpp.Impl system implementation cpp.Impl
end 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;
C_FILES = $(srcdir)/toy.c C_FILES = $(srcdir)/toy.c
AADL_FILES = $(srcdir)/toy_example.aadl AADL_FILES = $(srcdir)/toy_example.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 \
$(srcdir)/scenario_local_xenomai_native.aadl $(srcdir)/scenario_local_xenomai_native.aadl \
$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common include $(srcdir)/../../Makefile.common
......
...@@ -17,6 +17,7 @@ properties ...@@ -17,6 +17,7 @@ properties
value (Ocarina_Config::Deployment), value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties)); value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2; Ocarina_Config::AADL_Version => AADLv2;
Ocarina_Config::Use_Components_Library => true;
end d3_1_3_1; end d3_1_3_1;
system implementation d3_1_3_1.Impl 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 ...@@ -229,16 +229,20 @@ public
system implementation toy_example.xenomai system implementation toy_example.xenomai
extends toy_example::toy_example.native extends toy_example::toy_example.native
properties properties
Deployment::Execution_Platform => LINUX32_XENOMAI_NATIVE applies to P1; Deployment::Execution_Platform => LINUX32_XENOMAI_NATIVE applies to P1;
end toy_example.xenomai; end toy_example.xenomai;
system implementation toy_example.xenomai_posix system implementation toy_example.xenomai_posix
extends toy_example::toy_example.native extends toy_example::toy_example.native
properties properties
Deployment::Execution_Platform => LINUX32_XENOMAI_POSIX applies to P1; Deployment::Execution_Platform => LINUX32_XENOMAI_POSIX applies to P1;
end toy_example.xenomai_posix; 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; end Toy_Example;
...@@ -3,8 +3,9 @@ AADL_FILES = \ ...@@ -3,8 +3,9 @@ AADL_FILES = \
$(srcdir)/software.aadl \ $(srcdir)/software.aadl \
$(srcdir)/ping.aadl $(srcdir)/ping.aadl
SCENARIO_FILES = \ SCENARIO_FILES = $(srcdir)/scenario.aadl
$(srcdir)/scenario.aadl
# $(srcdir)/scenario_rtems.aadl $(srcdir)/scenario_local.aadl
include $(srcdir)/../../Makefile.common 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 package PING
public public
with Software; with Software;
...@@ -11,87 +5,120 @@ public ...@@ -11,87 +5,120 @@ public
with ocarina_drivers; with ocarina_drivers;
with ocarina_buses; with ocarina_buses;
--------------- ---------------
-- Processor -- -- Processor --
--------------- ---------------
processor the_processor processor the_processor
properties properties
Deployment::location => "127.0.0.1"; Deployment::location => "127.0.0.1";
Deployment::Execution_Platform => Native; Deployment::Execution_Platform => Native;
Priority_Range => 0 .. 255; Priority_Range => 0 .. 255;
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol); Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
end the_processor; end the_processor;
--------- ---------
-- Bus -- -- Bus --
--------- ---------
bus Ethernet_Bus bus Ethernet_Bus
properties properties
Deployment::Transport_API => BSD_Sockets; Deployment::Transport_API => BSD_Sockets;
end Ethernet_Bus; end Ethernet_Bus;
--------------- ---------------
-- Processes -- -- Processes --
--------------- ---------------
process A process A
features features
Out_Port : out event data port Software::Simple_Type; Out_Port : out event data port Software::Simple_Type;
end A; end A;
process implementation A.Impl process implementation A.Impl
subcomponents subcomponents
Pinger : thread Software::P.Impl; Pinger : thread Software::P.Impl;
produce_pkts : thread software::packet_producer.i; produce_pkts : thread software::packet_producer.i;
connections connections
port Pinger.Data_Source -> Out_Port; port Pinger.Data_Source -> Out_Port;
end A.Impl; end A.Impl;
process B process B
features features
In_Port : in event data port Software::Simple_Type; In_Port : in event data port Software::Simple_Type;
end B; end B;
process implementation B.Impl process implementation B.Impl
subcomponents subcomponents
Ping_Me : thread Software::Q.Impl; Ping_Me : thread Software::Q.Impl;
connections connections
port In_Port -> Ping_Me.Data_Sink; port In_Port -> Ping_Me.Data_Sink;
end B.Impl; end B.Impl;
------------ process singleProcess
-- System -- end singleProcess;
------------
process implementation singleProcess.Impl
system PING subcomponents
end PING; Pinger : thread Software::P.Impl;
produce_pkts : thread software::packet_producer.i;
system implementation PING.Impl Ping_Me : thread Software::Q.Impl;
subcomponents connections
Node_A : process A.Impl; port Pinger.Data_Source -> Ping_Me.Data_Sink;
Node_B : process B.Impl; end singleProcess.Impl;
Device_A : device ocarina_drivers::generic_sockets_ip.pohic ------------
-- System --
------------
system PING
end PING;
system implementation PING.Impl
subcomponents
Node_A : process A.Impl;
Node_B : process B.Impl;
Device_A : device ocarina_drivers::generic_sockets_ip.pohic
{Source_Text => ("devicesconf.c");}; {Source_Text => ("devicesconf.c");};
Device_B : device ocarina_drivers::generic_sockets_ip.pohic Device_B : device ocarina_drivers::generic_sockets_ip.pohic
{Source_Text => ("devicesconf.c");}; {Source_Text => ("devicesconf.c");};
CPU_A : processor the_processor; CPU_A : processor the_processor;
CPU_B : processor the_processor; CPU_B : processor the_processor;
the_bus : bus ocarina_buses::ip.i; the_bus : bus ocarina_buses::ip.i;
connections connections
bus access the_bus -> Device_A.link; bus access the_bus -> Device_A.link;
bus access the_bus -> Device_B.link; bus access the_bus -> Device_B.link;
port Node_A.Out_Port -> Node_B.In_Port port Node_A.Out_Port -> Node_B.In_Port
{Actual_Connection_Binding => (reference (the_bus));}; {Actual_Connection_Binding => (reference (the_bus));};
properties properties
actual_processor_binding => reference (CPU_A) applies to Node_A; 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_B) applies to Node_B;
actual_processor_binding => (reference (CPU_A)) applies to Device_A; actual_processor_binding => (reference (CPU_A)) applies to Device_A;
actual_processor_binding => (reference (CPU_B)) applies to Device_B; 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; end PING;
#include <stdio.h> #include <stdio.h>
#include <request.h> #include <request.h>
#include <deployment.h> #include <deployment.h>
#include <po_hi_storage.h> #include <po_hi_storage.h>
#include <po_hi_gqueue.h>
#define FILENAME "pinger.dat" #define FILENAME "pinger.dat"
...@@ -27,7 +28,6 @@ void user_produce_pkts_init () ...@@ -27,7 +28,6 @@ void user_produce_pkts_init ()
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME); printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
} }
fflush (stdout); fflush (stdout);
} }
...@@ -81,6 +81,7 @@ void user_do_ping_spg () ...@@ -81,6 +81,7 @@ void user_do_ping_spg ()
fflush (stdout); fflush (stdout);
} }
void recover (void) void recover (void)
{ {
printf ("*** RECOVER ACTION ***\n"); printf ("*** RECOVER ACTION ***\n");
......
...@@ -5,9 +5,9 @@ void user_ping_spg (int i) ...@@ -5,9 +5,9 @@ void user_ping_spg (int i)
printf ("*** PING *** %d\n" ,i); printf ("*** PING *** %d\n" ,i);
fflush (stdout); fflush (stdout);
} }
/* redundant
void recover (void) void recover (void)
{ {
printf ("*** RECOVER ACTION ***\n"); printf ("*** RECOVER ACTION ***\n");
fflush (stdout); fflush (stdout);
} }*/
...@@ -7,6 +7,7 @@ properties ...@@ -7,6 +7,7 @@ properties
"node_b", "node_b.ref"); "node_b", "node_b.ref");
Ocarina_Config::AADL_Files => Ocarina_Config::AADL_Files =>
("ping.aadl" , "software.aadl"); ("ping.aadl" , "software.aadl");
Ocarina_Config::Root_System_Name => "PING.impl";
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),
......