Commit 45f640fe authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

This was actually Demo_Ada_GUI

parent 31f446a7
bench.vcd
bench.vcd
displayer.zip
router.zip
DataView DEFINITIONS AUTOMATIC TAGS ::= BEGIN
Display-T ::= OCTET STRING (SIZE (1..255))
Action-T ::= CHOICE
{
--display INTEGER (0..255),
display Display-T,
other-action INTEGER (0..1),
housekeeping Destination-T
}
Destination-T ::= ENUMERATED { displayer(0), other-dest(1) }
TC-T ::= SEQUENCE
{
destination Destination-T,
action Action-T
}
TM-T ::= Display-T
HK-T ::= SEQUENCE {
value-to-plot INTEGER (0..16535),
destination Destination-T
}
END
---------------------------------------------------
-- AADL2.0
-- TASTE
-- (c)Ellidiss Technologies
--
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS mypartition
END mypartition;
PROCESS IMPLEMENTATION mypartition.others
END mypartition.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node1
END Node1;
SYSTEM IMPLEMENTATION Node1.others
SUBCOMPONENTS
IV_mygui : SYSTEM interfaceview::IV::mygui.others {
Taste::coordinates => "1036 964 1318 1257";
Taste::FunctionName => "mygui";
};
IV_router : SYSTEM interfaceview::IV::router.others {
Taste::coordinates => "1462 985 1842 1257";
Taste::FunctionName => "router";
};
IV_displayer : SYSTEM interfaceview::IV::displayer.others {
Taste::coordinates => "1621 1323 2057 1498";
Taste::FunctionName => "displayer";
};
mypartition : PROCESS deploymentview::DV::Node1::mypartition.others {
Taste::coordinates => "849 755 2208 1562";
Deployment::Port_Number => 0;
};
x86_native : PROCESSOR ocarina_processors_x86::x86.native {
Taste::coordinates => "679 524 2378 1677";
};
PROPERTIES
Taste::APLC_Binding => (reference (mypartition)) APPLIES TO IV_mygui;
Taste::APLC_Binding => (reference (mypartition)) APPLIES TO IV_router;
Taste::APLC_Binding => (reference (mypartition)) APPLIES TO IV_displayer;
Actual_Processor_Binding => (reference (x86_native)) APPLIES TO mypartition;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "467 195 2590 1842";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 2970 2100";
Taste::version => "1.3.17";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
This diff is collapsed.
Demo_Ada_GUI
This demo tests a system containing two Ada functions and a GUI.
All the blocks exchange data.
The runtime target is Linux with both C and Ada runtimes.
This test is also used to validate the MSC plugin and Python scripts.
Once built, run test.with.python.sh to check both C and Ada versions
import time, sys
import DV
from dataview_uniq_asn import *
from PythonController import *
if __name__ == "__main__":
cnt = 0
thread = None
try:
thread = Poll_mygui()
thread.start()
print "Invoking TC"
a = TC_T()
a.action.kind.Set(DV.display_PRESENT)
cnt += 1
a.action.display.SetFromPyString("abc" + str(cnt))
a.destination.Set(Destination_T.displayer)
a.PrintAll()
Invoke_router_put_tc(a)
time.sleep(100)
except KeyboardInterrupt:
if thread:
thread._bDie = True
thread.join()
#!/bin/bash
# This script will build your TASTE system.
# You should check it before running it to make it fit with your context:
# 1) You may need to fix some paths and filenames (path to interface/deployment views)
# 2) You may need to specify additional paths for the compiler to find .h file
# (e.g. "export C_INCLUDE_PATH=/usr/include/xenomai/analogy/:$C_INCLUDE_PATH")
# 3) You may need to link with pre-built libraries, using the -l option
# (e.g. -l /usr/lib/libanalogy.a,/usr/lib/librtdm.a)
# 4) You may need to change the runtime (add -p flag to select PolyORB-HI-C)
# etc.
# Note: TASTE will not overwrite your changes - if you need to update some parts
# you will have to merge the changes with the newly-created file.
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
SKELS="./"
# Update the data view with local paths
taste-update-data-view
cd "$SKELS" && rm -f router.zip && zip router router/* && cd $OLDPWD
cd "$SKELS" && rm -f displayer.zip && zip displayer displayer/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
fi
# Build for POHIC
assert-builder-ocarina.py \
--fast -p \
--debug \
--aadlv2 \
--keep-case \
--interfaceView InterfaceView.aadl \
--deploymentView "$DEPLOYMENTVIEW" \
-o binary.linux.pohic \
--subAda router:"$SKELS"/router.zip \
--subAda displayer:"$SKELS"/displayer.zip \
$ORCHESTRATOR_OPTIONS
# Build for POHIAda
assert-builder-ocarina.py \
--fast \
--debug \
--aadlv2 \
--keep-case \
--interfaceView InterfaceView.aadl \
--deploymentView "$DEPLOYMENTVIEW" \
-o binary.linux.pohiada \
--subAda router:"$SKELS"/router.zip \
--subAda displayer:"$SKELS"/displayer.zip \
$ORCHESTRATOR_OPTIONS
-- User implementation of the displayer function
-- This file will never be overwritten once edited and modified
-- Only the interface of functions is regenerated (in the .ads file)
--pragma Profile (Ravenscar);
pragma style_checks (off);
pragma warnings (off);
with dataview;
use dataview;
with adaasn1rtl;
use adaasn1rtl;
with ada.Integer_Text_IO;
use ada.Integer_Text_IO;
with ada.Long_Float_Text_IO;
use ada.Long_Float_Text_IO;
with system.io;
use system.io;
with Interfaces;
use Interfaces;
package body displayer is
type A_String is access String;
person : asn1Scctm_t;
S : A_String;
bTmHasArrived : boolean;
number : asn1SccHK_T_value_to_plot := 0;
hk : aliased asn1SccHK_T;
procedure displayer_put_tc(tc: access asn1SccTC_T) is
begin
case asn1SccAction_T_kind(tc.action) is
when display_PRESENT =>
for J in 1 .. asn1SccAction_T_display_get(tc.action).length
loop
person.data(J) :=
asn1SccAction_T_display_get(tc.action).data(J);
end loop;
person.length :=
asn1SccAction_T_display_get(tc.action).length;
if (person.length>0) then
bTmHasArrived := True;
end if;
when housekeeping_PRESENT =>
hk := (value_to_plot => number,
destination => asn1SccAction_T_housekeeping_get
(tc.action));
HousekeepingTM(hk'access);
when others => null;
end case;
end displayer_put_tc;
procedure cyclicdisplayer is
my_tm : aliased asn1Scctm_t;
i : Integer;
begin
system.io.put_line ("cyclicdisplayer");
if bTmHasArrived then
for i in 1..person.length loop
my_tm.data(i) := person.data(i);
end loop;
my_tm.length := person.length;
router_send_tm(my_tm'access);
end if;
number := (number + 1) mod 16535;
end cyclicdisplayer;
begin
system.io.put_line ("init of displayer done");
person := asn1SccTM_T_Init;
bTmHasArrived := False;
end displayer;
-- This file was generated automatically: DO NOT MODIFY IT !
-- Declaration of the provided and required interfaces
pragma style_checks (off);
pragma warnings (off);
with adaasn1rtl;
use adaasn1rtl;
with dataview;
use dataview;
package displayer is
---------------------------------------------------------
-- Provided interface "cyclicdisplayer"
---------------------------------------------------------
procedure cyclicdisplayer;
pragma export(C, cyclicdisplayer, "displayer_PI_cyclicdisplayer");
---------------------------------------------------------
-- Provided interface "displayer_put_tc"
---------------------------------------------------------
procedure displayer_put_tc(tc: access asn1sccTC_T);
pragma export(C, displayer_put_tc, "displayer_PI_displayer_put_tc");
---------------------------------------------------------
-- Required interface "router_send_tm"
---------------------------------------------------------
procedure router_send_tm(tm: access asn1sccTM_T);
pragma import(C, router_send_tm, "displayer_RI_router_send_tm");
---------------------------------------------------------
-- Required interface "HousekeepingTM"
---------------------------------------------------------
procedure HousekeepingTM(hk_value: access asn1sccHK_T);
pragma import(C, HousekeepingTM, "displayer_RI_HousekeepingTM");
end displayer;
#!/usr/bin/env python
import sys, os, time, pexpect, subprocess
sys.path.append(os.path.abspath(".."))
import commonRegression
timeout = 5
expected = [
["init of displayer done", "init of router done"],
["init of displayer done", "init of router done"],
"cyclicdisplayer",
"cyclicdisplayer"
]
result=commonRegression.test(
["binary.linux.pohiada/binaries/mypartition"],
expected,
timeout)
if 0!=result:
sys.exit(1)
commonRegression.g_child.terminate(force=True)
result=commonRegression.test(
["binary.linux.pohic/binaries/mypartition"],
expected,
timeout)
if 0!=result:
sys.exit(1)
commonRegression.g_child.terminate(force=True)
binaries2 = [
"python Test_TM_TC_with_Demo_Ada.py"
]
expected2 = [
"Invoking TC",
'{ destination displayer , action display: "abc1" }',
"Received Telemetry: gui_send_tm",
"Parameter tm:",
"abc1",
"Received Telemetry: gui_send_tm",
"Parameter tm:",
"abc1"
]
def VerifyTM(binary):
print "Verifying TMs sent by", binary
p = None
try:
p = subprocess.Popen(binary, stdout=subprocess.PIPE)
if p == None:
sys.exit(1)
except:
sys.exit(1)
os.system("cp Test_TM_TC_with_Demo_Ada.py binary.linux.pohiada/GlueAndBuild/gluemygui/python/")
os.chdir("binary.linux.pohiada/GlueAndBuild/gluemygui/python")
result2=commonRegression.test(binaries2, expected2, timeout)
p.kill()
p.wait()
os.chdir("../../../../")
if 0!=result2:
sys.exit(1)
VerifyTM("binary.linux.pohiada/binaries/mypartition")
VerifyTM("binary.linux.pohic/binaries/mypartition")
-- User implementation of the router function
-- This file will never be overwritten once edited and modified
-- Only the interface of functions is regenerated (in the .ads file)
pragma style_checks (off);
pragma warnings (off);
with adaasn1rtl;
use adaasn1rtl;
with dataview;
use dataview;
with system.io;
package body router is
---------------------------------------------------------
-- Provided interface "router_put_tc"
---------------------------------------------------------
procedure router_put_tc(tc: access asn1SccTC_T) is
begin
displayer_put_tc(tc);
end router_put_tc;
---------------------------------------------------------
-- Provided interface "router_send_tm"
---------------------------------------------------------
procedure router_send_tm(tm: access asn1SccTM_T) is
begin
gui_send_tm(tm);
end router_send_tm;
begin
system.io.put_line ("init of router done");
end router;
-- This file was generated automatically: DO NOT MODIFY IT !
-- Declaration of the provided and required interfaces
pragma style_checks (off);
pragma warnings (off);
with adaasn1rtl;
use adaasn1rtl;
with dataview;
use dataview;
package router is
---------------------------------------------------------
-- Provided interface "router_send_tm"
---------------------------------------------------------
procedure router_send_tm(tm: access asn1sccTM_T);
pragma export(C, router_send_tm, "router_PI_router_send_tm");
---------------------------------------------------------
-- Provided interface "router_put_tc"
---------------------------------------------------------
procedure router_put_tc(tc: access asn1sccTC_T);
pragma export(C, router_put_tc, "router_PI_router_put_tc");
---------------------------------------------------------
-- Required interface "displayer_put_tc"
---------------------------------------------------------
procedure displayer_put_tc(tc: access asn1sccTC_T);
pragma import(C, displayer_put_tc, "router_RI_displayer_put_tc");
---------------------------------------------------------
-- Required interface "gui_send_tm"
---------------------------------------------------------
procedure gui_send_tm(tm: access asn1sccTM_T);
pragma import(C, gui_send_tm, "router_RI_gui_send_tm");
end router;
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