From 16fac2434a0422e8870c7be4842dff623f73b832 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Wed, 11 Jan 2017 22:42:37 +0100 Subject: [PATCH 1/5] Move sources files into ./src/ directory --- rtlsdr-ogn => scripts/rtlsdr-ogn | 0 rtlsdr-ogn.conf => scripts/rtlsdr-ogn.conf | 0 alloc.h => src/alloc.h | 0 asciitime.h => src/asciitime.h | 0 boxfilter.h => src/boxfilter.h | 0 buffer.h => src/buffer.h | 0 dataserver.h => src/dataserver.h | 0 fft.h => src/fft.h | 0 freqplan.h => src/freqplan.h | 0 gpu_fft.c => src/gpu_fft.c | 0 gpu_fft.h => src/gpu_fft.h | 0 gpu_fft_base.c => src/gpu_fft_base.c | 4 ++-- gpu_fft_shaders.c => src/gpu_fft_shaders.c | 0 gpu_fft_twiddles.c => src/gpu_fft_twiddles.c | 0 gsm_scan.cc => src/gsm_scan.cc | 0 {hex => src/hex}/shader_1024k.hex | 0 {hex => src/hex}/shader_128k.hex | 0 {hex => src/hex}/shader_16k.hex | 0 {hex => src/hex}/shader_1k.hex | 0 {hex => src/hex}/shader_2048k.hex | 0 {hex => src/hex}/shader_256.hex | 0 {hex => src/hex}/shader_256k.hex | 0 {hex => src/hex}/shader_2k.hex | 0 {hex => src/hex}/shader_32k.hex | 0 {hex => src/hex}/shader_4096k.hex | 0 {hex => src/hex}/shader_4k.hex | 0 {hex => src/hex}/shader_512.hex | 0 {hex => src/hex}/shader_512k.hex | 0 {hex => src/hex}/shader_64k.hex | 0 {hex => src/hex}/shader_8k.hex | 0 {hex => src/hex}/shader_trans.hex | 0 image.h => src/image.h | 0 jpeg.h => src/jpeg.h | 0 mailbox.c => src/mailbox.c | 0 mailbox.h => src/mailbox.h | 0 ogn-rf.cc => src/ogn-rf.cc | 0 pulsefilter.h => src/pulsefilter.h | 0 r2fft.h => src/r2fft.h | 0 r2fft_test.cc => src/r2fft_test.cc | 0 rtlsdr.h => src/rtlsdr.h | 0 serialize.cpp => src/serialize.cpp | 0 serialize.h => src/serialize.h | 0 socket.h => src/socket.h | 0 sysmon.h => src/sysmon.h | 0 thread.h => src/thread.h | 0 tonefilter.h => src/tonefilter.h | 0 46 files changed, 2 insertions(+), 2 deletions(-) rename rtlsdr-ogn => scripts/rtlsdr-ogn (100%) rename rtlsdr-ogn.conf => scripts/rtlsdr-ogn.conf (100%) rename alloc.h => src/alloc.h (100%) rename asciitime.h => src/asciitime.h (100%) rename boxfilter.h => src/boxfilter.h (100%) rename buffer.h => src/buffer.h (100%) rename dataserver.h => src/dataserver.h (100%) rename fft.h => src/fft.h (100%) rename freqplan.h => src/freqplan.h (100%) rename gpu_fft.c => src/gpu_fft.c (100%) rename gpu_fft.h => src/gpu_fft.h (100%) rename gpu_fft_base.c => src/gpu_fft_base.c (98%) rename gpu_fft_shaders.c => src/gpu_fft_shaders.c (100%) rename gpu_fft_twiddles.c => src/gpu_fft_twiddles.c (100%) rename gsm_scan.cc => src/gsm_scan.cc (100%) rename {hex => src/hex}/shader_1024k.hex (100%) rename {hex => src/hex}/shader_128k.hex (100%) rename {hex => src/hex}/shader_16k.hex (100%) rename {hex => src/hex}/shader_1k.hex (100%) rename {hex => src/hex}/shader_2048k.hex (100%) rename {hex => src/hex}/shader_256.hex (100%) rename {hex => src/hex}/shader_256k.hex (100%) rename {hex => src/hex}/shader_2k.hex (100%) rename {hex => src/hex}/shader_32k.hex (100%) rename {hex => src/hex}/shader_4096k.hex (100%) rename {hex => src/hex}/shader_4k.hex (100%) rename {hex => src/hex}/shader_512.hex (100%) rename {hex => src/hex}/shader_512k.hex (100%) rename {hex => src/hex}/shader_64k.hex (100%) rename {hex => src/hex}/shader_8k.hex (100%) rename {hex => src/hex}/shader_trans.hex (100%) rename image.h => src/image.h (100%) rename jpeg.h => src/jpeg.h (100%) rename mailbox.c => src/mailbox.c (100%) rename mailbox.h => src/mailbox.h (100%) rename ogn-rf.cc => src/ogn-rf.cc (100%) rename pulsefilter.h => src/pulsefilter.h (100%) rename r2fft.h => src/r2fft.h (100%) rename r2fft_test.cc => src/r2fft_test.cc (100%) rename rtlsdr.h => src/rtlsdr.h (100%) rename serialize.cpp => src/serialize.cpp (100%) rename serialize.h => src/serialize.h (100%) rename socket.h => src/socket.h (100%) rename sysmon.h => src/sysmon.h (100%) rename thread.h => src/thread.h (100%) rename tonefilter.h => src/tonefilter.h (100%) diff --git a/rtlsdr-ogn b/scripts/rtlsdr-ogn similarity index 100% rename from rtlsdr-ogn rename to scripts/rtlsdr-ogn diff --git a/rtlsdr-ogn.conf b/scripts/rtlsdr-ogn.conf similarity index 100% rename from rtlsdr-ogn.conf rename to scripts/rtlsdr-ogn.conf diff --git a/alloc.h b/src/alloc.h similarity index 100% rename from alloc.h rename to src/alloc.h diff --git a/asciitime.h b/src/asciitime.h similarity index 100% rename from asciitime.h rename to src/asciitime.h diff --git a/boxfilter.h b/src/boxfilter.h similarity index 100% rename from boxfilter.h rename to src/boxfilter.h diff --git a/buffer.h b/src/buffer.h similarity index 100% rename from buffer.h rename to src/buffer.h diff --git a/dataserver.h b/src/dataserver.h similarity index 100% rename from dataserver.h rename to src/dataserver.h diff --git a/fft.h b/src/fft.h similarity index 100% rename from fft.h rename to src/fft.h diff --git a/freqplan.h b/src/freqplan.h similarity index 100% rename from freqplan.h rename to src/freqplan.h diff --git a/gpu_fft.c b/src/gpu_fft.c similarity index 100% rename from gpu_fft.c rename to src/gpu_fft.c diff --git a/gpu_fft.h b/src/gpu_fft.h similarity index 100% rename from gpu_fft.h rename to src/gpu_fft.h diff --git a/gpu_fft_base.c b/src/gpu_fft_base.c similarity index 98% rename from gpu_fft_base.c rename to src/gpu_fft_base.c index ad5bd99..76656b8 100644 --- a/gpu_fft_base.c +++ b/src/gpu_fft_base.c @@ -89,7 +89,7 @@ unsigned gpu_fft_base_exec_direct ( struct GPU_FFT_BASE *base, int num_qpus) { - // unsigned q, t; + unsigned q, t; base->peri[V3D_DBCFG] = 0; // Disallow IRQ base->peri[V3D_DBQITE] = 0; // Disable IRQ @@ -100,7 +100,7 @@ unsigned gpu_fft_base_exec_direct ( base->peri[V3D_SRQCS] = (1<<7) | (1<<8) | (1<<16); // Reset error bit and counts - for (int q=0; qperi[V3D_SRQUA] = base->vc_unifs[q]; base->peri[V3D_SRQPC] = base->vc_code; } diff --git a/gpu_fft_shaders.c b/src/gpu_fft_shaders.c similarity index 100% rename from gpu_fft_shaders.c rename to src/gpu_fft_shaders.c diff --git a/gpu_fft_twiddles.c b/src/gpu_fft_twiddles.c similarity index 100% rename from gpu_fft_twiddles.c rename to src/gpu_fft_twiddles.c diff --git a/gsm_scan.cc b/src/gsm_scan.cc similarity index 100% rename from gsm_scan.cc rename to src/gsm_scan.cc diff --git a/hex/shader_1024k.hex b/src/hex/shader_1024k.hex similarity index 100% rename from hex/shader_1024k.hex rename to src/hex/shader_1024k.hex diff --git a/hex/shader_128k.hex b/src/hex/shader_128k.hex similarity index 100% rename from hex/shader_128k.hex rename to src/hex/shader_128k.hex diff --git a/hex/shader_16k.hex b/src/hex/shader_16k.hex similarity index 100% rename from hex/shader_16k.hex rename to src/hex/shader_16k.hex diff --git a/hex/shader_1k.hex b/src/hex/shader_1k.hex similarity index 100% rename from hex/shader_1k.hex rename to src/hex/shader_1k.hex diff --git a/hex/shader_2048k.hex b/src/hex/shader_2048k.hex similarity index 100% rename from hex/shader_2048k.hex rename to src/hex/shader_2048k.hex diff --git a/hex/shader_256.hex b/src/hex/shader_256.hex similarity index 100% rename from hex/shader_256.hex rename to src/hex/shader_256.hex diff --git a/hex/shader_256k.hex b/src/hex/shader_256k.hex similarity index 100% rename from hex/shader_256k.hex rename to src/hex/shader_256k.hex diff --git a/hex/shader_2k.hex b/src/hex/shader_2k.hex similarity index 100% rename from hex/shader_2k.hex rename to src/hex/shader_2k.hex diff --git a/hex/shader_32k.hex b/src/hex/shader_32k.hex similarity index 100% rename from hex/shader_32k.hex rename to src/hex/shader_32k.hex diff --git a/hex/shader_4096k.hex b/src/hex/shader_4096k.hex similarity index 100% rename from hex/shader_4096k.hex rename to src/hex/shader_4096k.hex diff --git a/hex/shader_4k.hex b/src/hex/shader_4k.hex similarity index 100% rename from hex/shader_4k.hex rename to src/hex/shader_4k.hex diff --git a/hex/shader_512.hex b/src/hex/shader_512.hex similarity index 100% rename from hex/shader_512.hex rename to src/hex/shader_512.hex diff --git a/hex/shader_512k.hex b/src/hex/shader_512k.hex similarity index 100% rename from hex/shader_512k.hex rename to src/hex/shader_512k.hex diff --git a/hex/shader_64k.hex b/src/hex/shader_64k.hex similarity index 100% rename from hex/shader_64k.hex rename to src/hex/shader_64k.hex diff --git a/hex/shader_8k.hex b/src/hex/shader_8k.hex similarity index 100% rename from hex/shader_8k.hex rename to src/hex/shader_8k.hex diff --git a/hex/shader_trans.hex b/src/hex/shader_trans.hex similarity index 100% rename from hex/shader_trans.hex rename to src/hex/shader_trans.hex diff --git a/image.h b/src/image.h similarity index 100% rename from image.h rename to src/image.h diff --git a/jpeg.h b/src/jpeg.h similarity index 100% rename from jpeg.h rename to src/jpeg.h diff --git a/mailbox.c b/src/mailbox.c similarity index 100% rename from mailbox.c rename to src/mailbox.c diff --git a/mailbox.h b/src/mailbox.h similarity index 100% rename from mailbox.h rename to src/mailbox.h diff --git a/ogn-rf.cc b/src/ogn-rf.cc similarity index 100% rename from ogn-rf.cc rename to src/ogn-rf.cc diff --git a/pulsefilter.h b/src/pulsefilter.h similarity index 100% rename from pulsefilter.h rename to src/pulsefilter.h diff --git a/r2fft.h b/src/r2fft.h similarity index 100% rename from r2fft.h rename to src/r2fft.h diff --git a/r2fft_test.cc b/src/r2fft_test.cc similarity index 100% rename from r2fft_test.cc rename to src/r2fft_test.cc diff --git a/rtlsdr.h b/src/rtlsdr.h similarity index 100% rename from rtlsdr.h rename to src/rtlsdr.h diff --git a/serialize.cpp b/src/serialize.cpp similarity index 100% rename from serialize.cpp rename to src/serialize.cpp diff --git a/serialize.h b/src/serialize.h similarity index 100% rename from serialize.h rename to src/serialize.h diff --git a/socket.h b/src/socket.h similarity index 100% rename from socket.h rename to src/socket.h diff --git a/sysmon.h b/src/sysmon.h similarity index 100% rename from sysmon.h rename to src/sysmon.h diff --git a/thread.h b/src/thread.h similarity index 100% rename from thread.h rename to src/thread.h diff --git a/tonefilter.h b/src/tonefilter.h similarity index 100% rename from tonefilter.h rename to src/tonefilter.h From 8314b6736229d3a0e529ec80c0b6f4c8afcb617a Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 9 Feb 2017 23:01:53 +0100 Subject: [PATCH 2/5] Move version string from Makefile to VERSION.txt --- Makefile | 2 +- VERSION.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 VERSION.txt diff --git a/Makefile b/Makefile index 6ca6cb6..1c7b78c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 0.2.6 +VERSION = $(shell cat VERSION.txt) # USE_RPI_GPU_FFT = 1 diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..53a75d6 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1 @@ +0.2.6 From dd8eea7f5835b22f962879bc0b494d1f2864025b Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 9 Feb 2017 22:23:07 +0100 Subject: [PATCH 3/5] Improve Makefile --- Makefile | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 1c7b78c..3d53c5f 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,39 @@ VERSION = $(shell cat VERSION.txt) -# USE_RPI_GPU_FFT = 1 - FLAGS = -Wall -O3 -ffast-math -DVERSION=$(VERSION) -LIBS = -lpthread -lm -ljpeg -lconfig -lrt +LDLIBS = -lpthread -lm -ljpeg -lconfig -lrt -lfftw3 -lfftw3f -lrtlsdr -ldl + +##### ifneq ("$(wildcard /opt/vc/src/hello_pi/hello_fft)","") +TARGET=RASPBERRYPI +endif + +ifeq ($(TARGET),RASPBERRYPI) USE_RPI_GPU_FFT = 1 FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp endif -#ifndef __MACH__ # _POSIX_TIMERS # OSX has no clock_gettime() and thus not -lrt (but _POSIX_TIMERS seem not to be defined in make ?) -#LIBS += -lrt -#endif - ifdef USE_RPI_GPU_FFT +LDLIBS += -ldl GPU_FLAGS = -DUSE_RPI_GPU_FFT -GPU_SRC = mailbox.c gpu_fft_base.c gpu_fft.c gpu_fft_twiddles.c gpu_fft_shaders.c -LIBS += -ldl +GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c endif -all: gsm_scan ogn-rf r2fft_test +##### -ogn-rf: Makefile ogn-rf.cc rtlsdr.h thread.h fft.h buffer.h image.h - g++ $(FLAGS) $(GPU_FLAGS) -o ogn-rf ogn-rf.cc $(GPU_SRC) $(LIBS) -lrtlsdr -lfftw3 -lfftw3f -ifdef USE_RPI_GPU_FFT - sudo chown root ogn-rf - sudo chmod a+s ogn-rf -endif +all: gsm_scan ogn-rf r2fft_test -gsm_scan: Makefile gsm_scan.cc rtlsdr.h fft.h buffer.h image.h - g++ $(FLAGS) $(GPU_FLAGS) -o gsm_scan gsm_scan.cc $(GPU_SRC) $(LIBS) -lrtlsdr -lfftw3 -lfftw3f -ifdef USE_RPI_GPU_FFT - sudo chown root gsm_scan - sudo chmod a+s gsm_scan -endif +ogn-rf: src/ogn-rf.cc src/thread.h src/rtlsdr.h src/fft.h src/buffer.h src/image.h + g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS) + +gsm_scan: src/gsm_scan.cc src/fft.h src/buffer.h src/image.h + g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS) + +r2fft_test: src/r2fft_test.cc src/r2fft.h src/fft.h + g++ $(FLAGS) $(GPU_FLAGS) -o $@ $< $(GPU_SRC) $(LDLIBS) -r2fft_test: Makefile r2fft_test.cc r2fft.h fft.h - g++ $(FLAGS) -o r2fft_test r2fft_test.cc -lm -lfftw3 -lfftw3f +clean: + $(RM) gsm_scan ogn-rf r2fft_test +.PHONY: clean From 262e6b5cff4f4ff1cc4455f0d894a5e89047a1a4 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Sun, 12 Feb 2017 18:03:14 +0100 Subject: [PATCH 4/5] Makefile: Add all to phony targets --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3d53c5f..0dbf743 100644 --- a/Makefile +++ b/Makefile @@ -36,4 +36,4 @@ r2fft_test: src/r2fft_test.cc src/r2fft.h src/fft.h clean: $(RM) gsm_scan ogn-rf r2fft_test -.PHONY: clean +.PHONY: all clean From 9d6fdc8737b5ba24313ce1ca707606739e60e743 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 18 May 2017 00:19:16 +0200 Subject: [PATCH 5/5] Makefile: Add arch independent installation rules --- Makefile | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0dbf743..c07330a 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,45 @@ VERSION = $(shell cat VERSION.txt) FLAGS = -Wall -O3 -ffast-math -DVERSION=$(VERSION) LDLIBS = -lpthread -lm -ljpeg -lconfig -lrt -lfftw3 -lfftw3f -lrtlsdr -ldl +prefix = /usr/local ##### -ifneq ("$(wildcard /opt/vc/src/hello_pi/hello_fft)","") -TARGET=RASPBERRYPI +TARGETS = X64 ARM + +ifeq ($(TARGET),) + HOST_UNAME="$(shell uname -m)" + ifeq ($(HOST_UNAME), "x86_64") + TARGET = X64 + else ifeq ($(HOST_UNAME), "armv7l") + TARGET = ARM + ifneq ("$(wildcard /opt/vc/src/hello_pi/hello_fft)","") + USE_RPI_GPU_FFT = 1 + endif + else + $(error Unknown host architecture: $(HOST_UNAME), manually specify TARGET from $(TARGETS)) + endif +else + ifeq ($(filter $(TARGET),$(TARGETS)),) + $(error Unknown target: $(TARGET)) + endif endif -ifeq ($(TARGET),RASPBERRYPI) -USE_RPI_GPU_FFT = 1 -FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp + +ifeq ($(TARGET),ARM) + FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp + ifdef USE_RPI_GPU_FFT + OGN_DECODE_PATH=rpi-gpu-bin + else + OGN_DECODE_PATH=arm-bin + endif +else ifeq ($(TARGET), X64) + OGN_DECODE_PATH=x64-bin endif ifdef USE_RPI_GPU_FFT -LDLIBS += -ldl -GPU_FLAGS = -DUSE_RPI_GPU_FFT -GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c + LDLIBS += -ldl + GPU_FLAGS = -DUSE_RPI_GPU_FFT + GPU_SRC = src/mailbox.c src/gpu_fft.c src/gpu_fft_base.c src/gpu_fft_twiddles.c src/gpu_fft_shaders.c endif ##### @@ -36,4 +60,15 @@ r2fft_test: src/r2fft_test.cc src/r2fft.h src/fft.h clean: $(RM) gsm_scan ogn-rf r2fft_test -.PHONY: all clean + +install: ogn-rf gsm_scan + install -D ogn-rf $(DESTDIR)$(prefix)/bin/ogn-rf + install -D gsm_scan $(DESTDIR)$(prefix)/bin/gsm_scan + install -D $(OGN_DECODE_PATH)/ogn-decode $(DESTDIR)$(prefix)/bin/ogn-decode + +uninstall: + $(RM) $(DESTDIR)$(prefix)/bin/ogn-rf + $(RM) $(DESTDIR)$(prefix)/bin/gsm_scan + $(RM) $(DESTDIR)$(prefix)/bin/ogn-decode + +.PHONY: all clean install uninstall