Commit b4f5256e authored by Javier.Errea-Moreno's avatar Javier.Errea-Moreno Committed by Jakob.Fittler

Javier mbed changes

parent b758f07a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File added
//#include <stdlib.h>
#include "message.h"
#include "asyncchannel.h"
#include "myerrors.h"
......
//#include <stdlib.h>
//#include <stdio.h>
//#include <time.h>
#include <time.h>
#include <mbed.h>
#define DEBUG_ON 1
#define DEBUG_OFF 2
Serial pc(USBTX,USBRX);
#include <mbed.h>
#include "debug.h"
......@@ -12,10 +13,12 @@ int _debug = DEBUG_OFF;
void activeDebug() {
_debug = DEBUG_ON;
pc.printf("Modo debug activado");
}
void unactiveDebug() {
_debug = DEBUG_OFF;
pc.printf("Modo debug desactivado");
}
void debugThreeInts(char *msg, int value1, int value2, int value3) {
......@@ -24,7 +27,7 @@ void debugThreeInts(char *msg, int value1, int value2, int value3) {
}
if (msg != NULL) {
printf("DT> %s: %d, %d, %d\n", msg, value1, value2, value3);
pc.printf("DT> %s: %d, %d, %d\n", msg, value1, value2, value3);
}
}
......@@ -34,7 +37,7 @@ void debugTwoInts(char *msg, int value1, int value2) {
}
if (msg != NULL) {
printf("DT> %s: %d, %d\n", msg, value1, value2);
pc.printf("DT> %s: %d, %d\n", msg, value1, value2);
}
}
......@@ -44,7 +47,7 @@ void debugInt(char *msg, int value) {
}
if (msg != NULL) {
printf("DT> %s: %d\n", msg, value);
pc.printf("DT> %s: %d\n", msg, value);
}
}
......@@ -54,7 +57,7 @@ void debugLong(char *msg, long value) {
}
if (msg != NULL) {
printf("DT> %s: %ld\n", msg, value);
pc.printf("DT> %s: %ld\n", msg, value);
}
}
......@@ -64,7 +67,7 @@ void debugMsg(char *msg) {
}
if (msg != NULL) {
printf("DT> %s\n", msg);
pc.printf("DT> %s\n", msg);
}
}
......@@ -74,7 +77,7 @@ void debug2Msg(char *name, char *msg) {
}
if ((name != NULL) && (msg != NULL)) {
printf("DT - %s -> %s\n", name, msg);
pc.printf("DT - %s -> %s\n", name, msg);
}
}
......@@ -82,5 +85,5 @@ void debugTime(char *msg, struct timespec *ts) {
if (_debug == DEBUG_OFF) {
return;
}
printf("DT> (-------t------->) %s sec=%ld nsec=%ld\n", msg, ts->tv_sec, ts->tv_nsec);
pc.printf("DT> (-------t------->) %s sec=%ld nsec=%ld\n", msg, ts->tv_sec, ts->tv_nsec);
}
......@@ -13,7 +13,7 @@ long __id_message = 0;
rtos::Mutex __message_mutex;
//pthread_mutex_t __message_mutex;
//No need to initialize mutex in mbed.
void initMessages() {
//if (pthread_mutex_init(&__message_mutex, NULL) < 0) { exit(-1);}
}
......@@ -53,13 +53,10 @@ message *getNewMessage(int nbOfParams, int *params) {
return msg;
}
void destroyMessageWithParams(message *msg) {
free(msg->params);
free(msg);
}
void destroyMessage(message *msg) {
free(msg);
}
......@@ -16,7 +16,4 @@ message *getNewMessageWithParams(int nbOfParams);
message *getNewMessage(int nbOfParams, int *params);
void destroyMessageWithParams(message *msg);
void destroyMessage(message *msg);
#endif
#endif
\ No newline at end of file
......@@ -3,12 +3,12 @@
#include "myerrors.h"
#include <mbed.h>
Serial pc(USBTX,USBRX);
void criticalErrorInt(char *msg, int value) {
if (msg != NULL) {
printf("\nCritical error: %s, %d\n", msg, value);
pc.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) {
printf("\nCritical error: %s\n", msg);
pc.printf("\nCritical error: %s\n", msg);
}
exit(-1);
......
......@@ -5,8 +5,9 @@
//#include <limits.h>
#include "random.h"
#include <mbed.h>
#include "debug.h"
//#include <math.h>
#include <math.h>
#include "mytimelib.h"
......@@ -35,9 +36,6 @@ long computeLongRandom(long min, long max) {
}
void initRandom() {
struct timespec ts;
my_clock_gettime(&ts);
srand((int)(ts.tv_nsec));
srand(time(NULL));
}
/**Copyright or (C) or Copr. Intitut Telecom, Telecom ParisTech,
Ludovic Apvrille, Renaud Pacalet
*
* ludovic.apvrille AT telecom-paristech.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
* /**