Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 10 files changed
  • 0 comments
  • 1 contributor
8  software/videomixer/time.h → software/include/base/time.h
... ...
@@ -1,7 +1,15 @@
1 1
 #ifndef __TIME_H
2 2
 #define __TIME_H
3 3
 
  4
+#ifdef __cplusplus
  5
+extern "C" {
  6
+#endif
  7
+
4 8
 void time_init(void);
5 9
 int elapsed(int *last_event, int period);
6 10
 
  11
+#ifdef __cplusplus
  12
+}
  13
+#endif
  14
+
7 15
 #endif /* __TIME_H */
2  software/libbase/Makefile
... ...
@@ -1,7 +1,7 @@
1 1
 M2DIR=../..
2 2
 include $(M2DIR)/software/common.mak
3 3
 
4  
-OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o qsort.o strtod.o
  4
+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
5 5
 
6 6
 all: crt0.o libbase.a libbase-nofloat.a
7 7
 
0  software/videomixer/linker.ld → software/libbase/linker-sdram.ld
File renamed without changes
3  software/videomixer/time.c → software/libbase/time.c
... ...
@@ -1,6 +1,5 @@
1 1
 #include <hw/csr.h>
2  
-
3  
-#include "time.h"
  2
+#include <time.h>
4 3
 
5 4
 void time_init(void)
