From 5787edc500a796b2c0703694be27b72579da6537 Mon Sep 17 00:00:00 2001
From: errea <javier.errea-moreno@eurecom.fr>
Date: Thu, 24 Jan 2019 20:13:02 +0100
Subject: [PATCH] Updated version for MBED

---
 .DS_Store                                     | Bin 14340 -> 14340 bytes
 executablecode/.DS_Store                      | Bin 14340 -> 14340 bytes
 executablecode/src_MBED/.DS_Store             | Bin 0 -> 6148 bytes
 executablecode/src_MBED/asyncchannel.cpp      |   3 +-
 executablecode/src_MBED/asyncchannel.h        |   2 +
 executablecode/src_MBED/debug.cpp             |  22 ++---
 executablecode/src_MBED/defs.h                |   6 +-
 executablecode/src_MBED/message.cpp           |   1 +
 executablecode/src_MBED/myerrors.cpp          |   6 +-
 executablecode/src_MBED/mytimelib.cpp         |  10 +--
 executablecode/src_MBED/random.cpp            |   2 +-
 executablecode/src_MBED/request.cpp           |   1 +
 executablecode/src_MBED/request.h             |   3 +-
 executablecode/src_MBED/request_manager.cpp   |  10 +--
 executablecode/src_MBED/syncchannel.cpp       |   5 +-
 executablecode/src_MBED/tracemanager.cpp      |  78 ++++++++++--------
 modeling/.DS_Store                            | Bin 12292 -> 12292 bytes
 modeling/BlinkingLed.ttool/.DS_Store          | Bin 8196 -> 8196 bytes
 .../AVATAR_executablecode/.DS_Store           | Bin 12292 -> 12292 bytes
 19 files changed, 82 insertions(+), 67 deletions(-)
 create mode 100644 executablecode/src_MBED/.DS_Store

