Commit d97307f5 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Merge remote-tracking branch 'POHIC-GitHub/master'

parents a4983ff7 ea0ed9b1
......@@ -220,6 +220,7 @@ AC_OUTPUT([
examples/aadlv2/packet-store/Makefile
examples/aadlv2/file-store/Makefile
examples/aadlv2/latency/Makefile
examples/aadlv2/priority_test/Makefile
examples/aadlv2/rma/Makefile
examples/aadlv2/rpc/Makefile
examples/aadlv2/some-types/Makefile
......
SUBDIRS = d3.1.3-1 ping rma sunseeker producer-consumer some-types \
some-types-stdint flight-mgmt import monitor lua cpp \
packet-store file-store latency code_coverage torture_gqueue \
rpc
rpc priority_test
SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......
......@@ -12,23 +12,25 @@ __po_hi_storage_file_t myfile_write;
void user_produce_pkts_init ()
{
printf ("*** INIT DATA PRODUCER ***\n");
fflush (stdout);
if (__po_hi_storage_file_open (FILENAME, &myfile_write) != __PO_HI_SUCCESS)
{
{
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
}
fflush (stdout);
}
if (__po_hi_storage_file_create (&myfile_write) != __PO_HI_SUCCESS)
{
{
printf ("*** /!\\ ERROR WHEN CREATING THE FILE %s /!\\ ***\n", FILENAME);
}
fflush (stdout);
}
if (__po_hi_storage_file_open (FILENAME, &myfile_read) != __PO_HI_SUCCESS)
{
{
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
}
fflush (stdout);
fflush (stdout);
}
}
void user_produce_pkts ()
......@@ -41,19 +43,17 @@ void user_produce_pkts ()
pkt.port = pinger_global_data_source;
printf ("*** PRODUCE PKT WITH VALUE *** %d\n", p);
fflush (stdout);
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);
}
fflush (stdout);
}
}
void user_do_ping_spg ()
{
......@@ -64,24 +64,22 @@ void user_do_ping_spg ()
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_SUCCESS) {
printf ("*** /!\\ ERROR WHEN READING A PACKET FROM FILE /!\\ ***\n");
fflush (stdout);
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));
if (ret == __PO_HI_UNAVAILABLE) {
printf ("*** /!\\ ;_; NO PACKET AVAILABLE AT THIS TIME ;_; /!\\ ***\n");
fflush (stdout);
}
} else {
printf ("*** SENDING PKT *** \n");
fflush (stdout);
__po_hi_gqueue_store_out (node_a_pinger_k, pinger_local_data_source, &(pkt));
}
fflush (stdout);
}
void recover (void)
{
printf ("*** RECOVER ACTION ***\n");
......
......@@ -7,126 +7,136 @@ int job = 0;
void on_req(__po_hi_task_id self)
{
__po_hi_request_t request;
request.port = landing_gear_global_dummy_out;
printf("=== Starting gear op ===\n");
__po_hi_gqueue_store_out(self,landing_gear_local_dummy_out,&request);
__po_hi_request_t request;
request.port = landing_gear_global_dummy_out;
printf("=== Starting gear op ===\n");
fflush (stdout);
__po_hi_gqueue_store_out(self,landing_gear_local_dummy_out,&request);
}
void on_dummy(__po_hi_task_id self)
{
printf("=== Starting gear done ===\n");
printf("=== Starting gear done ===\n");
fflush (stdout);
}
void on_dummy_in(__po_hi_task_id self)
{
__po_hi_request_t request;
printf("=== Gear op done ===\n");
__po_hi_gqueue_store_out(self,landing_gear_local_ack,&request);
__po_hi_request_t request;
printf("=== Gear op done ===\n");
fflush (stdout);
__po_hi_gqueue_store_out(self,landing_gear_local_ack,&request);
}
void on_stall_warning (__po_hi_task_id self, int i)
{
if (i==1)
{
printf("=== STALL ALARM %d ====\n", i);
}
else
{
printf("=== False Alert %d ====\n", i);
}
if (i==1)
{
printf("=== STALL ALARM %d ====\n", i);
fflush (stdout);
}
else
{
printf("=== False Alert %d ====\n", i);
fflush (stdout);
}
}
void on_engine_failure(__po_hi_task_id self)
{
printf("=== ENGINE FAILURE ALARM ===\n");
printf("=== ENGINE FAILURE ALARM ===\n");
fflush (stdout);
}
void on_gear_cmd(__po_hi_task_id self)
{
__po_hi_request_t request;
__po_hi_gqueue_store_out(self,hci_local_gear_req,&request);
__po_hi_request_t request;
__po_hi_gqueue_store_out(self,hci_local_gear_req,&request);
}
void on_gear_ack(__po_hi_task_id self)
{
printf("=== Gear Locked ===\n");
printf("=== Gear Locked ===\n");
fflush (stdout);
}
void on_operator (__po_hi_task_id self)
{
__po_hi_request_t request;
__po_hi_gqueue_store_out(self,operator_local_gear_cmd,&request);
__po_hi_request_t request;
__po_hi_gqueue_store_out(self,operator_local_gear_cmd,&request);
}
void on_sensor_sim(__po_hi_task_id self)
{
int cr_v = 0;
int aoa_v = 4;
__po_hi_request_t request1;
__po_hi_request_t request2;
job++;
if ( (job%40) == 0 )
int cr_v = 0;
int aoa_v = 4;
__po_hi_request_t request1;
__po_hi_request_t request2;
job++;
if ( (job%40) == 0 )
{
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 41;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 4;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
printf("=== Sensor Sim setting soft stall ===\n");
fflush (stdout);
}
else
{
if ( (job%201) == 0 )
{
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 41;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 4;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
printf("=== Sensor Sim setting soft stall ===\n");
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 25;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 9;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
printf("=== Sensor Sim setting hard stall ===\n");
fflush (stdout);
}
else
else
{
if ( (job%201) == 0 )
{
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 25;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 9;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
printf("=== Sensor Sim setting hard stall ===\n");
}
else
{
if ( (job%401) == 0 )
{
__po_hi_gqueue_store_out(self,sensor_sim_local_engine_failure,&request1);
printf("=== Sensor Sim raising engine failure ===\n");
}
else
{
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = aoa_v;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = cr_v;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
}
}
if ( (job%401) == 0 )
{
__po_hi_gqueue_store_out(self,sensor_sim_local_engine_failure,&request1);
printf("=== Sensor Sim raising engine failure ===\n");
fflush (stdout);
}
else
{
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = aoa_v;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = cr_v;
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
}
}
}
}
void on_stall_monitor(__po_hi_task_id self)
{
int aoa_v;
int cr_v;
__po_hi_request_t request;
__po_hi_gqueue_get_value(self,stall_monitor_local_aoa,&(request));
aoa_v = request.vars.sensor_sim_global_aoa.sensor_sim_global_aoa;
__po_hi_gqueue_get_value(self,stall_monitor_local_climb_rate,&(request));
cr_v = request.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate;
if (aoa_v > 40)
{
request.vars.stall_monitor_global_stall_warn.stall_monitor_global_stall_warn = 2;
__po_hi_gqueue_store_out(self,stall_monitor_local_stall_warn,&request);
}
else
int aoa_v;
int cr_v;
__po_hi_request_t request;
__po_hi_gqueue_get_value(self,stall_monitor_local_aoa,&(request));
aoa_v = request.vars.sensor_sim_global_aoa.sensor_sim_global_aoa;
__po_hi_gqueue_get_value(self,stall_monitor_local_climb_rate,&(request));
cr_v = request.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate;
if (aoa_v > 40)
{
request.vars.stall_monitor_global_stall_warn.stall_monitor_global_stall_warn = 2;
__po_hi_gqueue_store_out(self,stall_monitor_local_stall_warn,&request);
}
else
{
if ((aoa_v > 22 ) && (cr_v < 10))
{
if ((aoa_v > 22 ) && (cr_v < 10))
{
request.vars.stall_monitor_global_stall_warn.stall_monitor_global_stall_warn = 2;
__po_hi_gqueue_store_out(self,stall_monitor_local_stall_warn,&request);
}
request.vars.stall_monitor_global_stall_warn.stall_monitor_global_stall_warn = 2;
__po_hi_gqueue_store_out(self,stall_monitor_local_stall_warn,&request);
}
}
}
......@@ -11,4 +11,4 @@ include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES)
CLEANDIRS =
CLEANDIRS = topsystem_local topsystem_rtems
Initialize global queue for task-id 0 ... port 0 (used_size=0,first=0) ... done
[DRIVER SOCKETS] Cannot connect on device 1, wait 500ms
*** SENDING PING *** 0
Send value, emitter task 0, emitter port 0, emitter entity 0, destination ports :1 (entity=1) ... success ...
*** SENDING PING *** 1
Initialize global queue for task-id 0 ... port 0 (used_size=0,first=0) ... done
Receiver initialization finished
Receive message
Receive message from node 0
Using raw protocol stack
Message deliveredReceived in event data port message for task 0, port 0
Task 0 get a value on port 0
*** PING *** 0
Receive message
Receive message from node 0
Using raw protocol stack
ERROR, 0 12
*** PING *** 1
C_FILES = $(srcdir)/ptest.c $(srcdir)/whetstone.c
AADL_FILES = $(srcdir)/ptest.aadl
SCENARIO_FILES = $(srcdir)/scenario.aadl \
$(srcdir)/scenario_rtems.aadl
include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES)
CLEANDIRS = ptest_impl ptest_rtems_impl
SECOND TASK
FIRST TASK
SECOND TASK
FIRST TASK
SECOND TASK
SECOND TASK
FIRST TASK
SECOND TASK
SECOND TASK
FIRST TASK
SECOND TASK
SECOND TASK
-- This AADL model illustrates how to conduct schedulability analysis
-- using Cheddar, and then code generation of periodic tasks.
--
-- Three periodic tasks run in parrallel, without interaction, in order
-- to analyse Periodic Priority behavior.
--
-- Study Case Cottet, F., & Grolleau, E. (2005). Systèmes temps réel de contrôle-commande:
-- conception et implémentation. Dunod. Page 501. Using RTEMS.
package PTEST
public
with Deployment;
-----------------
-- Subprograms --
-----------------
subprogram Ptest_Spg_1
properties
source_language => (C);
source_name => "task_1";
source_text => ("ptest.c");
end Ptest_Spg_1;
subprogram Ptest_Spg_2
properties
source_language => (C);
source_name => "task_2";
source_text => ("ptest.c");
end Ptest_Spg_2;
subprogram Ptest_Spg_3
properties
source_language => (C);
source_name => "task_3";
source_text => ("ptest.c");
end Ptest_Spg_3;
-------------
-- Threads --
-------------
thread Task
end Task;
thread implementation Task.impl_1
calls
Mycalls: {
P_Spg : subprogram Ptest_Spg_1;
};
properties
Dispatch_Protocol => periodic;
Period => 600ms;
Priority => 30;
end Task.impl_1;
thread implementation Task.impl_2
calls
Mycalls: {
P_Spg : subprogram Ptest_Spg_2;
};
properties
Dispatch_Protocol => periodic;
Period => 800ms;
Priority => 20;
Dispatch_offset => 200ms;
end Task.impl_2;
thread implementation Task.impl_3
calls
Mycalls: {
P_Spg : subprogram Ptest_Spg_3;
};
properties
Dispatch_Protocol => periodic;
Period => 1200ms;
Priority => 10;
end Task.impl_3;
---------------
-- Processor --
---------------
processor cpurm
properties
Deployment::Execution_Platform => native;
end cpurm;
processor implementation cpurm.impl
properties
Scheduling_Protocol => (Posix_1003_Highest_Priority_First_Protocol);
Priority_Range => 0 .. 255;
end cpurm.impl;
---------------
-- Processes --
---------------
process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
Task2 : thread Task.impl_2;
Task3 : thread Task.impl_3;
end node_a.impl;
------------
-- System --
------------
system ptest
end ptest;
system implementation ptest.impl
subcomponents
ptest : process node_a.impl;
cpu_rm : processor cpurm.impl;
properties
Actual_Processor_Binding => (reference (cpu_rm)) applies to ptest;
end ptest.impl;
system implementation ptest.rtems_impl extends ptest.impl
properties
Deployment::Execution_platform => LEON_RTEMS_POSIX applies to cpu_rm;
end ptest.rtems_impl;
end PTEST;
#include <stdio.h>
#include <po_hi_time.h>
#include <unistd.h>
#include "whetstone.c"
#define loop 167
void task_1 (void)
{
// Time variable, C = WCET/100
int32_t C1 = 2 ;
int i = 0;
//Temporal Variable
__po_hi_time_t tstart;
__po_hi_time_t tfin;
printf("Starting FIRST TASK...\n");
fflush (stdout);
//Starting Time
int test1 = __po_hi_get_time(&tstart);
if (test1 < 0)
{
printf("ERROR TIME 1");
fflush (stdout);
}
//Executute Task with a certain duration
for (i=0 ; i < C1 ; i++){burnproc(loop);}
//Ending Time
int test2 = __po_hi_get_time(&tfin);
if (test2 < 0)
{ printf("ERROR TIME 2");
fflush (stdout);}
//Compute Time Duration
float duration = 1000.0*((float)(tfin.sec - tstart.sec)+((float)((tfin.nsec-tstart.nsec))/1000000000.0));
printf ("[%f msec] Completed FIRST TASK.\n",duration);
fflush (stdout);
}
void task_2 (void)
{
// Time variable, C = WCET/100
int32_t C2 = 1;
int i = 0;
//Temporal Variable
__po_hi_time_t tstart;
__po_hi_time_t tfin;
printf("Starting SECOND TASK...\n");
fflush (stdout);
//Starting Time
int test1 = __po_hi_get_time(&tstart);
if (test1 < 0)
{ printf("ERROR TIME 1");
fflush (stdout);}
//Executute Task with a certain duration
for (i=0 ; i < C2 ; i++){burnproc(loop);}
//Ending Time
int test2 = __po_hi_get_time(&tfin);
if (test2 < 0)
{ printf("ERROR TIME 2");
fflush (stdout);}
//Compute Time Duration
float duration = 1000.0*((float)(tfin.sec - tstart.sec)+((float)((tfin.nsec-tstart.nsec))/1000000000.0));
printf ("[%f msec] Completed SECOND TASK.\n",duration);
fflush (stdout);
}
void task_3 (void)
{
//Temporal Variable
__po_hi_time_t tstart;
__po_hi_time_t tfin;
// Time variable, C = WCET/100
int32_t C3 = 2 ;
int i = 0;
printf("Starting THIRD TASK...\n");
fflush (stdout);
//Starting Time
int test1 = __po_hi_get_time(&tstart);
if (test1 < 0)
{ printf("ERROR TIME 1");
fflush (stdout);}
//Executute Task with a certain duration
for (i=0 ; i < C3 ; i++){burnproc(loop);}
//Ending Time
int test2 = __po_hi_get_time(&tfin);
if (test2 < 0)
{ printf("ERROR TIME 2");
fflush (stdout);}
//Compute Time Duration
float duration = 1000.0*((float)(tfin.sec - tstart.sec)+((float)((tfin.nsec-tstart.nsec))/1000000000.0));
printf ("[%f msec] Completed THIRD TASK.\n",duration);
fflush (stdout);
}
package scenario
public
with Ocarina_Config;
system ptest
properties
Ocarina_Config::Timeout_Property => 10500ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("ptest.aadl");
Ocarina_Config::Root_System_Name => "ptest.impl";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(Ocarina_Config::Data_Model,
Ocarina_Config::Deployment,
Ocarina_Config::Cheddar_Properties);
Ocarina_Config::AADL_Version => AADLv2;
end ptest;
system implementation ptest.Impl
end ptest.Impl;
end scenario;
package scenario
public
with Ocarina_Config;
system ptest_rtems
properties
Ocarina_Config::Timeout_Property => 10500ms;
Ocarina_Config::Referencial_Files =>
("node_a", "node_a.ref");
Ocarina_Config::AADL_Files =>
("ptest.aadl");
Ocarina_Config::Root_System_Name => "ptest.rtems_impl";
Ocarina_Config::Generator => polyorb_hi_c;
Ocarina_Config::Needed_Property_Sets =>
(Ocarina_Config::Data_Model,
Ocarina_Config::Deployment,
Ocarina_Config::Cheddar_Properties);
Ocarina_Config::AADL_Version => AADLv2;
end ptest_rtems;
system implementation ptest_rtems.Impl
end ptest_rtems.Impl;
end scenario;
/*
* whetstone.c : adaptation of the Whetstone benchmark
* from Curnow, H.J. and Wichman, B.A. "A Synthetic Benchmark"
* Computer Journal, Volume 19, Issue 1, February 1976., p. 43-49.
*/
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <po_hi_time.h>
#include <unistd.h>
#include <math.h>
/*Values from the original Algol Whetstone program
and the Pascal SmallWhetstone program*/
double T = 0.499975;
double T1 = 0.50025;
double T2 = 2.0;
double LOOP = 1.0;
int N8 = 10;
int N9 = 7;
double Value = 0.941377; // Value calculated in main loop
double Tolerance = 0.00001; // Determined by interval arithmetic