Commit e6e98aa2 authored by Maxime Perrotin's avatar Maxime Perrotin

Refactor Demo_ContextParams with V2

parent 6f91059f
---------------------------------------------------
-- AADL2.1
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS demo
END demo;
PROCESS IMPLEMENTATION demo.others
END demo.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH interfaceview::IV::cyclic_function;
WITH interfaceview::IV::passive_function;
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_cyclic_function : SYSTEM interfaceview::IV::cyclic_function::cyclic_function.others {
Taste::FunctionName => "cyclic_function";
};
IV_passive_function : SYSTEM interfaceview::IV::passive_function::passive_function.others {
Taste::FunctionName => "passive_function";
};
demo : PROCESS deploymentview::DV::Node1::demo.others {
Taste::coordinates => "113382 63614 152813 89886";
Deployment::Port_Number => 0;
};
x86_linux : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "108453 56108 157742 93639";
};
PROPERTIES
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_cyclic_function;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_passive_function;
Actual_Processor_Binding => (reference (x86_linux)) APPLIES TO demo;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "102292 45385 163903 99000";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
This diff is collapsed.
PACKAGE interfaceview::IV
PUBLIC
WITH DataView;
WITH interfaceview::FV;
WITH Taste;
---------------------------------------------------
-- TASTE Interface View
---------------------------------------------------
SYSTEM interfaceview
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
cyclic_function: SYSTEM interfaceview::IV::cyclic_function.others
{ Taste::Coordinates => "33 84 203 239"; };
passive_function: SYSTEM interfaceview::IV::passive_function.others
{ Taste::Coordinates => "350 97 553 274"; };
CONNECTIONS
obj553 : SUBPROGRAM ACCESS passive_function.compute_data_obj108 -> cyclic_function.compute_data_obj86
{ Taste::Coordinates => "203 161 276 161 276 193 350 193"; };
END interfaceview.others;
---------------------------------------------------
-- TASTE Function: interfaceview::IV::cyclic_function
---------------------------------------------------
SYSTEM cyclic_function
FEATURES
cyclic_activation_obj75 : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::cyclic_activation_obj75.others
{ Taste::Coordinates => "33 132";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 500 ms;
Taste::Deadline => 500 ms;
Taste::Importance => MEDIUM ;};
compute_data_obj86 : REQUIRES SUBPROGRAM ACCESS interfaceview::FV::compute_data_obj108.others
{ Taste::Coordinates => "203 161";
Taste::RCMoperationKind => unprotected;};
PROPERTIES
Source_Language => C;
Taste::Coordinates => "33 84 203 239";
Taste::Instance_Name => "cyclic_function";
END cyclic_function;
SYSTEM IMPLEMENTATION cyclic_function.others
SUBCOMPONENTS
cyclic_activation_obj75_impl : SUBPROGRAM interfaceview::FV::cyclic_activation_obj75.others
{ Compute_Execution_Time => 0ms..500ms ;};
CONNECTIONS
SUBPROGRAM ACCESS cyclic_activation_obj75_impl -> cyclic_activation_obj75;
END cyclic_function.others;
---------------------------------------------------
-- TASTE Function: interfaceview::IV::passive_function
---------------------------------------------------
SYSTEM passive_function
FEATURES
compute_data_obj108 : PROVIDES SUBPROGRAM ACCESS interfaceview::FV::compute_data_obj108.others
{ Taste::Coordinates => "350 193";
Taste::RCMoperationKind => unprotected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 100 ms;
Taste::Importance => MEDIUM ;};
PROPERTIES
Source_Language => C;
Taste::Coordinates => "350 97 553 274";
Taste::Instance_Name => "passive_function";
END passive_function;
SYSTEM IMPLEMENTATION passive_function.others
SUBCOMPONENTS
test1_obj97 : DATA DataView::T_INTEGER
{ Taste::FS_Default_Value => "3"; };
compute_data_obj108_impl : SUBPROGRAM interfaceview::FV::compute_data_obj108.others
{ Compute_Execution_Time => 0ms..0ms ;};
CONNECTIONS
DATA ACCESS test1_obj97 -> compute_data_obj108_impl.test1_obj97;
SUBPROGRAM ACCESS compute_data_obj108_impl -> compute_data_obj108;
END passive_function.others;
PROPERTIES
Taste::Coordinates => "0 0 2970 2100";
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
END interfaceview::IV;
PACKAGE interfaceview::FV
PUBLIC
WITH DataView;
WITH TASTE;
SUBPROGRAM cyclic_activation_obj75
END cyclic_activation_obj75;
SUBPROGRAM IMPLEMENTATION cyclic_activation_obj75.others
END cyclic_activation_obj75.others;
SUBPROGRAM compute_data_obj108
FEATURES
my_in : IN PARAMETER DataView::T_SEQUENCE
{ Taste::encoding => NATIVE; };
result : OUT PARAMETER DataView::T_INTEGER
{ Taste::encoding => NATIVE; };
test1_obj97 : REQUIRES DATA ACCESS DataView::T_INTEGER;
END compute_data_obj108;
SUBPROGRAM IMPLEMENTATION compute_data_obj108.others
END compute_data_obj108.others;
END interfaceview::FV;
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include <stdio.h>
#ifdef REPORT_MALLOC
#include <malloc.h>
#endif
#include "cyclic_function.h"
#include <stdio.h>
void cyclic_function_startup()
{
printf ("[cyclic function] startup done\n");
}
void cyclic_function_PI_cyclic_activation()
{
static asn1SccT_INTEGER i=0, j=0;
asn1SccT_INTEGER result=0;
asn1SccT_SEQUENCE seq;
seq.x=i;
seq.y=j;
#if WORD_SIZE==8
printf("cycle: input i=%lld, j=%lld\n", i, j);
#else
printf("cycle: input i=%ld, j=%ld\n", i, j);
#endif
cyclic_function_RI_compute_data(&seq, &result);
#if WORD_SIZE==8
printf(" result of computation: %lld\n", result);
#else
printf(" result of computation: %ld\n", result);
#endif
i++;
j++;
#ifdef REPORT_MALLOC
printf("Heap used so far:\n");
printf("total space allocated from system: %d\n", mallinfo().arena);
printf("total allocated space: %d\n", mallinfo().uordblks);
printf("total non-inuse space: %d\n", mallinfo().fordblks);
#endif
#ifdef COVERAGE
__gcov_flush();
#endif
}
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "passive_function.h"
#include "Context-passive-function.h"
#include <stdio.h>
void passive_function_startup()
{
printf ("[passive_function] startup done\n");
}
void passive_function_PI_compute_data(const asn1SccT_SEQUENCE *IN_my_in, asn1SccT_INTEGER *OUT_result)
{
*OUT_result = IN_my_in->x + IN_my_in->y;
// passive_function_ctxt.test1 = *OUT_result;
/* test1 is a context parameter */
// printf("test1 = %lld\n", passive_function_ctxt.test1);
printf("test1 = %lld\n", *OUT_result);
if (*OUT_result > 255) *OUT_result = 255;
}
---------------------------------------------------
-- AADL2.1
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::cyclic_function
PUBLIC
WITH interfaceview::IV::passive_function;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_cyclic_activation
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_cyclic_activation;
SUBPROGRAM IMPLEMENTATION PI_cyclic_activation.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 500 ms;
END PI_cyclic_activation.others;
SUBPROGRAM RI_compute_data
FEATURES
my_in : IN PARAMETER DataView::T_SEQUENCE {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::T_INTEGER {
Taste::encoding => NATIVE;
};
END RI_compute_data;
SUBPROGRAM IMPLEMENTATION RI_compute_data.others
END RI_compute_data.others;
SYSTEM cyclic_function
FEATURES
PI_cyclic_activation : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::cyclic_function::PI_cyclic_activation.others {
Taste::coordinates => "33 132";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 500 ms;
Taste::Deadline => 500 ms;
Taste::InterfaceName => "cyclic_activation";
};
RI_compute_data : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::passive_function::PI_compute_data.others {
Taste::coordinates => "203 161";
Taste::RCMoperationKind => unprotected;
Taste::InterfaceName => "compute_data";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => enabled;
END cyclic_function;
SYSTEM IMPLEMENTATION cyclic_function.others
END cyclic_function.others;
END interfaceview::IV::cyclic_function;
PACKAGE interfaceview::IV::passive_function
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_compute_data
FEATURES
my_in : IN PARAMETER DataView::T_SEQUENCE {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::T_INTEGER {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_compute_data;
SUBPROGRAM IMPLEMENTATION PI_compute_data.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_compute_data.others;
SYSTEM passive_function
FEATURES
PI_compute_data : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::passive_function::PI_compute_data.others {
Taste::coordinates => "350 193";
Taste::RCMoperationKind => unprotected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 100 ms;
Taste::InterfaceName => "compute_data";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => enabled;
END passive_function;
SYSTEM IMPLEMENTATION passive_function.others
SUBCOMPONENTS
test1_obj97 : DATA DataView::T_INTEGER {
Taste::FS_Default_Value => "3";
};
END passive_function.others;
END interfaceview::IV::passive_function;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::cyclic_function;
WITH interfaceview::IV::passive_function;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM interfaceview
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
cyclic_function : SYSTEM interfaceview::IV::cyclic_function::cyclic_function.others {
Taste::coordinates => "33 84 203 239";
};
passive_function : SYSTEM interfaceview::IV::passive_function::passive_function.others {
Taste::coordinates => "350 97 553 274";
};
CONNECTIONS
passive_function_PI_compute_data_cyclic_function_RI_compute_data : SUBPROGRAM ACCESS passive_function.PI_compute_data -> cyclic_function.RI_compute_data {
Taste::coordinates => "203 161 276 161 276 193 350 193";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 2970 2100";
Taste::version => "2.0";
END interfaceview::IV;
#!/bin/bash
# must be set from ~/assert_env.sh
[ ! -z "$CLEANUP" ] && rm -rf binary.linux.*
cd Inputs/code
rm -rf *.zip
zip cyclic_function cyclic_function/*
zip passive_function passive_function/*
cd ../..
# build with the C runtime
assert-builder-ocarina.py \
-f \
-p \
--aadlv2 \
-o binary.linux.pohic \
-i ./Inputs/InterfaceView.aadl \
-c ./Inputs/DeploymentView.aadl \
-C passive_function:./Inputs/code/passive_function.zip \
-C cyclic_function:./Inputs/code/cyclic_function.zip || exit 1
# build with the Ada runtime
assert-builder-ocarina.py \
-f \
--aadlv2 \
-o binary.linux.ada \
-i ./Inputs/InterfaceView.aadl \
-c ./Inputs/DeploymentView.aadl \
-C passive_function:./Inputs/code/passive_function.zip \
-C cyclic_function:./Inputs/code/cyclic_function.zip || exit 1
#!/bin/bash -e
# This script will build your TASTE system.
# You should not change this file as it was automatically generated.
# If you need additional preprocessing, there are three hook files
# that you can provide and that are called dring the build:
# user_init_pre.sh, user_init_post.sh and user_init_last.sh
# These files will never get overwritten by TASTE.'
# Inside these files you may set some environment variables:
# C_INCLUDE_PATH=/usr/include/xenomai/analogy/:${C_INCLUDE_PATH}
# unset USE_POHIC
CWD=$(pwd)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
COLOROFF="\e[0m"
else
COLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
if [ -f user_init_pre.sh ]
then
echo -e "${INFO} Executing user-defined init script"
source user_init_pre.sh
fi
# Use PolyORB-HI-C runtime
USE_POHIC=1
# Set Debug mode by default
DEBUG_MODE=--debug
# Detect models from Ellidiss tools v2, and convert them to 1.3
INTERFACEVIEW=InterfaceView.aadl
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo -e "${INFO} Converting interface view from V2 to V1.3"
TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
INTERFACEVIEW=__iv_1_3.aadl
};
if [ -z "$DEPLOYMENTVIEW" ]
then
DEPLOYMENTVIEW=DeploymentView.aadl
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$DEPLOYMENTVIEW" >/dev/null && {
echo -e "${INFO} Converting deployment view from V2 to V1.3"
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
};
SKELS="./"
# Check if Dataview references existing files
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j /tmp/dv.asn
cd "$SKELS" && rm -f cyclic_function.zip && zip cyclic_function cyclic_function/* && cd $OLDPWD
cd "$SKELS" && rm -f passive_function.zip && zip passive_function passive_function/* && cd $OLDPWD
[ ! -z "$CLEANUP" ] && rm -rf binary*
if [ -f ConcurrencyView.pro ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView.pro "
elif [ -f ConcurrencyView_Properties.aadl ]
then
ORCHESTRATOR_OPTIONS+=" -w ConcurrencyView_Properties.aadl "
fi
if [ -f user_init_post.sh ]
then
echo -e "${INFO} Executing user-defined post-init script"
source user_init_post.sh
fi
if [ -f additionalCommands.sh ]
then
source additionalCommands.sh
fi
# Build with Ada runtime
USE_POHIC=0
cd "$CWD" && assert-builder-ocarina.py \
--fast \
$DEBUG_MODE \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o binary.ada \
--subC cyclic_function:"$SKELS"/cyclic_function.zip \
--subC passive_function:"$SKELS"/passive_function.zip \
$ORCHESTRATOR_OPTIONS
# Build with the C runtime
OUTPUTDIR=binary.c
ORCHESTRATOR_OPTIONS+=" -p "
cd "$CWD" && assert-builder-ocarina.py \
--fast \
$DEBUG_MODE \
--aadlv2 \
--keep-case \
--interfaceView "$INTERFACEVIEW" \
--deploymentView "$DEPLOYMENTVIEW" \
-o "$OUTPUTDIR" \
--subC cyclic_function:"$SKELS"/cyclic_function.zip \
--subC passive_function:"$SKELS"/passive_function.zip \
$ORCHESTRATOR_OPTIONS
if [ -f user_init_last.sh ]
then
echo -e "${INFO} Executing user-defined post-build script"
source user_init_last.sh
fi
/* User code: This file will not be overwritten by TASTE. */
#include "cyclic_function.h"
void cyclic_function_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void cyclic_function_PI_cyclic_activation()
{
/* Write your code here! */
}
......@@ -7,11 +7,20 @@
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void cyclic_function_startup();
void cyclic_function_PI_cyclic_activation();
extern void cyclic_function_RI_compute_data(const asn1SccT_SEQUENCE *, asn1SccT_INTEGER *);
extern void cyclic_function_RI_compute_data(const asn1SccT_SEQUENCE *,
asn1SccT_INTEGER *);
#ifdef __cplusplus
}
#endif
#endif
/*
Code automatically generated by asn1scc tool
*/
#include <limits.h>
#include <string.h>
#include <math.h>
#include "Context-passive-function.h"
#if !defined(_MSC_VER) || _MSC_VER >= 1800
void asn1SccContext_passive_function_Initialize(asn1SccContext_passive_function* pVal)
{
*pVal = (asn1SccContext_passive_function) {
.test1 = 0
};
}
#endif
flag asn1SccContext_passive_function_IsConstraintValid(const asn1SccContext_passive_function* pVal, int* pErrCode)
{
flag ret = TRUE;
*pErrCode=0;
(void)pVal;
ret = asn1SccT_INTEGER_IsConstraintValid(&pVal->test1, pErrCode);
return ret;
}
const asn1SccContext_passive_function passive_function_ctxt = {
.test1 = 3
};
#ifndef GENERATED_ASN1SCC_CONTEXT_PASSIVE_FUNCTION_H
#define GENERATED_ASN1SCC_CONTEXT_PASSIVE_FUNCTION_H
/*
Code automatically generated by asn1scc tool
*/
#include "dataview-uniq.h"
#include "asn1crt.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
asn1SccT_INTEGER test1;
} asn1SccContext_passive_function;
#define asn1SccContext_passive_function_REQUIRED_BYTES_FOR_ENCODING 1
#define asn1SccContext_passive_function_REQUIRED_BITS_FOR_ENCODING 8
#define asn1SccContext_passive_function_REQUIRED_BYTES_FOR_ACN_ENCODING 1
#define asn1SccContext_passive_function_REQUIRED_BITS_FOR_ACN_ENCODING 8
#define asn1SccContext_passive_function_REQUIRED_BYTES_FOR_XER_ENCODING 88
void asn1SccContext_passive_function_Initialize(asn1SccContext_passive_function* pVal);
flag asn1SccContext_passive_function_IsConstraintValid(const asn1SccContext_passive_function* val, int* pErrCode);
extern const asn1SccContext_passive_function passive_function_ctxt;
/* ================= Encoding/Decoding function prototypes =================
* These functions are placed at the end of the file to make sure all types
* have been declared first, in case of parameterized ACN encodings
* ========================================================================= */
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef GENERATED_ASN1SCC_DATAVIEW_UNIQ_H
#define GENERATED_ASN1SCC_DATAVIEW_UNIQ_H
/*
Code automatically generated by asn1scc tool
*/
#include "asn1crt.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef asn1SccSint asn1SccT_Int32;
#define asn1SccT_Int32_REQUIRED_BYTES_FOR_ENCODING 4
#define asn1SccT_Int32_REQUIRED_BITS_FOR_ENCODING 32
#define asn1SccT_Int32_REQUIRED_BYTES_FOR_ACN_ENCODING 4
#define asn1SccT_Int32_REQUIRED_BITS_FOR_ACN_ENCODING 32
#define asn1SccT_Int32_REQUIRED_BYTES_FOR_XER_ENCODING 39
void asn1SccT_Int32_Initialize(asn1SccT_Int32* pVal);
flag asn1SccT_Int32_IsConstraintValid(const asn1SccT_Int32* val, int* pErrCode);
#ifndef ERR_asn1SccT_Int32
#define ERR_asn1SccT_Int32 1001 /*(-2147483648 .. 2147483647)*/
#endif
typedef asn1SccUint asn1SccT_UInt32;
#define asn1SccT_UInt32_REQUIRED_BYTES_FOR_ENCODING 4
#define asn1SccT_UInt32_REQUIRED_BITS_FOR_ENCODING 32
#define asn1SccT_UInt32_REQUIRED_BYTES_FOR_ACN_ENCODING 4
#define asn1SccT_UInt32_REQUIRED_BITS_FOR_ACN_ENCODING 32
#define asn1SccT_UInt32_REQUIRED_BYTES_FOR_XER_ENCODING 41