6 5
 {
50  software/memtest/Makefile
... ...
@@ -0,0 +1,50 @@
  1
+M2DIR=../..
  2
+include $(M2DIR)/software/common.mak
  3
+
  4
+OBJECTS=isr.o main.o
  5
+
  6
+all: memtest.bin
  7
+
  8
+# pull in dependency info for *existing* .o files
  9
+-include $(OBJECTS:.o=.d)
  10
+
  11
+%.bin: %.elf
  12
+	$(OBJCOPY) -O binary $< $@
  13
+	chmod -x $@
  14
+
  15
+memtest.elf: $(OBJECTS) libs
  16
+
  17
+%.elf:
  18
+	$(LD) $(LDFLAGS) \
  19
+		-T $(M2DIR)/software/libbase/linker-sdram.ld \
  20
+		-N -o $@ \
  21
+		$(M2DIR)/software/libbase/crt0.o \
  22
+		$(OBJECTS) \
  23
+		-L$(M2DIR)/software/libbase \
  24
+		-L$(M2DIR)/software/libcompiler-rt \
  25
+		-lbase -lcompiler-rt
  26
+	chmod -x $@
  27
+
  28
+main.o: main.c
  29
+	$(compile-dep)
  30
+
  31
+%.o: %.c
  32
+	$(compile-dep)
  33
+
  34
+%.o: %.S
  35
+	$(assemble)
  36
+
  37
+libs:
  38
+	$(MAKE) -C $(M2DIR)/software/libcompiler-rt
  39
+	$(MAKE) -C $(M2DIR)/software/libbase
  40
+
  41
+load: memtest.bin
  42
+	$(MAKE) -C $(M2DIR)/tools
  43
+	$(M2DIR)/tools/flterm --port /dev/ttyUSB0 --kernel memtest.bin
  44
+
  45
+
  46
+clean:
  47
+	$(RM) $(OBJECTS) $(OBJECTS:.o=.d) memtest.elf memtest.bin
  48
+	$(RM) .*~ *~
  49
+
  50
+.PHONY: all main.o clean libs load
14  software/memtest/isr.c
... ...
@@ -0,0 +1,14 @@
  1
+#include <hw/csr.h>
  2
+#include <irq.h>
  3
+#include <uart.h>
  4
+
  5
+void isr(void);
  6
+void isr(void)
  7
+{
  8
+	unsigned int irqs;
  9
+	
  10
+	irqs = irq_pending() & irq_getmask();
  11
+	
  12
+	if(irqs & (1 << UART_INTERRUPT))
  13
+		uart_isr();
  14
+}
44  software/memtest/main.c
... ...
@@ -0,0 +1,44 @@
  1
+#include <stdio.h>
  2
+#include <stdlib.h>
  3
+
  4
+#include <irq.h>
  5
+#include <uart.h>
  6
+#include <time.h>
  7
+#include <hw/csr.h>
  8
+#include <hw/flags.h>
  9
+#include <console.h>
  10
+
  11
+static void membw_service(void)
  12
+{
  13
+	static int last_event;
  14
+	unsigned long long int nr, nw;
  15
+	unsigned long long int f;
  16
+	unsigned int rdb, wrb;
  17
+
  18
+	if(elapsed(&last_event, identifier_frequency_read())) {
  19
+		lasmicon_bandwidth_update_write(1);
  20
+		nr = lasmicon_bandwidth_nreads_read();
  21
+		nw = lasmicon_bandwidth_nwrites_read();
  22
+		f = identifier_frequency_read();
  23
+		rdb = nr*f >> (24 - 7);
  24
+		wrb = nw*f >> (24 - 7);
  25
+		printf("read:%4dMbps  write:%4dMbps  all:%4dMbps\n", rdb/1000000, wrb/1000000, (rdb + wrb)/1000000);
  26
+	}
  27
+}
  28
+
  29
+int main(void)
  30
+{
  31
+	irq_setmask(0);
  32
+	irq_setie(1);
  33
+	uart_init();
  34
+	
  35
+	puts("Memory testing software built "__DATE__" "__TIME__"\n");
  36
+	
  37
+	time_init();
  38
+
  39
+	while(1) {
  40
+		membw_service();
  41
+	}
  42
+	
  43
+	return 0;
  44
+}
8  software/videomixer/Makefile
... ...
@@ -1,7 +1,7 @@
1 1
 M2DIR=../..
2 2
 include $(M2DIR)/software/common.mak
3 3
 
4  
-OBJECTS=isr.o time.o fb.o dvisampler0.o dvisampler1.o main.o
  4
+OBJECTS=isr.o fb.o dvisampler0.o dvisampler1.o main.o
5 5
 
6 6
 all: videomixer.bin videomixer.fbi
7 7
 
@@ -15,10 +15,12 @@ all: videomixer.bin videomixer.fbi
15 15
 %.fbi: %.bin
16 16
 	$(M2DIR)/tools/mkmmimg $< write $@
17 17
 
18  
-videomixer.elf: linker.ld $(OBJECTS) libs
  18
+videomixer.elf: $(OBJECTS) libs
19 19
 
20 20
 %.elf:
21  
-	$(LD) $(LDFLAGS) -T $< -N -o $@ \
  21
+	$(LD) $(LDFLAGS) \
  22
+		-T $(M2DIR)/software/libbase/linker-sdram.ld \
  23
+		-N -o $@ \
22 24
 		$(M2DIR)/software/libbase/crt0.o \
23 25
 		$(OBJECTS) \
24 26
 		-L$(M2DIR)/software/libbase \
2  software/videomixer/dvisamplerX.c
@@ -3,10 +3,10 @@
3 3
 
4 4
 #include <irq.h>
5 5
 #include <uart.h>
  6
+#include <time.h>
6 7
 #include <hw/csr.h>
7 8
 #include <hw/flags.h>
8 9
 
9  
-#include "time.h"
10 10
 #include "fb.h"
11 11
 #include "dvisamplerX.h"
12 12
 
2  software/videomixer/main.c
@@ -3,11 +3,11 @@
3 3
 
4 4
 #include <irq.h>
5 5
 #include <uart.h>
  6
+#include <time.h>
6 7
 #include <hw/csr.h>
7 8
 #include <hw/flags.h>
8 9
 #include <console.h>
9 10
 
10  
-#include "time.h"
11 11
 #include "fb.h"
12 12
 #include "dvisampler0.h"
13 13
 #include "dvisampler1.h"

No commit comments for this range

Something went wrong with that request. Please try again.