Cygwin/Babun support
This commit is contained in:
parent
ef39d8dc27
commit
a0b836e61c
3 changed files with 24 additions and 11 deletions
24
Makefile
24
Makefile
|
@ -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
|
||||||
|
@ -28,10 +28,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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,sse4,-msse4) $(call cpufeature,sse4_1,-msse4.1) $(call cpufeature,sse4_2,-msse4.2) -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
|
||||||
|
@ -39,15 +39,17 @@ 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
|
||||||
FFTW_PACKAGE = fftw-3.3.3
|
FFTW_PACKAGE = fftw-3.3.3
|
||||||
|
SO_EXT = $(if $(findstring CYGWIN,$(shell uname -a)),dll,so)
|
||||||
|
|
||||||
all: clean-vect
|
all: clean-vect
|
||||||
@echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\).
|
@echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\).
|
||||||
@echo Auto-detected optimization parameters: $(PARAMS_SIMD)
|
@echo Auto-detected optimization parameters: $(PARAMS_SIMD)
|
||||||
@echo
|
@echo
|
||||||
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
|
||||||
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
|
||||||
arm-cross: clean-vect
|
arm-cross: clean-vect
|
||||||
|
@ -56,17 +58,17 @@ 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
|
rm -f libcsdr.$(SO_EXT) csdr
|
||||||
install:
|
install:
|
||||||
install -m 0755 libcsdr.so /usr/lib
|
install -m 0755 libcsdr.$(SO_EXT) /usr/lib
|
||||||
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
|
||||||
ldconfig
|
ldconfig
|
||||||
uninstall:
|
uninstall:
|
||||||
rm /usr/lib/libcsdr.so /usr/bin/csdr /usr/bin/csdr-fm
|
rm /usr/lib/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
|
||||||
|
|
6
csdr.c
6
csdr.c
|
@ -321,9 +321,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"))
|
||||||
{
|
{
|
||||||
|
@ -1386,6 +1388,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
#define TIME_TAKEN(start,end) ((end.tv_sec-start.tv_sec)+(end.tv_nsec-start.tv_nsec)/1e9)
|
#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)");
|
||||||
|
@ -1424,6 +1427,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
|
||||||
{
|
{
|
||||||
|
@ -1663,6 +1667,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;
|
||||||
|
@ -1700,6 +1705,7 @@ int main(int argc, char *argv[])
|
||||||
TRY_YIELD;
|
TRY_YIELD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!strcmp(argv[1],"dsb_fc"))
|
if(!strcmp(argv[1],"dsb_fc"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_____ _
|
_____ _
|
||||||
/ ____| | |
|
/ ____| | |
|
||||||
|
|
Loading…
Reference in a new issue