Compare commits

...

5 commits

Author SHA1 Message Date
ha7ilm
f55c4c35c3 Merged master 2017-04-12 23:41:58 +02:00
ha7ilm
6aa55f8195 fflush 2017-04-12 23:36:59 +02:00
ha7ilm
7fde9c81b5 Cygwin/babun has the DLLs in /bin/ 2016-06-29 22:47:16 +02:00
ha7ilm
c8fcb2fe88 ldconfig is optional 2016-06-29 22:37:29 +02:00
ha7ilm
a0b836e61c Cygwin/Babun support 2016-06-29 22:34:56 +02:00
3 changed files with 28 additions and 14 deletions

View file

@ -1,9 +1,9 @@
# This software is part of libcsdr, a set of simple DSP routines for # This software is part of libcsdr, a set of simple DSP routines for
# Software Defined Radio. # Software Defined Radio.
# #
# Copyright (c) 2014, Andras Retzler <randras@sdr.hu> # Copyright (c) 2014, Andras Retzler <randras@sdr.hu>
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright # * Redistributions of source code must retain the above copyright
@ -26,10 +26,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LIBSOURCES = fft_fftw.c libcsdr_wrapper.c LIBSOURCES = fft_fftw.c libcsdr_wrapper.c
#SOURCES = csdr.c $(LIBSOURCES) #SOURCES = csdr.c $(LIBSOURCES)
cpufeature = $(if $(findstring $(1),$(shell cat /proc/cpuinfo)),$(2)) cpufeature = $(if $(findstring $(1),$(shell cat /proc/cpuinfo)),$(2))
PARAMS_SSE = $(call cpufeature,sse,-msse) $(call cpufeature,sse2,-msse2) $(call cpufeature,sse3,-msse3) $(call cpufeature,sse4a,-msse4a) $(call cpufeature,sse4_1,-msse4.1) $(call cpufeature,sse4_2,-msse4.2 -msse4) -mfpmath=sse PARAMS_SSE = $(call cpufeature,sse,-msse) $(call cpufeature,sse2,-msse2) $(call cpufeature,sse3,-msse3) $(call cpufeature,sse4,-msse4) $(call cpufeature,sse4_1,-msse4.1) $(call cpufeature,sse4_2,-msse4.2) -mfpmath=sse
PARAMS_NEON = -mfloat-abi=hard -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -DNEON_OPTS PARAMS_NEON = -mfloat-abi=hard -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -DNEON_OPTS
#tnx Jan Szumiec for the Raspberry Pi support #tnx Jan Szumiec for the Raspberry Pi support
PARAMS_RASPI = -mfloat-abi=hard -mcpu=arm1176jzf-s -mfpu=vfp -funsafe-math-optimizations -Wformat=0 PARAMS_RASPI = -mfloat-abi=hard -mcpu=arm1176jzf-s -mfpu=vfp -funsafe-math-optimizations -Wformat=0
@ -37,11 +37,13 @@ PARAMS_ARM = $(if $(call cpufeature,BCM2708,dummy-text),$(PARAMS_RASPI),$(PARAMS
PARAMS_SIMD = $(if $(call cpufeature,sse,dummy-text),$(PARAMS_SSE),$(PARAMS_ARM)) PARAMS_SIMD = $(if $(call cpufeature,sse,dummy-text),$(PARAMS_SSE),$(PARAMS_ARM))
PARAMS_LOOPVECT = -O3 -ffast-math -fdump-tree-vect-details -dumpbase dumpvect PARAMS_LOOPVECT = -O3 -ffast-math -fdump-tree-vect-details -dumpbase dumpvect
PARAMS_LIBS = -g -lm -lrt -lfftw3f -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM PARAMS_LIBS = -g -lm -lrt -lfftw3f -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM
PARAMS_SO = -fpic PARAMS_SO = -fpic
PARAMS_MISC = -Wno-unused-result PARAMS_MISC = -Wno-unused-result
#DEBUG_ON = 0 #debug is always on by now (anyway it could be compiled with `make DEBUG_ON=1`) #DEBUG_ON = 0 #debug is always on by now (anyway it could be compiled with `make DEBUG_ON=1`)
#PARAMS_DEBUG = $(if $(DEBUG_ON),-g,) #PARAMS_DEBUG = $(if $(DEBUG_ON),-g,)
FFTW_PACKAGE = fftw-3.3.3 FFTW_PACKAGE = fftw-3.3.3
SO_EXT = $(if $(findstring CYGWIN,$(shell uname -a)),dll,so)
SO_PATH = $(if $(findstring CYGWIN,$(shell uname -a)),/bin,/usr/lib)
.PHONY: clean-vect clean .PHONY: clean-vect clean
all: csdr nmux all: csdr nmux
@ -50,7 +52,7 @@ libcsdr.so: fft_fftw.c fft_rpi.c libcsdr_wrapper.c libcsdr.c libcsdr_gpl.c fastd
@echo Auto-detected optimization parameters: $(PARAMS_SIMD) @echo Auto-detected optimization parameters: $(PARAMS_SIMD)
@echo @echo
rm -f dumpvect*.vect rm -f dumpvect*.vect
gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.$(SO_EXT)
-./parsevect dumpvect*.vect -./parsevect dumpvect*.vect
csdr: csdr.c libcsdr.so csdr: csdr.c libcsdr.so
gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr
@ -64,19 +66,18 @@ arm-cross: clean-vect
clean-vect: clean-vect:
rm -f dumpvect*.vect rm -f dumpvect*.vect
clean: clean-vect clean: clean-vect
rm -f libcsdr.so csdr ddcd nmux rm -f libcsdr.$(SO_EXT) csdr nmux
install: all install:
install -m 0755 libcsdr.so /usr/lib install -m 0755 libcsdr.$(SO_EXT) $(SO_PATH)
install -m 0755 csdr /usr/bin install -m 0755 csdr /usr/bin
install -m 0755 csdr-fm /usr/bin install -m 0755 csdr-fm /usr/bin
install -m 0755 nmux /usr/bin install -m 0755 nmux /usr/bin
#-install -m 0755 ddcd /usr/bin -ldconfig
ldconfig
uninstall: uninstall:
rm /usr/lib/libcsdr.so /usr/bin/csdr /usr/bin/csdr-fm rm $(SO_PATH)/libcsdr.$(SO_EXT) /usr/bin/csdr /usr/bin/csdr-fm
ldconfig -ldconfig
disasm: disasm:
objdump -S libcsdr.so > libcsdr.disasm objdump -S libcsdr.$(SO_EXT) > libcsdr.disasm
emcc-clean: emcc-clean:
-rm sdr.js/sdr.js -rm sdr.js/sdr.js
-rm sdr.js/sdrjs-compiled.js -rm sdr.js/sdrjs-compiled.js

8
csdr.c
View file

@ -340,9 +340,11 @@ int main(int argc, char *argv[])
if(argc<=1) return badsyntax(0); if(argc<=1) return badsyntax(0);
if(!strcmp(argv[1],"--help")) return badsyntax(0); if(!strcmp(argv[1],"--help")) return badsyntax(0);
#ifndef CSDR_NOLINUX
fcntl(STDIN_FILENO, F_SETPIPE_SZ, 65536*32); fcntl(STDIN_FILENO, F_SETPIPE_SZ, 65536*32);
fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 65536*32); fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 65536*32);
//fprintf(stderr, "csdr: F_SETPIPE_SZ\n"); //fprintf(stderr, "csdr: F_SETPIPE_SZ\n");
#endif
if(!strcmp(argv[1],"setbuf")) if(!strcmp(argv[1],"setbuf"))
{ {
@ -1602,6 +1604,9 @@ int main(int argc, char *argv[])
} }
#endif #endif
#define TIME_TAKEN(start,end) ((end.tv_sec-start.tv_sec)+(end.tv_nsec-start.tv_nsec)/1e9)
#ifndef CSDR_NOLINUX
if(!strcmp(argv[1],"fft_benchmark")) if(!strcmp(argv[1],"fft_benchmark"))
{ {
if(argc<=3) return badsyntax("need required parameters (fft_size, fft_cycles)"); if(argc<=3) return badsyntax("need required parameters (fft_size, fft_cycles)");
@ -1640,6 +1645,7 @@ int main(int argc, char *argv[])
fprintf(stderr,"fft_benchmark: %d transforms of %d processed in %g seconds, %g seconds each.\n",fft_cycles,fft_size,time_taken_fft,time_taken_fft/fft_cycles); fprintf(stderr,"fft_benchmark: %d transforms of %d processed in %g seconds, %g seconds each.\n",fft_cycles,fft_size,time_taken_fft,time_taken_fft/fft_cycles);
return 0; return 0;
} }
#endif
if(!strcmp(argv[1],"bandpass_fir_fft_cc")) //this command does not exist as a separate function if(!strcmp(argv[1],"bandpass_fir_fft_cc")) //this command does not exist as a separate function
{ {
@ -1877,6 +1883,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
#ifndef CSDR_NOLINUX
if(!strcmp(argv[1],"through")) if(!strcmp(argv[1],"through"))
{ {
struct timespec start_time, end_time; struct timespec start_time, end_time;
@ -1914,6 +1921,7 @@ int main(int argc, char *argv[])
TRY_YIELD; TRY_YIELD;
} }
} }
#endif
if(!strcmp(argv[1],"dsb_fc")) if(!strcmp(argv[1],"dsb_fc"))
{ {

View file

@ -31,6 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define MIN_M(x,y) (((x)>(y))?(y):(x)) #define MIN_M(x,y) (((x)>(y))?(y):(x))
#ifdef __CYGWIN__
#define CSDR_NOLINUX
#endif
/* /*
_____ _ _____ _
/ ____| | | / ____| | |