diff --git a/.DS_Store b/.DS_Store
index 49142a76da8924b6b8bbe7843a801b753aa9ad34..21f1bb784384dcc9f8e3bbeff9ac65ae73f2905d 100644
GIT binary patch
delta 998
zcmeIvPe_wt90%~<cm45w>lr=mAFr>IM(^ANJ#3k#OKC#5&;p^E>(6D&nQzKwE-WM)
z#-fYRpC>v6Mp4nFwApb+MHjQe+95kcM3)FUdI_qht%HXsy7%0E-|z3ae15s%-0*b4
zrUYAp^`3^{R`Jv}QnB8uM|MR#`2l0nBIcbz8MtM@^Uc0vmV8DVShsS&U3iT)8!P>>
zv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#LpYre-
z{rG8uX;^}wDG9bFN%W6yro~Qq)S>@_l`H2|&Ykx!SnJ5%)L7ypt?9N5cWz#O(Uh6x
z)a|m<Yt|APa`{)v9(f$cfQhDPjPiJ|EQo^`8$N#Y6$r98gkj*~$H~QlAP#1n67JM#
z%uQiH5^kx)T*5q;!)X^hvYDrTuQi#oBboCv@|t`gUs%Ee<QGz4rpq!teibbUVFSV}
z$1T{3?bv~x*oXZr#X~rZV=Tp!IEB-=h)cN4^1O{6mgikOz;l*qFSR*k^xb%$88zK7
Iy9Y9U1Mc<lTL1t6

diff --git a/executablecode/src_MBED/.DS_Store b/executablecode/src_MBED/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6
GIT binary patch
literal 6148
zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3
zem<@ulZcFPQ@L2!n>{z**<q8>++&mCkOWA81W14cNZ<zv;LbK1Poaz?KmsK2CSc!(
z0ynLxE!0092;Krf2c+FF_Fe*7ECH>lEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ
zLs35+`xjp>T0<F0fCPF1$Cyrb|F7^5{eNG?83~ZUUlGt@xh*qZDeu<Z%US-OSsOPv
j)R!Z4KLME7ReXlK;d!wEw5GODWMKRea10D2@KpjYNUI8I

literal 0
HcmV?d00001

diff --git a/executablecode/src_MBED/asyncchannel.cpp b/executablecode/src_MBED/asyncchannel.cpp
index 40c52ac0f1..cf02f9d230 100644
--- a/executablecode/src_MBED/asyncchannel.cpp
+++ b/executablecode/src_MBED/asyncchannel.cpp
@@ -1,7 +1,8 @@
 #include "message.h"
 #include "asyncchannel.h"
 #include "myerrors.h"
-#include "mbed.h"
+#include <mbed.h>
+
 
 asyncchannel *getNewAsyncchannel(char *outname, char *inname, int isBlocking, int maxNbOfMessages) {
   asyncchannel * asyncch = (asyncchannel *)(malloc(sizeof(struct asyncchannel)));
diff --git a/executablecode/src_MBED/asyncchannel.h b/executablecode/src_MBED/asyncchannel.h
index 8f812359db..0de5484f17 100644
--- a/executablecode/src_MBED/asyncchannel.h
+++ b/executablecode/src_MBED/asyncchannel.h
@@ -7,6 +7,8 @@ struct asyncchannel;
 #include "request.h"
 
 
+
+
 struct asyncchannel {
   char *outname;
   char *inname;
diff --git a/executablecode/src_MBED/debug.cpp b/executablecode/src_MBED/debug.cpp
index b52637800c..98d62d71c1 100644
--- a/executablecode/src_MBED/debug.cpp
+++ b/executablecode/src_MBED/debug.cpp
@@ -1,10 +1,10 @@
 //#include <stdlib.h>
 //#include <stdio.h>
 #include <time.h>
-#include <mbed.h>
+
 #define DEBUG_ON 1
 #define DEBUG_OFF 2
-Serial pc(USBTX,USBRX);
+//Serial pc(USBTX,USBRX);
 
 #include <mbed.h>
 #include "debug.h"
@@ -13,12 +13,12 @@ int _debug = DEBUG_OFF;
 
 void activeDebug() {
 	_debug = DEBUG_ON;
-  pc.printf("Modo debug activado");
+  printf("Modo debug activado");
 }
 
 void unactiveDebug() {
 	_debug = DEBUG_OFF;
-  pc.printf("Modo debug desactivado");
+  printf("Modo debug desactivado");
 }
 
 void debugThreeInts(char *msg, int value1, int value2, int value3) {
@@ -27,7 +27,7 @@ void debugThreeInts(char *msg, int value1, int value2, int value3) {
   }
   
   if (msg != NULL) {
-    pc.printf("DT> %s: %d, %d, %d\n", msg, value1, value2, value3);
+    printf("DT> %s: %d, %d, %d\n", msg, value1, value2, value3);
   }
 }
 
@@ -37,7 +37,7 @@ void debugTwoInts(char *msg, int value1, int value2) {
   }
   
   if (msg != NULL) {
-    pc.printf("DT> %s: %d, %d\n", msg, value1, value2);
+    printf("DT> %s: %d, %d\n", msg, value1, value2);
   }
 }
 
@@ -47,7 +47,7 @@ void debugInt(char *msg, int value) {
   }
   
   if (msg != NULL) {
-    pc.printf("DT> %s: %d\n", msg, value);
+    printf("DT> %s: %d\n", msg, value);
   }
 }
 
@@ -57,7 +57,7 @@ void debugLong(char *msg, long value) {
   }
   
   if (msg != NULL) {
-    pc.printf("DT> %s: %ld\n", msg, value);
+    printf("DT> %s: %ld\n", msg, value);
   }
 }
 
@@ -67,7 +67,7 @@ void debugMsg(char *msg) {
   }
 
   if (msg != NULL) {
-    pc.printf("DT> %s\n", msg);
+    printf("DT> %s\n", msg);
   }
 }
 
@@ -77,7 +77,7 @@ void debug2Msg(char *name, char *msg) {
   }
 
   if ((name != NULL) && (msg != NULL)) {
-    pc.printf("DT - %s -> %s\n", name, msg);
+    printf("DT - %s -> %s\n", name, msg);
   }
 }
 
@@ -85,5 +85,5 @@ void debugTime(char *msg, struct timespec *ts) {
   if (_debug == DEBUG_OFF) {
     return;
   }
-  pc.printf("DT> (-------t------->) %s sec=%ld nsec=%ld\n", msg, ts->tv_sec, ts->tv_nsec);
+  printf("DT> (-------t------->) %s sec=%ld nsec=%ld\n", msg, ts->tv_sec, ts->tv_nsec);
 }
diff --git a/executablecode/src_MBED/defs.h b/executablecode/src_MBED/defs.h
index 3b997bfdf8..a8d6a631b7 100644
--- a/executablecode/src_MBED/defs.h
+++ b/executablecode/src_MBED/defs.h
@@ -1,9 +1,9 @@
 #ifndef DEFS_H
 #define DEFS_H
 
-#define bool int
-#define true 1
-#define false 0
+//#define bool int
+//#define true 1
+//#define false 0
 
 
 #endif
diff --git a/executablecode/src_MBED/message.cpp b/executablecode/src_MBED/message.cpp
index bfb14536b7..86d1ebf3c9 100644
--- a/executablecode/src_MBED/message.cpp
+++ b/executablecode/src_MBED/message.cpp
@@ -8,6 +8,7 @@
 
 #include <Mutex.h>
 #include <mbed.h>
+#include <Thread.h>
 
 long __id_message = 0;
 rtos::Mutex __message_mutex;
diff --git a/executablecode/src_MBED/myerrors.cpp b/executablecode/src_MBED/myerrors.cpp
index c3ac566a12..2a73c4b8e2 100644
--- a/executablecode/src_MBED/myerrors.cpp
+++ b/executablecode/src_MBED/myerrors.cpp
@@ -3,12 +3,12 @@
 
 #include "myerrors.h"
 #include <mbed.h>
-Serial pc(USBTX,USBRX);
+//Serial pc(USBTX,USBRX);
 
 
 void criticalErrorInt(char *msg, int value) {
   if (msg != NULL) {
-    pc.printf("\nCritical error: %s, %d\n", msg, value);
+    printf("\nCritical error: %s, %d\n", msg, value);
   }
 
   exit(-1);
@@ -17,7 +17,7 @@ void criticalErrorInt(char *msg, int value) {
 
 void criticalError(char *msg) {
   if (msg != NULL) {
-    pc.printf("\nCritical error: %s\n", msg);
+    printf("\nCritical error: %s\n", msg);
   }
 
   exit(-1);
diff --git a/executablecode/src_MBED/mytimelib.cpp b/executablecode/src_MBED/mytimelib.cpp
index f24986a16c..89c7f175da 100644
--- a/executablecode/src_MBED/mytimelib.cpp
+++ b/executablecode/src_MBED/mytimelib.cpp
@@ -1,4 +1,4 @@
-//#include<time.h>
+#include <time.h>
 
 #include "mytimelib.h"
 #include "random.h"
@@ -103,7 +103,7 @@ void delayToTimeSpec(struct timespec *ts, long delay) {
 
 void waitFor(long minDelay, long maxDelay) {
   struct timespec tssrc;
-  struct timespec tsret;
+  //struct timespec tsret;
   int delay;
 
 
@@ -118,11 +118,7 @@ void waitFor(long minDelay, long maxDelay) {
   delayToTimeSpec(&tssrc, delay);
 
   debugLong("............. waiting For", delay);
-  if(tssrc.tv_nsec > tsret.tv_nsec){
-    wait_us(tsret.tv_nsec/1000);
-  }else{
-    wait_us(tssrc.tv_nsec/1000);
-  }
+  wait_us(delay);
   debugLong("............. waiting Done for: ", delay);
 }
 
diff --git a/executablecode/src_MBED/random.cpp b/executablecode/src_MBED/random.cpp
index 4a5df9dd59..0022ae2f13 100644
--- a/executablecode/src_MBED/random.cpp
+++ b/executablecode/src_MBED/random.cpp
@@ -1,7 +1,7 @@
 
 //#include <stdlib.h>
 //#include <unistd.h>
-//#include <time.h>
+#include <time.h>
 //#include <limits.h>
 
 #include "random.h"
diff --git a/executablecode/src_MBED/request.cpp b/executablecode/src_MBED/request.cpp
index 86e78bb382..3d7d900bdb 100644
--- a/executablecode/src_MBED/request.cpp
+++ b/executablecode/src_MBED/request.cpp
@@ -4,6 +4,7 @@
 
 #include <mbed.h>
 #include <Mutex.h>
+#include <Thread.h>
 
 #include "request.h"
 #include "mytimelib.h"
diff --git a/executablecode/src_MBED/request.h b/executablecode/src_MBED/request.h
index 3d0172fcde..416e392aaf 100644
--- a/executablecode/src_MBED/request.h
+++ b/executablecode/src_MBED/request.h
@@ -12,6 +12,7 @@ struct request;
 #include "asyncchannel.h"
 #include "message.h"
 
+
 #define SEND_SYNC_REQUEST 0
 #define RECEIVE_SYNC_REQUEST 2
 #define SEND_ASYNC_REQUEST 4
@@ -87,7 +88,7 @@ void copyParameters(request *src, request *dst);
 setOfRequests *newListOfRequests(size_t *wakeupCondition, rtos::Mutex *mutex);
 void addRequestToList(setOfRequests *list, request* req);
 void clearListOfRequests(setOfRequests *list);
-void fillListOfRequests(setOfRequests *list, char *name, rtos::Thread* thread, size_t *wakeupCondition, rtos::Mutex *mutex);
+void fillListOfRequests(setOfRequests *list, char *name, rtos::Thread* thread, size_t wakeupCondition, rtos::Mutex *mutex);
 
 void removeAllPendingRequestsFromPendingLists(request *req, int apartThisOne);
 request *hasIdenticalRequestInListOfSelectedRequests(request *req, request *list);
diff --git a/executablecode/src_MBED/request_manager.cpp b/executablecode/src_MBED/request_manager.cpp
index 76b27cf68d..4f0bec57ff 100644
--- a/executablecode/src_MBED/request_manager.cpp
+++ b/executablecode/src_MBED/request_manager.cpp
@@ -31,7 +31,7 @@ void executeSendSyncTransaction(request *req) {
 	currentReq = currentReq->next;
 	}
 
-	cpt = random() % cpt;
+	cpt = rand() % cpt;
 
 	// Head of the list?
 	selectedReq = req->syncChannel->inWaitQueue;
@@ -77,7 +77,7 @@ void executeReceiveSyncTransaction(request *req) {
     //debugInt("cpt", cpt);
     currentReq = currentReq->next;
   }
-  cpt = random() % cpt;
+  cpt = rand() % cpt;
   selectedReq = req->syncChannel->outWaitQueue;
   while (cpt > 0) {
     selectedReq = selectedReq->next;
@@ -171,7 +171,7 @@ void executeSendBroadcastTransaction(request *req) {
     if (tmpreq != NULL) {
       // Must select one of the two
       // If =1, replace, otherwise, just do nothing
-      cpt = random() % 2;
+      cpt = rand() % 2;
       if (cpt == 1) {
 	debugMsg("Replacing broadcast request");
 	req->relatedRequest = replaceInListOfSelectedRequests(tmpreq, currentReq, req->relatedRequest);
@@ -557,11 +557,11 @@ request *executeListOfRequests(setOfRequests *list) {
       debug2Msg(list->ownerName, "Waiting for a request and at most for a given time");
       debugTime("Min time to wait=", &(list->minTimeToWait));
       //pthread_cond_timedwait(list->wakeupCondition, list->mutex, &(list->minTimeToWait));
-	  osEvent event = rtos::Thread::signal_wait(list->wakeupCondition, list->minTimeToWait.tv_sec*1000);
+	    osEvent event = rtos::Thread::signal_wait(list->wakeupCondition, list->minTimeToWait.tv_sec);
     } else {
       debug2Msg(list->ownerName, "Releasing mutex");
       //pthread_cond_wait(list->wakeupCondition, list->mutex);
-	  osEvent event = rtos::Thread::signal_wait(list->wakeupCondition);
+	    osEvent event = rtos::Thread::signal_wait(list->wakeupCondition);
     }
     debug2Msg(list->ownerName, "Waking up for requests! -> getting mutex");
   }
diff --git a/executablecode/src_MBED/syncchannel.cpp b/executablecode/src_MBED/syncchannel.cpp
index 7b81f8a91f..9e52a0f36b 100644
--- a/executablecode/src_MBED/syncchannel.cpp
+++ b/executablecode/src_MBED/syncchannel.cpp
@@ -10,14 +10,15 @@
 
 syncchannel *getNewSyncchannel(char *outname, char *inname) {
   syncchannel * syncch = (syncchannel *)(malloc(sizeof(struct syncchannel)));
+  //syncchannel * syncch = NULL;
   if (syncch == NULL) {
     criticalError("Allocation of request failed");
   }
   
   syncch->inname = inname;
   syncch->outname = outname;
-  syncch->inWaitQueue = (request*)NULL;
-  syncch->outWaitQueue = (request*)NULL;
+  //syncch->inWaitQueue = (request*)NULL;
+  //syncch->outWaitQueue = (request*)NULL;
   syncch->isBroadcast = false;
   return syncch;
 }
diff --git a/executablecode/src_MBED/tracemanager.cpp b/executablecode/src_MBED/tracemanager.cpp
index acaf473b95..ffd40967f6 100644
--- a/executablecode/src_MBED/tracemanager.cpp
+++ b/executablecode/src_MBED/tracemanager.cpp
@@ -2,10 +2,15 @@
 //#include <stdio.h>
 //#include <time.h>
 
+#include <mbed.h>
+#include <Thread.h>
+#include <Mutex.h>
+#include <time.h>
+
 #include "tracemanager.h"
 #include "debug.h"
 #include "mytimelib.h"
-#include <Mutex.h>
+
 
 
 #define TRACE_OFF 0
@@ -248,6 +253,7 @@ void traceAsynchronousReceiveRequest(request *req) {
 void traceRequest(char *myname, request *req) {
   char s[1024];
   int i;
+  //printf("Calling tracerequest of type %s\n", req->type);
  
 
   debugMsg("Trace request");
@@ -261,40 +267,46 @@ void traceRequest(char *myname, request *req) {
 
   switch(req->type) {
     case SEND_SYNC_REQUEST:
-    debug2Msg("Sync channel", req->syncChannel->outname);
-    sprintf(s, "block=%s type=send_synchro channel=%s params=", myname, req->syncChannel->outname);
-    for(i=0; i<req->nbOfParams; i++) {
-      if (i>0) {
-	sprintf(s, "%s,", s);
+      debug2Msg("Sync channel", req->syncChannel->outname);
+      sprintf(s, "block=%s type=send_synchro channel=%s params=", myname, req->syncChannel->outname);
+      for(i=0; i<req->nbOfParams; i++) {
+        if (i>0) {
+          sprintf(s, "%s,", s);
+        }
+        sprintf(s, "%s%d", s, *(req->params[i]));
       }
-      sprintf(s, "%s%d", s, *(req->params[i]));
-    }
-    sprintf(s, "%s\n", s);
- 
-    break;
-  case RECEIVE_SYNC_REQUEST:
-    sprintf(s, "block=%s type=receive_synchro channel=%s\n", myname, req->syncChannel->inname);
-    break;
+      sprintf(s, "%s\n", s);
+  
+      break;
+    case RECEIVE_SYNC_REQUEST:
+      
+      sprintf(s, "block=%s type=receive_synchro channel=%s\n", myname, req->syncChannel->inname);
+      break;
     case SEND_ASYNC_REQUEST:
-    debug2Msg("Async channel", req->asyncChannel->outname);
-    sprintf(s, "block=%s type=send_async_2 channel=%s\n", myname, req->asyncChannel->outname);
-    break;
-  case RECEIVE_ASYNC_REQUEST:
-    sprintf(s, "block=%s type=receive_async_2 channel=%s\n", myname, req->asyncChannel->inname);
-    break;
-   case SEND_BROADCAST_REQUEST:
-    debug2Msg("Sync channel", req->syncChannel->outname);
-    sprintf(s, "block=%s type=send_broadcast channel=%s\n", myname, req->syncChannel->outname);
-    break; 
-   case RECEIVE_BROADCAST_REQUEST:
-    debug2Msg("Sync channel", req->syncChannel->outname);
-    sprintf(s, "block=%s type=receive_broadcast channel=%s\n", myname, req->syncChannel->outname);
-    break; 
-   case IMMEDIATE:
-     sprintf(s, "block=%s type=action\n", myname);
-    break;
-  default:
-    sprintf(s, "block=%s type=unknown\n", myname);
+      debug2Msg("Async channel", req->asyncChannel->outname);
+      sprintf(s, "block=%s type=send_async_2 channel=%s\n", myname, req->asyncChannel->outname);
+      break;
+    case RECEIVE_ASYNC_REQUEST:
+      
+      sprintf(s, "block=%s type=receive_async_2 channel=%s\n", myname, req->asyncChannel->inname);
+      break;
+    case SEND_BROADCAST_REQUEST:
+      
+      debug2Msg("Sync channel", req->syncChannel->outname);
+      sprintf(s, "block=%s type=send_broadcast channel=%s\n", myname, req->syncChannel->outname);
+      break; 
+    case RECEIVE_BROADCAST_REQUEST:
+      
+      debug2Msg("Sync channel", req->syncChannel->outname);
+      sprintf(s, "block=%s type=receive_broadcast channel=%s\n", myname, req->syncChannel->outname);
+      break; 
+    case IMMEDIATE:
+      
+      sprintf(s, "block=%s type=action\n", myname);
+      break;
+    default:
+      
+      sprintf(s, "block=%s type=unknown\n", myname);
   }
 
   debugMsg("Trace request 2");
diff --git a/modeling/.DS_Store b/modeling/.DS_Store
index 241074f8b7bbebdcc36c6248bc38e899647a2aad..9c9a6e7f9a09faa86de2165583dfa1453974e00a 100644
GIT binary patch
delta 668
zcmbV|OH5Ni7=`CxDRU?3W$;qk4zGrKL-A3#ZA}n^R2x@5VoXsmngY`3rKPAXJ}}q~
z5hX5+6D4Yli9r{xFhm#V+Q7z*L|JJxx?$nU#I4g_7cPynnf&LQ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w1
zX&l5M9LEICU=mY!5k1Ue4qw2R@MU}zui%?_1K-8>@O}IMKgG|)jTIGS`lPrnwD>vo
zHu0vCOoKPIX!u?-ts|K>ZK+IuEaTd&tlCvwQ{UJUjdga%SD);<hq*><cPh*ml~9eZ
zrh;08ib=tH_wASK#z<$z{CedV-Uwwo*F9U|-VKquI)$rATsAe=$qJI%CEt3mnXE;D
z?a*Pe6_c=qt*u?IQ?`+YMP%1wvaFPl$c6Q24_Qk|&cfQepR6EBcj$3LHNFEM!WX2(
zpWtWsl~ni_+(y7sEW_Pcj}dIdCTzyT*otk~jvb`GW7vy*z6PK6H8_RScn;5#5@+#Q
zv@ne}=5YZR@iH#qi=@X_d_7*p*YOR!hS%}!by_@8P@zD)u{kZ~Ml!bL*cT|OpzgI3
zhF4p`K(Sa<<@x{djeq~&idzfU3>gR+xK9jV$-u}!A1$`g$C>Ba5vns(dEtJ`0{swb
s{B)eqPsa&Y|6xe|2)Xi@c!0|SX@tss{~=)YFW>O|56^#Jf)8Z#A0zPWZvX%Q

diff --git a/modeling/BlinkingLed.ttool/AVATAR_executablecode/.DS_Store b/modeling/BlinkingLed.ttool/AVATAR_executablecode/.DS_Store
index e822ab9a1ee9a6b5f6026f365d62f62222f636d2..e07abf6bee883ef2e77ca2c673adee53105d99cd 100644
GIT binary patch
delta 25
gcmZokXi3;$BFtfEX{e)MY-lq1pn~J(TH$sX0B1l4;s5{u

delta 16
XcmZokXi3;$B0PDgg6HO1;dU7SIiUty

-- 
GitLab