Commit 77163c14 authored by jdelange's avatar jdelange

* aadlv2/Makefile.am

   aadlv2/file-store
   - Add an example for the file store functionality



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@3545 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 32648845
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 packet-store file-store
SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......
C_FILES = $(srcdir)/pinger.c $(srcdir)/pingme.c $(srcdir)/ping.h $(srcdir)/devicesconf.c
AADL_FILES = \
$(srcdir)/software.aadl \
$(srcdir)/ping.aadl
SCENARIO_FILES = \
$(srcdir)/scenario.aadl
include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES)
CLEANDIRS = ping_impl
#include <drivers/configuration/ip.h>
__po_hi_c_ip_conf_t pohidrv_device_a = { .devname = "eth0", .address = "127.0.0.1", .version = __po_hi_c_ipv4, .port = 1234};
__po_hi_c_ip_conf_t pohidrv_device_b = { .devname = "eth0", .address = "127.0.0.1", .version = __po_hi_c_ipv4, .port = 1235};
-- 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;
with Deployment;
with ocarina_drivers;
with ocarina_buses;
---------------
-- Processor --
---------------
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;
---------
-- Bus --
---------
bus Ethernet_Bus
properties
Deployment::Transport_API => BSD_Sockets;
end Ethernet_Bus;
---------------
-- Processes --
---------------
process A
features
Out_Port : out event data port Software::Simple_Type;
end A;
process implementation A.Impl
subcomponents
Pinger : thread Software::P.Impl;
produce_pkts : thread software::packet_producer.i;
connections
port Pinger.Data_Source -> Out_Port;
end A.Impl;
process B
features
In_Port : in event data port Software::Simple_Type;
end B;
process implementation B.Impl
subcomponents
Ping_Me : thread Software::Q.Impl;
connections
port In_Port -> Ping_Me.Data_Sink;
end B.Impl;
------------
-- 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");};
Device_B : device ocarina_drivers::generic_sockets_ip.pohic
{Source_Text => ("devicesconf.c");};
CPU_A : processor the_processor;
CPU_B : processor the_processor;
the_bus : bus ocarina_buses::ip.i;
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
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;
#ifndef __PING_H_
#define __PING_H_
typedef int custom_int;
#endif
#include <stdio.h>
#include <request.h>
#include <deployment.h>
#include <po_hi_storage.h>
#define FILENAME "pinger.dat"
__po_hi_storage_file_t myfile_read;
__po_hi_storage_file_t myfile_write;
void user_produce_pkts_init ()
{
printf ("*** INIT DATA PRODUCER ***\n");
if (__po_hi_storage_file_open (FILENAME, &myfile_write) != __PO_HI_SUCCESS)
{
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
}
if (__po_hi_storage_file_create (&myfile_write) != __PO_HI_SUCCESS)
{
printf ("*** /!\\ ERROR WHEN CREATING THE FILE %s /!\\ ***\n", FILENAME);
}
if (__po_hi_storage_file_open (FILENAME, &myfile_read) != __PO_HI_SUCCESS)
{
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
}
fflush (stdout);
}
void user_produce_pkts ()
{
static int p = 0;
int ret;
__po_hi_request_t pkt;
pkt.vars.pinger_global_data_source.pinger_global_data_source = p;
pkt.port = pinger_global_data_source;
printf ("*** PRODUCE PKT WITH VALUE *** %d\n", p);
p++;
ret = __po_hi_storage_file_write (&myfile_write, &pkt, sizeof (__po_hi_request_t));
if (ret != __PO_HI_SUCCESS)
{
printf ("*** /!\\ ERROR WHEN WRITING A PACKET IN THE FILE (ret=%d) /!\\ ***\n", ret);
}
fflush (stdout);
}
void user_do_ping_spg ()
{
int ret;
__po_hi_request_t pkt;
ret = __po_hi_storage_file_read (&myfile_read, &pkt, sizeof (__po_hi_request_t));
if (ret != __PO_HI_SUCCESS)
{
printf ("*** /!\\ ERROR WHEN READING A PACKET FROM FILE /!\\ ***\n");
if (ret == __PO_HI_UNAVAILABLE)
{
printf ("*** /!\\ ;_; NO PACKET AVAILABLE AT THIS TIME ;_; /!\\ ***\n");
}
}
else
{
printf ("*** SENDING PKT *** \n");
__po_hi_gqueue_store_out (node_a_pinger_k, pinger_local_data_source, &(pkt));
}
fflush (stdout);
}
void recover (void)
{
printf ("*** RECOVER ACTION ***\n");
fflush (stdout);
}
#include <stdio.h>
void user_ping_spg (int i)
{
printf ("*** PING *** %d\n" ,i);
fflush (stdout);
}
void recover (void)
{
printf ("*** RECOVER ACTION ***\n");
fflush (stdout);
}
system ping
properties
Ocarina_Config::Timeout_Property => 4000ms;
Ocarina_Config::Use_Components_Library => true;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref",
"node_b", "node_b.ref");
Ocarina_Config::AADL_Files =>
("ping.aadl" , "software.aadl");
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(value (Ocarina_Config::Data_Model),
value (Ocarina_Config::ARINC653_Properties),
value (Ocarina_Config::Deployment),
value (Ocarina_Config::Cheddar_Properties));
Ocarina_Config::AADL_Version => AADLv2;
end ping;
system implementation ping.impl
end ping.impl;
-- This AADL model illustrates how to model a simple interaction
-- between tasks, in a local or distributed environment.
--
-- One task pings another, sending a data periodically.
--
-- $Id: software.aadl 344 2007-04-17 14:48:16Z zalila $
package Software
public
with Data_Model;
----------
-- Data --
----------
data Simple_Type
properties
Data_Model::Data_Representation => integer;
end Simple_Type;
-----------------
-- Subprograms --
-----------------
subprogram produce_packet_init_spg
properties
source_language => C;
source_name => "user_produce_pkts_init";
source_text => ("pinger.c");
end produce_packet_init_spg;
subprogram produce_packet_spg
properties
source_language => C;
source_name => "user_produce_pkts";
source_text => ("pinger.c");
end produce_packet_spg;
subprogram Do_Ping_Spg
properties
source_language => C;
source_name => "user_do_ping_spg";
source_text => ("pinger.c");
end Do_Ping_Spg;
subprogram Ping_Spg
features
Data_Sink : in parameter Simple_Type;
properties
source_language => C;
source_name => "user_ping_spg";
source_text => ("pingme.c");
end Ping_Spg;
-------------
-- Threads --
-------------
thread packet_producer
end packet_producer;
thread implementation packet_producer.i
calls
Mycalls: {
produce : subprogram produce_packet_spg;
};
properties
Initialize_Entrypoint => classifier (software::produce_packet_init_spg);
Dispatch_Protocol => Periodic;
Period => 500 Ms;
Deadline => 500 ms;
Priority => 2;
end packet_producer.i;
thread P
features
Data_Source : out event data port Simple_Type;
end P;
thread implementation P.Impl
calls
Mycalls: {
P_Spg : subprogram Do_Ping_Spg;
};
properties
Recover_Entrypoint_Source_Text => "recover";
Dispatch_Protocol => Periodic;
Period => 1000 Ms;
Deadline => 1000 ms;
Priority => 2;
end P.Impl;
thread Q
features
Data_Sink : in event data port Simple_Type;
end Q;
thread implementation Q.Impl
calls
Mycalls: {
Q_Spg : subprogram Ping_Spg;
};
connections
parameter Data_Sink -> Q_Spg.Data_Sink;
properties
Dispatch_Protocol => Sporadic;
Period => 10 Ms;
deadline => 10 Ms;
Priority => 1;
end Q.Impl;
end Software;
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