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([ ...@@ -220,6 +220,7 @@ AC_OUTPUT([
examples/aadlv2/packet-store/Makefile examples/aadlv2/packet-store/Makefile
examples/aadlv2/file-store/Makefile examples/aadlv2/file-store/Makefile
examples/aadlv2/latency/Makefile examples/aadlv2/latency/Makefile
examples/aadlv2/priority_test/Makefile
examples/aadlv2/rma/Makefile examples/aadlv2/rma/Makefile
examples/aadlv2/rpc/Makefile examples/aadlv2/rpc/Makefile
examples/aadlv2/some-types/Makefile examples/aadlv2/some-types/Makefile
......
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 lua cpp \ some-types-stdint flight-mgmt import monitor lua cpp \
packet-store file-store latency code_coverage torture_gqueue \ 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'} SAMPLE_DIR = ${shell $(CYGPATH_U) '$(OCARINA_PREFIX)/examples/ocarina/polyorb-hi-c/aadlv2'}
......
...@@ -12,23 +12,25 @@ __po_hi_storage_file_t myfile_write; ...@@ -12,23 +12,25 @@ __po_hi_storage_file_t myfile_write;
void user_produce_pkts_init () void user_produce_pkts_init ()
{ {
printf ("*** INIT DATA PRODUCER ***\n"); printf ("*** INIT DATA PRODUCER ***\n");
fflush (stdout);
if (__po_hi_storage_file_open (FILENAME, &myfile_write) != __PO_HI_SUCCESS) if (__po_hi_storage_file_open (FILENAME, &myfile_write) != __PO_HI_SUCCESS)
{ {
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME); printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
} fflush (stdout);
}
if (__po_hi_storage_file_create (&myfile_write) != __PO_HI_SUCCESS) if (__po_hi_storage_file_create (&myfile_write) != __PO_HI_SUCCESS)
{ {
printf ("*** /!\\ ERROR WHEN CREATING THE FILE %s /!\\ ***\n", FILENAME); printf ("*** /!\\ ERROR WHEN CREATING THE FILE %s /!\\ ***\n", FILENAME);
} fflush (stdout);
}
if (__po_hi_storage_file_open (FILENAME, &myfile_read) != __PO_HI_SUCCESS) if (__po_hi_storage_file_open (FILENAME, &myfile_read) != __PO_HI_SUCCESS)
{ {
printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME); printf ("*** /!\\ ERROR WHEN OPENING THE FILE %s /!\\ ***\n", FILENAME);
} fflush (stdout);
}
fflush (stdout);
} }
void user_produce_pkts () void user_produce_pkts ()
...@@ -41,19 +43,17 @@ void user_produce_pkts () ...@@ -41,19 +43,17 @@ void user_produce_pkts ()
pkt.port = pinger_global_data_source; pkt.port = pinger_global_data_source;
printf ("*** PRODUCE PKT WITH VALUE *** %d\n", p); printf ("*** PRODUCE PKT WITH VALUE *** %d\n", p);
fflush (stdout);
p++; p++;
ret = __po_hi_storage_file_write (&myfile_write, &pkt, sizeof (__po_hi_request_t)); ret = __po_hi_storage_file_write (&myfile_write, &pkt, sizeof (__po_hi_request_t));
if (ret != __PO_HI_SUCCESS) if (ret != __PO_HI_SUCCESS)
{ {
printf ("*** /!\\ ERROR WHEN WRITING A PACKET IN THE FILE (ret=%d) /!\\ ***\n", ret); printf ("*** /!\\ ERROR WHEN WRITING A PACKET IN THE FILE (ret=%d) /!\\ ***\n", ret);
} fflush (stdout);
}
}
fflush (stdout);
}
void user_do_ping_spg () void user_do_ping_spg ()
{ {
...@@ -64,24 +64,22 @@ 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)); ret = __po_hi_storage_file_read (&myfile_read, &pkt, sizeof (__po_hi_request_t));
if (ret != __PO_HI_SUCCESS) if (ret != __PO_HI_SUCCESS) {
{ printf ("*** /!\\ ERROR WHEN READING A PACKET FROM FILE /!\\ ***\n");
printf ("*** /!\\ ERROR WHEN READING A PACKET FROM FILE /!\\ ***\n"); fflush (stdout);
if (ret == __PO_HI_UNAVAILABLE) if (ret == __PO_HI_UNAVAILABLE) {
{ printf ("*** /!\\ ;_; NO PACKET AVAILABLE AT THIS TIME ;_; /!\\ ***\n");
printf ("*** /!\\ ;_; NO PACKET AVAILABLE AT THIS TIME ;_; /!\\ ***\n"); fflush (stdout);
} }
} } else {
else printf ("*** SENDING PKT *** \n");
{ fflush (stdout);
printf ("*** SENDING PKT *** \n"); __po_hi_gqueue_store_out (node_a_pinger_k, pinger_local_data_source, &(pkt));
__po_hi_gqueue_store_out (node_a_pinger_k, pinger_local_data_source, &(pkt));
} }
fflush (stdout); fflush (stdout);
} }
void recover (void) void recover (void)
{ {
printf ("*** RECOVER ACTION ***\n"); printf ("*** RECOVER ACTION ***\n");
......
...@@ -7,126 +7,136 @@ int job = 0; ...@@ -7,126 +7,136 @@ int job = 0;
void on_req(__po_hi_task_id self) void on_req(__po_hi_task_id self)
{ {
__po_hi_request_t request; __po_hi_request_t request;
request.port = landing_gear_global_dummy_out; request.port = landing_gear_global_dummy_out;
printf("=== Starting gear op ===\n"); printf("=== Starting gear op ===\n");
__po_hi_gqueue_store_out(self,landing_gear_local_dummy_out,&request); fflush (stdout);
__po_hi_gqueue_store_out(self,landing_gear_local_dummy_out,&request);
} }
void on_dummy(__po_hi_task_id self) 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) void on_dummy_in(__po_hi_task_id self)
{ {
__po_hi_request_t request; __po_hi_request_t request;
printf("=== Gear op done ===\n"); printf("=== Gear op done ===\n");
__po_hi_gqueue_store_out(self,landing_gear_local_ack,&request); fflush (stdout);
__po_hi_gqueue_store_out(self,landing_gear_local_ack,&request);
} }
void on_stall_warning (__po_hi_task_id self, int i) void on_stall_warning (__po_hi_task_id self, int i)
{ {
if (i==1) if (i==1)
{ {
printf("=== STALL ALARM %d ====\n", i); printf("=== STALL ALARM %d ====\n", i);
} fflush (stdout);
else }
{ else
printf("=== False Alert %d ====\n", i); {
} printf("=== False Alert %d ====\n", i);
fflush (stdout);
}
} }
void on_engine_failure(__po_hi_task_id self) 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) void on_gear_cmd(__po_hi_task_id self)
{ {
__po_hi_request_t request; __po_hi_request_t request;
__po_hi_gqueue_store_out(self,hci_local_gear_req,&request); __po_hi_gqueue_store_out(self,hci_local_gear_req,&request);
} }
void on_gear_ack(__po_hi_task_id self) 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) void on_operator (__po_hi_task_id self)
{ {
__po_hi_request_t request; __po_hi_request_t request;
__po_hi_gqueue_store_out(self,operator_local_gear_cmd,&request); __po_hi_gqueue_store_out(self,operator_local_gear_cmd,&request);
} }
void on_sensor_sim(__po_hi_task_id self) void on_sensor_sim(__po_hi_task_id self)
{ {
int cr_v = 0; int cr_v = 0;
int aoa_v = 4; int aoa_v = 4;
__po_hi_request_t request1; __po_hi_request_t request1;
__po_hi_request_t request2; __po_hi_request_t request2;
job++; job++;
if ( (job%40) == 0 ) 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; request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 25;
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 4; 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_aoa,&request1);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2); __po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
printf("=== Sensor Sim setting soft stall ===\n"); printf("=== Sensor Sim setting hard stall ===\n");
fflush (stdout);
} }
else else
{ {
if ( (job%201) == 0 ) if ( (job%401) == 0 )
{ {
request1.vars.sensor_sim_global_aoa.sensor_sim_global_aoa = 25; __po_hi_gqueue_store_out(self,sensor_sim_local_engine_failure,&request1);
request2.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate = 9; printf("=== Sensor Sim raising engine failure ===\n");
__po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1); fflush (stdout);
__po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2); }
printf("=== Sensor Sim setting hard stall ===\n"); else
} {
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;
if ( (job%401) == 0 ) __po_hi_gqueue_store_out(self,sensor_sim_local_aoa,&request1);
{ __po_hi_gqueue_store_out(self,sensor_sim_local_climb_rate,&request2);
__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);
}
}
} }
}
} }
void on_stall_monitor(__po_hi_task_id self) void on_stall_monitor(__po_hi_task_id self)
{ {
int aoa_v; int aoa_v;
int cr_v; int cr_v;
__po_hi_request_t request; __po_hi_request_t request;
__po_hi_gqueue_get_value(self,stall_monitor_local_aoa,&(request)); __po_hi_gqueue_get_value(self,stall_monitor_local_aoa,&(request));
aoa_v = request.vars.sensor_sim_global_aoa.sensor_sim_global_aoa; aoa_v = request.vars.sensor_sim_global_aoa.sensor_sim_global_aoa;
__po_hi_gqueue_get_value(self,stall_monitor_local_climb_rate,&(request)); __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; cr_v = request.vars.sensor_sim_global_climb_rate.sensor_sim_global_climb_rate;
if (aoa_v > 40) if (aoa_v > 40)
{ {
request.vars.stall_monitor_global_stall_warn.stall_monitor_global_stall_warn = 2; 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); __po_hi_gqueue_store_out(self,stall_monitor_local_stall_warn,&request);
} }
else 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 ...@@ -11,4 +11,4 @@ include $(srcdir)/../../Makefile.common
EXTRA_DIST = $(AADL_FILES) $(SCENARIO_FILES) $(C_FILES) 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 *** 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 *** PING *** 0
Receive message *** PING *** 1
Receive message from node 0
Using raw protocol stack
ERROR, 0 12
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