From b32c67e4a89b4752b222ee9135ef41d9f8ecca8e Mon Sep 17 00:00:00 2001 From: Maxime Perrotin Date: Wed, 17 Jan 2018 10:32:41 +0100 Subject: [PATCH] Keep original code from the test --- .../cyclic_function/cyclic_function.c | 48 +++++++++++++++++-- .../passive_function/passive_function.c | 25 ++++++---- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/Demo_ContextParams/cyclic_function/cyclic_function.c b/Demo_ContextParams/cyclic_function/cyclic_function.c index e28b117..fb2c1c9 100644 --- a/Demo_ContextParams/cyclic_function/cyclic_function.c +++ b/Demo_ContextParams/cyclic_function/cyclic_function.c @@ -2,14 +2,54 @@ #include "cyclic_function.h" -void cyclic_function_startup() +#include + +#ifdef REPORT_MALLOC +#include +#endif + +#include "cyclic_function.h" +#include + +void cyclic_function_startup() { - /* Write your initialization code here, - but do not make any call to a required interface. */ + printf ("[cyclic function] startup done\n"); } void cyclic_function_PI_cyclic_activation() { - /* Write your code here! */ + 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 } + diff --git a/Demo_ContextParams/passive_function/passive_function.c b/Demo_ContextParams/passive_function/passive_function.c index 6dc381f..2f365eb 100644 --- a/Demo_ContextParams/passive_function/passive_function.c +++ b/Demo_ContextParams/passive_function/passive_function.c @@ -1,19 +1,28 @@ /* User code: This file will not be overwritten by TASTE. */ -#include "passive_function.h" +/* Functions to be filled by the user (never overwritten by buildsupport tool) */ -/* Function static data is declared in this file : */ +#include "passive_function.h" #include "Context-passive-function.h" +#include -void passive_function_startup() +void passive_function_startup() { - /* Write your initialization code here, - but do not make any call to a required interface. */ + printf ("[passive_function] startup done\n"); } -void passive_function_PI_compute_data(const asn1SccT_SEQUENCE *IN_my_in, - asn1SccT_INTEGER *OUT_result) +void passive_function_PI_compute_data(const asn1SccT_SEQUENCE *IN_my_in, asn1SccT_INTEGER *OUT_result) { - /* Write your code here! */ + *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; + } + -- GitLab