Implemented time counter in simulat0r

This commit is contained in:
bernd 2011-07-25 08:50:33 +02:00
parent 242bb480a0
commit ea8754c1dd
4 changed files with 18 additions and 2 deletions

View File

@ -4,7 +4,12 @@
#include "lcd/print.h" #include "lcd/print.h"
QUEUE the_queue; QUEUE the_queue;
#ifdef ARM
volatile uint32_t _timectr=0; volatile uint32_t _timectr=0;
#else
extern uint32_t simTimeCounter();
#define _timectr (simTimeCounter())
#endif
/**************************************************************************/ /**************************************************************************/

View File

@ -5,7 +5,7 @@ CFLAGS += -I../firmware
CFLAGS += -I../firmware/core # for gpio.h including projectconfig.h without path CFLAGS += -I../firmware/core # for gpio.h including projectconfig.h without path
CFLAGS += -I../simcore CFLAGS += -I../simcore
OBJS = simcore.o misc.o OBJS = simcore.o misc.o timecounter.o
.PHONY : all clean .PHONY : all clean
all : $(OBJS) all : $(OBJS)

View File

@ -0,0 +1,11 @@
#include <sys/time.h>
#include <stdint.h>
#include <stdlib.h>
volatile uint32_t _timectr; // to satisfy linker
volatile uint32_t simTimeCounter() {
struct timeval tv;
gettimeofday(&tv,NULL);
return (tv.tv_sec*1000000+tv.tv_usec)/100;
}

View File

@ -25,7 +25,7 @@ LIBS += ../firmware/basic/libbasic.a
OBJS+=../simcore/simcore.o ../simcore/misc.o OBJS+=../simcore/simcore.o ../simcore/misc.o ../simcore/timecounter.o
.PHONY : all .PHONY : all
all : simulat0r all : simulat0r