Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move source files into src directory #22

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 60 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.6
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions gpu_fft_base.c → src/gpu_fft_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; q<num_qpus; q++) { // Launch shader(s)
for (q=0; q<num_qpus; q++) { // Launch shader(s)
base->peri[V3D_SRQUA] = base->vc_unifs[q];
base->peri[V3D_SRQPC] = base->vc_code;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.