Commit 357c2282 authored by Javier.Errea-Moreno's avatar Javier.Errea-Moreno

Javier mbed changes

parent 5cb11bed

Too many changes to show.

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

File added
......@@ -38,7 +38,7 @@
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/MPSoC/mutekh" vcs="hg4idea" />
<mapping directory="$PROJECT_DIR$/modeling/theseletitia" vcs="Git" />
</component>
......
//#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));
}