--- /dev/null
+#ifndef __TIME_H
+#define __TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void time_init(void);
+int elapsed(int *last_event, int period);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIME_H */
M2DIR=../..
include $(M2DIR)/software/common.mak
-OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o qsort.o strtod.o
+OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o
all: crt0.o libbase.a libbase-nofloat.a
--- /dev/null
+#include <hw/csr.h>
+#include <time.h>
+
+void time_init(void)
+{
+ int t;
+
+ timer0_en_write(0);
+ t = 2*identifier_frequency_read();
+ timer0_reload_write(t);
+ timer0_load_write(t);
+ timer0_en_write(1);
+}
+
+int elapsed(int *last_event, int period)
+{
+ int t, dt;
+
+ timer0_update_value_write(1);
+ t = timer0_reload_read() - timer0_value_read();
+ dt = t - *last_event;
+ if(dt < 0)
+ dt += timer0_reload_read();
+ if((dt > period) || (dt < 0)) {
+ *last_event = t;
+ return 1;
+ } else
+ return 0;
+}
M2DIR=../..
include $(M2DIR)/software/common.mak
-OBJECTS=isr.o time.o fb.o dvisampler0.o dvisampler1.o main.o
+OBJECTS=isr.o fb.o dvisampler0.o dvisampler1.o main.o
all: videomixer.bin videomixer.fbi
#include <irq.h>
#include <uart.h>
+#include <time.h>
#include <hw/csr.h>
#include <hw/flags.h>
-#include "time.h"
#include "fb.h"
#include "dvisamplerX.h"
#include <irq.h>
#include <uart.h>
+#include <time.h>
#include <hw/csr.h>
#include <hw/flags.h>
#include <console.h>
-#include "time.h"
#include "fb.h"
#include "dvisampler0.h"
#include "dvisampler1.h"
+++ /dev/null
-#include <hw/csr.h>
-
-#include "time.h"
-
-void time_init(void)
-{
- int t;
-
- timer0_en_write(0);
- t = 2*identifier_frequency_read();
- timer0_reload_write(t);
- timer0_load_write(t);
- timer0_en_write(1);
-}
-
-int elapsed(int *last_event, int period)
-{
- int t, dt;
-
- timer0_update_value_write(1);
- t = timer0_reload_read() - timer0_value_read();
- dt = t - *last_event;
- if(dt < 0)
- dt += timer0_reload_read();
- if((dt > period) || (dt < 0)) {
- *last_event = t;
- return 1;
- } else
- return 0;
-}
+++ /dev/null
-#ifndef __TIME_H
-#define __TIME_H
-
-void time_init(void);
-int elapsed(int *last_event, int period);
-
-#endif /* __TIME_H */