diff --git a/Makefile b/Makefile index 6ca6cb6..c07330a 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,74 @@ -VERSION = 0.2.6 - -# USE_RPI_GPU_FFT = 1 +VERSION = $(shell cat VERSION.txt) 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)","") -USE_RPI_GPU_FFT = 1 -FLAGS += -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp -endif +prefix = /usr/local +##### -#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 +TARGETS = X64 ARM -ifdef USE_RPI_GPU_FFT -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 +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 -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 +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 -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 + 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 -r2fft_test: Makefile r2fft_test.cc r2fft.h fft.h - g++ $(FLAGS) -o r2fft_test r2fft_test.cc -lm -lfftw3 -lfftw3f +##### + +all: gsm_scan ogn-rf r2fft_test + +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) + +clean: + $(RM) gsm_scan ogn-rf r2fft_test + + +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 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 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