Summary: Merge in linux branch

svn+ssh://svn.berlios.de/svnroot/repos/wsjt/WSJT/branches/linux
merged into
svn+ssh://svn.berlios.de/svnroot/repos/wsjt/trunk



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@155 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
J C Dutton 2006-04-05 20:07:32 +00:00
parent 4dc8d03f8a
commit a39f662b4d
41 changed files with 2234 additions and 1127 deletions

View File

@ -4,13 +4,14 @@ LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
# WSJT specific C flags
CFLAGS += -DBIGSYM=1
CFLAGS += -DBIGSYM=1 -fPIC
DEFS = @DEFS@
CFLAGS += ${DEFS}
CPPFLAGS += ${DEFS}
CPPFLAGS += ${DEFS} -I.
# WSJT specific Fortran flags
FFLAGS += -cpp -Wall -fbounds-check -ftrace=full -fno-second-underscore
FFLAGS += -Wall -fbounds-check -fno-second-underscore -ffixed-line-length-none -fPIC
#FFLAGS += -Wall -fbounds-check -fno-second-underscore -fPIC
#FFLAGS += -cpp -fno-second-underscore
# The default rules
.c.o:
@ -19,8 +20,8 @@ FFLAGS += -cpp -Wall -fbounds-check -ftrace=full -fno-second-underscore
.f.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.f=.o} $<
.f90.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.f90=.o} $<
.F90.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.F90=.o} $<
OS=@OS@
G95=@G95@
@ -44,11 +45,11 @@ OBJS1 = JT65code.o nchar.o grid2deg.o packmsg.o packtext.o \
F2PYONLY = ftn_init ftn_quit audio_init spec getfile azdist0 astro0
SRCS2F90 = abc441.f90 astro0.f90 audio_init.f90 azdist0.f90 \
blanker.f90 decode1.f90 decode2.f90 decode3.f90 ftn_init.f90 \
ftn_quit.f90 get_fname.f90 getfile.f90 horizspec.f90 hscroll.f90 \
i1tor4.f90 pix2d.f90 pix2d65.f90 rfile.f90 savedata.f90 spec.f90 \
wsjtgen.f90 runqqq.f90 fivehz.f90
SRCS2F90 = abc441.F90 astro0.F90 audio_init.F90 azdist0.f90 \
blanker.f90 decode1.F90 decode2.f90 decode3.F90 ftn_init.F90 \
ftn_quit.f90 get_fname.F90 getfile.F90 horizspec.f90 hscroll.f90 \
i1tor4.f90 pix2d.f90 pix2d65.f90 rfile.f90 savedata.F90 spec.f90 \
wsjtgen.F90 runqqq.F90 fivehz.F90
OBJS2F90 = ${SRCS2F90:.f90=.o}
SRCS2F77 = wsjt1.f astro.f azdist.f coord.f dcoord.f deg2grid.f \
@ -64,7 +65,7 @@ SRCS2F77 = wsjt1.f astro.f azdist.f coord.f dcoord.f deg2grid.f \
interleave63.f k2grid.f limit.f lpf1.f deep65.f morse.f \
nchar.f packcall.f packgrid.f packmsg.f packtext.f setup65.f \
short65.f slope.f spec2d65.f sync65.f unpackcall.f \
unpackgrid.f unpackmsg.f unpacktext.f xcor.f xfft.f wsjt65.f
unpackgrid.f unpackmsg.f unpacktext.f xcor.f xfft.f xfft2.f wsjt65.f
OBJS2F77 = ${SRCS2F77:.f=.o}
SRCS2C = init_rs.c encode_rs.c decode_rs.c
@ -101,7 +102,7 @@ wsjt6: Audio.so #wsjt.spec
#
#
Audio.so: $(OBJS2C) $(OBJS3C) $(OBJS2F77) $(SRCS2F90) $(AUDIOSRCS)
${F2PY} -c --quiet --opt="-O -cpp -D${CFLAGS} \
${F2PY} -c --quiet --opt="-O ${CFLAGS} \
-fno-second-underscore" $(OBJS2C) $(OBJS2F77) -m Audio \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \
only: $(F2PYONLY) \

121
Makefile.linux.g95 Normal file
View File

@ -0,0 +1,121 @@
CC ?= gcc
FFLAGS = -g -O2
LDFLAGS = -L/usr/local/lib -lpthread -lasound
CPPFLAGS = -I/usr/local/include -I/usr/include/alsa
CFLAGS = -Wall -O0 -g -Wall -O0 -g
# WSJT specific C flags
CFLAGS += -DBIGSYM=1
DEFS = -DPACKAGE_NAME=\"wsjt\" -DPACKAGE_TARNAME=\"wsjt\" -DPACKAGE_VERSION=\"5.9.2\" -DPACKAGE_STRING=\"wsjt\ 5.9.2\" -DPACKAGE_BUGREPORT=\"\" -DG95_LIB_PATH=\"/u/g95/g95-install/bin/../lib/gcc-lib/i686-pc-linux-gnu/4.0.1//\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_SYSLOG_H=1 -DHAVE_STDDEF_H=1 -DHAVE_LIBGEN_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_WAIT_H=1 -DHAVE_STDIO_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_LINUX_PPDEV_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DTIME_WITH_SYS_TIME=1 -DSTRING_WITH_STRINGS=1 -DSIZEOF_INT64_T=8 -DSIZEOF_LONG_LONG=8 -DNDEBUG=1 -DPREFIX=\"/usr/local/\" -DUSE_SERIAL=1 -DUSE_ALSA=1 -DHAS_ASOUNDLIB_H=1 -DHAS_SOUNDCARD_H=1 -DHAS_SAMPLERATE_H=1
CFLAGS += ${DEFS}
CPPFLAGS += ${DEFS}
# WSJT specific Fortran flags
#FFLAGS += -Wall -fbounds-check -fno-second-underscore -ffixed-line-length-none
FFLAGS += -Wall -fbounds-check -fno-second-underscore
#FFLAGS += -cpp -fno-second-underscore
# The default rules
.c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c -o ${<:.c=.o} $<
.f.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.f=.o} $<
.F90.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.F90=.o} $<
OS=Linux
G95=/usr/X11R6/bin/g95
COMPILER=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6//
#COMPILER=/u/g95/g95-install/bin/../lib/gcc-lib/i686-pc-linux-gnu/4.0.1//
FC=/usr/X11R6/bin/g95
LDFLAGS += -L${COMPILER}
LDFLAGS += -lg2c
PYTHON ?= /usr/X11R6/bin/python
RM ?= /usr/X11R6/bin/rm
F2PY = /usr/X11R6/bin/f2py
OBJS1 = JT65code.o nchar.o grid2deg.o packmsg.o packtext.o \
packcall.o packgrid.o unpackmsg.o unpacktext.o unpackcall.o \
unpackgrid.o deg2grid.o packdxcc.o chkmsg.o getpfx1.o \
getpfx2.o k2grid.o grid2k.o interleave63.o graycode.o set.o \
igray.o init_rs_int.o encode_rs_int.o decode_rs_int.o \
wrapkarn.o
F2PYONLY = ftn_init ftn_quit audio_init spec getfile azdist0 astro0
SRCS2F90 = abc441.F90 astro0.F90 audio_init.F90 azdist0.f90 \
blanker.f90 decode1.F90 decode2.f90 decode3.F90 ftn_init.F90 \
ftn_quit.f90 get_fname.F90 getfile.F90 horizspec.f90 hscroll.f90 \
i1tor4.f90 pix2d.f90 pix2d65.f90 rfile.f90 savedata.F90 spec.f90 \
wsjtgen.F90 runqqq.F90 fivehz.F90
OBJS2F90 = ${SRCS2F90:.f90=.o}
SRCS2F77 = wsjt1.f astro.f azdist.f coord.f dcoord.f deg2grid.f \
dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f moon2.f \
MoonDop.f sun.f toxyz.f pfxdump.f \
avesp2.f bzap.f spec441.f spec2d.f mtdecode.f stdecode.f \
indexx.f s2shape.f flat2.f gen65.f chkmsg.f gen6m.f gentone.f \
syncf0.f syncf1.f synct.f decode6m.f avemsg6m.f \
set.f flatten.f db.f pctile.f sort.f ssort.f ps.f smooth.f \
ping.f longx.f peakup.f sync.f detect.f avemsg65.f decode65.f \
demod64a.f encode65.f extract.f flat1.f four2.f rfile2.f \
gencw.f getpfx1.f getpfx2.f getsnr.f graycode.f grid2k.f \
interleave63.f k2grid.f limit.f lpf1.f deep65.f morse.f \
nchar.f packcall.f packgrid.f packmsg.f packtext.f setup65.f \
short65.f slope.f spec2d65.f sync65.f unpackcall.f \
unpackgrid.f unpackmsg.f unpacktext.f xcor.f xfft.f xfft2.f wsjt65.f
OBJS2F77 = ${SRCS2F77:.f=.o}
SRCS2C = init_rs.c encode_rs.c decode_rs.c
OBJS2C = ${SRCS2C:.c=.o}
# ok, so far for now
# Windows start_alsa.c will be a2d.f90 jtaudio.c since it uses portaudio
# for *nix start_alsa.c will also be a2d.f90, jtaudio.c
# and start_portaudio.c for systems using portaudio
# for *nix start_alsa.c will be start_alsa.c for alsa
# for *nix start_alsa.c will be start_oss.c for oss
#
# ptt_unix.c vs. ptt.c I'll sort out later.
# ditto for cutil.c (only used on *nix)
# --db
# jtaudio.c/start_threads.c mess will have to be sorted out later
# to minimise #ifdef's
# --db
# and mostly sorted
# --db
#
SRCS3C = ptt_unix.c igray.c wrapkarn.c cutil.c
OBJS3C = ${SRCS3C:.c=.o}
AUDIOSRCS = start_alsa.c
all: wsjt6
JT65code: $(OBJS1)
$(FC) -o JT65code $(OBJS1)
wsjt6: Audio.so #wsjt.spec
# ${PYTHON} c:\python23\installer\Build.py wsjt.spec
# ${RM} wsjt6
#
#
Audio.so: $(OBJS2C) $(OBJS3C) $(OBJS2F77) $(SRCS2F90) $(AUDIOSRCS)
${F2PY} -c --quiet --opt="-O -D${CFLAGS} \
-fno-second-underscore" $(OBJS2C) $(OBJS2F77) -m Audio \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \
only: $(F2PYONLY) \
: $(SRCS2F90) \
${SRCS3C} ${AUDIOSRCS}
wsjt.spec: wsjt.py astro.py g.py options.py palettes.py smeter.py specjt.py
# ${PYTHON} c:\python23\installer\makespec.py --icon wsjt.ico \
# --tk --onefile wsjt.py
.PHONY : clean
clean:
${RM} -f *.o *.so *~ JT65code wsjt6

120
Makefile.linux.gfortran Normal file
View File

@ -0,0 +1,120 @@
CC ?= gcc
FFLAGS = -g -O2 -fPIC
LDFLAGS = -L/usr/local/lib -lpthread -lasound
CPPFLAGS = -I/usr/local/include -I/usr/include/alsa -I.
CFLAGS = -Wall -O0 -g -Wall -O0 -g -fPIC
# WSJT specific C flags
CFLAGS += -DBIGSYM=1
DEFS = -DPACKAGE_NAME=\"wsjt\" -DPACKAGE_TARNAME=\"wsjt\" -DPACKAGE_VERSION=\"5.9.2\" -DPACKAGE_STRING=\"wsjt\ 5.9.2\" -DPACKAGE_BUGREPORT=\"\" -DG95_LIB_PATH=\"/usr/lib/gcc/x86_64-linux-gnu/4.0.3/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_ERRNO_H=1 -DHAVE_SYS_SYSLOG_H=1 -DHAVE_STDDEF_H=1 -DHAVE_LIBGEN_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_WAIT_H=1 -DHAVE_STDIO_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_LINUX_PPDEV_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DTIME_WITH_SYS_TIME=1 -DSTRING_WITH_STRINGS=1 -DSIZEOF_INT64_T=8 -DSIZEOF_LONG_LONG=8 -DNDEBUG=1 -DPREFIX=\"/usr/local/\" -DUSE_SERIAL=1 -DUSE_ALSA=1 -DHAS_ASOUNDLIB_H=1 -DHAS_SOUNDCARD_H=1
CFLAGS += ${DEFS}
CPPFLAGS += ${DEFS}
# WSJT specific Fortran flags
FFLAGS += -Wall -fbounds-check -fno-second-underscore -ffixed-line-length-none
#FFLAGS += -Wall -fbounds-check -fno-second-underscore
#FFLAGS += -cpp -fno-second-underscore
# The default rules
.c.o:
${CC} ${CPPFLAGS} ${CFLAGS} -c -o ${<:.c=.o} $<
.f.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.f=.o} $<
.F90.o:
${G95} ${CPPFLAGS} ${FFLAGS} -c -o ${<:.F90=.o} $<
OS=Linux
G95=/usr/bin/g95
COMPILER=/usr/lib/gcc/x86_64-linux-gnu/4.0.3/
FC=/usr/bin/g95
LDFLAGS += -L${COMPILER}
LDFLAGS += -lg2c
PYTHON ?= /usr/bin/python
RM ?= /bin/rm
F2PY = /usr/bin/f2py
OBJS1 = JT65code.o nchar.o grid2deg.o packmsg.o packtext.o \
packcall.o packgrid.o unpackmsg.o unpacktext.o unpackcall.o \
unpackgrid.o deg2grid.o packdxcc.o chkmsg.o getpfx1.o \
getpfx2.o k2grid.o grid2k.o interleave63.o graycode.o set.o \
igray.o init_rs_int.o encode_rs_int.o decode_rs_int.o \
wrapkarn.o
F2PYONLY = ftn_init ftn_quit audio_init spec getfile azdist0 astro0
SRCS2F90 = abc441.F90 astro0.F90 audio_init.F90 azdist0.f90 \
blanker.f90 decode1.F90 decode2.f90 decode3.F90 ftn_init.F90 \
ftn_quit.f90 get_fname.F90 getfile.F90 horizspec.f90 hscroll.f90 \
i1tor4.f90 pix2d.f90 pix2d65.f90 rfile.f90 savedata.F90 spec.f90 \
wsjtgen.F90 runqqq.F90 fivehz.F90
OBJS2F90 = ${SRCS2F90:.f90=.o}
SRCS2F77 = wsjt1.f astro.f azdist.f coord.f dcoord.f deg2grid.f \
dot.f ftsky.f geocentric.f GeoDist.f grid2deg.f moon2.f \
MoonDop.f sun.f toxyz.f pfxdump.f \
avesp2.f bzap.f spec441.f spec2d.f mtdecode.f stdecode.f \
indexx.f s2shape.f flat2.f gen65.f chkmsg.f gen6m.f gentone.f \
syncf0.f syncf1.f synct.f decode6m.f avemsg6m.f \
set.f flatten.f db.f pctile.f sort.f ssort.f ps.f smooth.f \
ping.f longx.f peakup.f sync.f detect.f avemsg65.f decode65.f \
demod64a.f encode65.f extract.f flat1.f four2.f rfile2.f \
gencw.f getpfx1.f getpfx2.f getsnr.f graycode.f grid2k.f \
interleave63.f k2grid.f limit.f lpf1.f deep65.f morse.f \
nchar.f packcall.f packgrid.f packmsg.f packtext.f setup65.f \
short65.f slope.f spec2d65.f sync65.f unpackcall.f \
unpackgrid.f unpackmsg.f unpacktext.f xcor.f xfft.f xfft2.f wsjt65.f
OBJS2F77 = ${SRCS2F77:.f=.o}
SRCS2C = init_rs.c encode_rs.c decode_rs.c
OBJS2C = ${SRCS2C:.c=.o}
# ok, so far for now
# Windows start_alsa.c will be a2d.f90 jtaudio.c since it uses portaudio
# for *nix start_alsa.c will also be a2d.f90, jtaudio.c
# and start_portaudio.c for systems using portaudio
# for *nix start_alsa.c will be start_alsa.c for alsa
# for *nix start_alsa.c will be start_oss.c for oss
#
# ptt_unix.c vs. ptt.c I'll sort out later.
# ditto for cutil.c (only used on *nix)
# --db
# jtaudio.c/start_threads.c mess will have to be sorted out later
# to minimise #ifdef's
# --db
# and mostly sorted
# --db
#
SRCS3C = ptt_unix.c igray.c wrapkarn.c cutil.c
OBJS3C = ${SRCS3C:.c=.o}
AUDIOSRCS = start_alsa.c
all: wsjt6
JT65code: $(OBJS1)
$(FC) -o JT65code $(OBJS1)
wsjt6: Audio.so #wsjt.spec
# ${PYTHON} c:\python23\installer\Build.py wsjt.spec
# ${RM} wsjt6
#
#
Audio.so: $(OBJS2C) $(OBJS3C) $(OBJS2F77) $(SRCS2F90) $(AUDIOSRCS)
${F2PY} -c --opt="-O ${CFLAGS} -fPIC \
-fno-second-underscore" $(OBJS2C) $(OBJS2F77) -m Audio \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \
only: $(F2PYONLY) \
: $(SRCS2F90) \
${SRCS3C} ${AUDIOSRCS}
wsjt.spec: wsjt.py astro.py g.py options.py palettes.py smeter.py specjt.py
# ${PYTHON} c:\python23\installer\makespec.py --icon wsjt.ico \
# --tk --onefile wsjt.py
.PHONY : clean
clean:
${RM} -f *.o *.so *~ JT65code wsjt6

View File

2
bzap.f
View File

@ -32,7 +32,7 @@ C This is a kludge:
ib=(fzap(izap)+tol)/df
smax=0.
do i=ia+1,ib+1
s=real(c(i))**2 + imag(c(i))**2
s=real(c(i))**2 + aimag(c(i))**2
if(s.gt.smax) then
smax=s
ipk=i

2883
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@ AC_PATH_PROG(LD, ld)
AC_PATH_PROG(TEST, [test], [test])
AC_PATH_PROG(PYTHON, python)
AC_PATH_PROG(F2PY, f2py)
AC_PATH_PROG(G95, g95)
AC_PATH_PROG(G95, gfortran)
AC_MSG_CHECKING([g95 lib path])
G95_LIB_PATH=`${G95} -print-file-name=`
@ -324,7 +324,7 @@ AC_SUBST(LDFLAGS, "${LDFLAGS}")
AC_SUBST(CFLAGS)
AC_OUTPUT
AC_CONFIG_FILES(Makefile)
dnl AC_CONFIG_FILES(Makefile)
dnl do summary

57
cutil.c
View File

@ -1,46 +1,45 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/times.h>
#include <time.h>
#include <sys/time.h>
/* FORTRAN: fd = close(filedes) */
close_(filedes)
int *filedes;
int close_(int *filedes)
{
return(close(*filedes));
}
/* FORTRAN: fd = open(filnam,mode) */
open_(filnam,mode)
char filnam[];
int *mode;
int open_(char filnam[], int *mode)
{
return(open(filnam,*mode));
}
/* FORTRAN: fd = creat(filnam,mode) */
creat_(filnam,mode)
char filnam[];
int *mode;
int creat_(char filnam[],int *mode)
{
return(creat(filnam,*mode));
}
/* FORTRAN: nread = read(fd,buf,n) */
read_(fd,buf,n)
int *fd,*n;
char buf[];
int read_(int *fd, char buf[], int *n)
{
return(read(*fd,buf,*n));
}
/* FORTRAN: nwrt = write(fd,buf,n) */
write_(fd,buf,n)
int *fd,*n;
char buf[];
int write_(int *fd, char buf[], int *n)
{
return(write(*fd,buf,*n));
}
/* FORTRAN: ns = lseek(fd,offset,origin) */
lseek_(fd,offset,origin)
int *fd,*offset,*origin;
int lseek_(int *fd,int *offset, int *origin)
{
return(lseek(*fd,*offset,*origin));
}
/* times(2) */
times_(buf)
int buf[];
int times_(struct tms *buf)
{
return (times(buf));
}
@ -53,34 +52,32 @@ int buf[];
//}
/* usleep(3) */
usleep_(microsec)
unsigned long *microsec;
int usleep_(unsigned long *microsec)
{
return (usleep(*microsec));
}
/* returns random numbers between 0 and 32767 to FORTRAN program */
iran_(arg)
int *arg;
int iran_(int *arg)
{
return (rand());
}
exit_(n)
int *n;
int exit_(int *n)
{
printf("\n\n");
exit(*n);
}
#include <time.h>
time_t time_()
time_t time_(void)
{
return time(0);
}
/* hrtime() */
double hrtime_()
double hrtime_(void)
{
int tv[2],tz[2];
gettimeofday(tv,tz);
return(tv[0]+1.e-6*tv[1]);
struct timeval tv;
struct timezone tz;
gettimeofday(&tv,&tz);
return(tv.tv_sec+1.e-6*tv.tv_usec);
}

View File

@ -24,7 +24,7 @@ c real s2(128,646)
data pua/'0123456789., /#?$ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
data offset/20.6/
ps(zz)=real(zz)**2 + imag(zz)**2 !Power spectrum function
ps(zz)=real(zz)**2 + aimag(zz)**2 !Power spectrum function
C Convert data to baseband (complex result) using quadrature LO.
twopi=8*atan(1.d0)

View File

@ -8,7 +8,7 @@
character*22 decoded,deepmsg
character*22 testmsg(2*MAXCALLS + 2 + MAXRPT)
character*15 callgrid(MAXCALLS)
character*80 line
character*180 line
character*4 rpt(MAXRPT)
logical first
integer ncode(63,2*MAXCALLS)
@ -42,8 +42,12 @@
if(ichar(grid(3:3)).eq.0) grid(3:3)=' '
if(ichar(grid(4:4)).eq.0) grid(4:4)=' '
else
read(23,1002,end=20) line
1002 format(a80)
C read(23,'A80',END=20) line !FIXME: Segfault happened here.
read(23,1002,end=20) line !FIXME: Segfault happened here.
1002 format (A80)
C Probably due to line only being 80 chars long, and the read not
C limiting the read.
C 1002 format(A80)
if(line(1:2).eq.'//') go to 10
i1=index(line,',')
if(i1.lt.4) go to 10

View File

@ -19,10 +19,10 @@ C Compute powers at the tone frequencies using 1-sample steps.
csum=csum+c(i)
enddo
y(1)=real(csum)**2 + imag(csum)**2
y(1)=real(csum)**2 + aimag(csum)**2
do i=2,npts-(NSPD-1)
csum=csum-c(i-1)+c(i+NSPD-1)
y(i)=real(csum)**2 + imag(csum)**2
y(i)=real(csum)**2 + aimag(csum)**2
enddo
return

5
fivehz.h Normal file
View File

@ -0,0 +1,5 @@
#include <inttypes.h>
void addnoise_(int16_t *n2);
void fivehztx_(void);
void fivehz_(void);

View File

@ -2,8 +2,8 @@
!---------------------------------------------------------------------------
integer NRXMAX !Max length of Rx ring buffers
integer NTXMAX !Max length of Tx waveform in samples
parameter(NRXMAX=2048*1024)
parameter(NTXMAX=150*11025)
parameter(NRXMAX=2097152) ! =2048*1024
parameter(NTXMAX=1653750) ! =150*11025
real*8 tbuf !Tsec at time of input callback SoundIn
integer ntrbuf !(obsolete?)
real*8 Tsec !Present time SoundIn,SoundOut

View File

@ -6,7 +6,7 @@ subroutine getfile(fname,len)
use dflib
#endif
parameter (NDMAX=60*11025)
parameter (NDMAX=661500) ! =60*11025
character*(*) fname
include 'gcom1.f90'
include 'gcom2.f90'

View File

@ -39,7 +39,7 @@ subroutine horizspec(x,brightness,contrast,a)
call xfft2(y,nfft)
nq=nfft/4
do i=1,nq
ss(i)=real(c(i))**2 + imag(c(i))**2
ss(i)=real(c(i))**2 + aimag(c(i))**2
enddo
p=0.

2
ps.f
View File

@ -16,7 +16,7 @@
call xfft(x,nfft)
fac=1.0/nfft
do i=1,nh
s(i)=fac*(real(c(i))**2 + imag(c(i))**2)
s(i)=fac*(real(c(i))**2 + aimag(c(i))**2)
enddo
return

View File

@ -63,15 +63,18 @@ int fd; /* Used for both serial and parallel */
#define TTYNAME "/dev/cuad%d" /* Use non blocking form */
#else
#include <sys/io.h>
#define TTYNAME "/dev/ttyS%d"
#define TTYNAME "/dev/ttyUSB%d"
#endif
/* Not quite right for size but '%d + 1' should be plenty enough -db */
#define TTYNAME_SIZE sizeof(TTYNAME)+1
/* As TTYNAME is a string, just at 20 chars do udevd is happier. */
/* E.g. USB serial ports appear as /dev/ttyUSB0 */
#define TTYNAME_SIZE sizeof(TTYNAME)+20
int
ptt_(int *nport, int *ntx, int *iptt)
{
/* Fixme, nport should be a sting and not a number */
static int nopen=0;
int control = TIOCM_RTS | TIOCM_DTR;
@ -87,6 +90,7 @@ ptt_(int *nport, int *ntx, int *iptt)
s[TTYNAME_SIZE] = '\0';
/* open the device */
printf("Opening %s\n", s);
if ((fd = open(s, O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "Can't open %s.\n", s);
return(1);

View File

@ -52,13 +52,17 @@ C Determine the reference symbols for each data symbol.
m=mdat(k)
mref(k,1)=mr1
do n=1,10 !Get ref symbol before data
if((m-n.gt.0) .and. pr(m-n).gt.0.0) go to 10
if((m-n).gt.0) then
if (pr(m-n).gt.0.0) go to 10
endif
enddo
go to 12
10 mref(k,1)=m-n
12 mref(k,2)=mr2
do n=1,10 !Get ref symbol after data
if((m+n).le.nsym .and. pr(m+n).gt.0.0) go to 20
if((m+n).le.nsym) then
if (pr(m+n).gt.0.0) go to 20
endif
enddo
go to 22
20 mref(k,2)=m+n
@ -82,13 +86,17 @@ C Now do it all again, using opposite logic on pr(i)
m=mdat2(k)
mref2(k,1)=mr1
do n=1,10
if((m-n.gt.0) .and. pr(m-n).lt.0.0) go to 110
if((m-n).gt.0) then
if (pr(m-n).lt.0.0) go to 110
endif
enddo
go to 112
110 mref2(k,1)=m-n
112 mref2(k,2)=mr2
do n=1,10
if((m+n).le.nsym .and. pr(m+n).lt.0.0) go to 120
if((m+n).le.nsym) then
if (pr(m+n).lt.0.0) go to 120
endif
enddo
go to 122
120 mref2(k,2)=m+n

View File

@ -141,7 +141,7 @@ subroutine spec(brightness,contrast,logmap,ngain,nspeed,a)
call xfft2(x,nfft)
do i=1,nq !Accumulate power spectrum
ss(i)=ss(i) + real(c(i))**2 + imag(c(i))**2
ss(i)=ss(i) + real(c(i))**2 + aimag(c(i))**2
enddo
nsum=nsum+1

View File

@ -34,14 +34,14 @@ C bins are shifted down 5 bins from their natural positions.
sum=0.
do i=1,NQ
s2(i,n)=real(c(5+i))**2 + imag(c(5+i))**2
s2(i,n)=real(c(5+i))**2 + aimag(c(5+i))**2
sum=sum+s2(i,n)
enddo
s(n)=sum/NQ
C Accumulate average spectrum for the whole file.
do i=1,nh
psavg0(i) = psavg0(i)+ real(c(i))**2 + imag(c(i))**2
psavg0(i) = psavg0(i)+ real(c(i))**2 + aimag(c(i))**2
enddo
enddo

View File

@ -43,7 +43,7 @@ C Mix sync tone down to f=5*df (==> bin 6 of array cx, after FFT)
call four2a(cx,nfft,1,-1,1)
do i=1,77
s(i)=s(i) + real(cx(i))**2 + imag(cx(i))**2
s(i)=s(i) + real(cx(i))**2 + aimag(cx(i))**2
enddo
else

View File

@ -18,7 +18,7 @@ C Returns spectral array and frequency of peak value.
call move(dat(j),x,NFFT)
call xfft(x,NFFT)
do i=1,NH
s(i)=s(i)+real(c(i))**2 + imag(c(i))**2
s(i)=s(i)+real(c(i))**2 + aimag(c(i))**2
enddo
enddo

View File

@ -19,7 +19,7 @@ c = -1 means sort x in decreasing order (ignoring y)
c = -2 means sort x in decreasing order and carry y along.
integer kflag, n
real x(*), y(*)
real x(n), y(n)
real r, t, tt, tty, ty
integer i, ij, j, k, kk, l, m, nn
integer il(21), iu(21)

View File

@ -4,9 +4,13 @@
#include <alsa/asoundlib.h>
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
#include "fivehz.h"
#if 0
#if 1
#define ALSA_LOG
#endif
#if 0
#define ALSA_LOG_BUFFERS
#endif
#if 0
@ -22,7 +26,7 @@ typedef struct alsa_driver_s {
int open_mode;
int has_pause_resume;
int is_paused;
int32_t output_sample_rate, input_sample_rate;
uint32_t output_sample_rate, input_sample_rate;
double sample_rate_factor;
uint32_t num_channels;
uint32_t bits_per_sample;
@ -75,7 +79,7 @@ static int ao_alsa_open(alsa_driver_t *this_gen, int32_t *input_rate, snd_pcm_st
int err, dir;
int open_mode=1; /* NONBLOCK */
/* int open_mode=0; BLOCK */
int32_t rate=*input_rate;
uint32_t rate=*input_rate;
this->input_sample_rate=*input_rate;
snd_pcm_hw_params_alloca(&params);
@ -83,7 +87,12 @@ static int ao_alsa_open(alsa_driver_t *this_gen, int32_t *input_rate, snd_pcm_st
err = snd_output_stdio_attach(&jcd_out, stdout, 0);
this->num_channels = 2;
pcm_device="default";
if (direction == SND_PCM_STREAM_PLAYBACK) {
pcm_device="plug:front";
} else {
pcm_device="default";
}
#ifdef ALSA_LOG
printf("audio_alsa_out: Audio Device name = %s\n",pcm_device);
printf("audio_alsa_out: Number of channels = %d\n",this->num_channels);
@ -114,8 +123,8 @@ static int ao_alsa_open(alsa_driver_t *this_gen, int32_t *input_rate, snd_pcm_st
*/
err = snd_pcm_hw_params_any(this->audio_fd, params);
if (err < 0) {
printf ("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n"),
snd_strerror(err);
printf ("audio_alsa_out: broken configuration for this PCM: no configurations available: %s\n",
snd_strerror(err));
goto close;
}
/* set interleaved access */
@ -378,7 +387,7 @@ int playback_callback(alsa_driver_t *alsa_driver_playback) {
result = snd_pcm_writen(this->audio_fd, alsa_playback_buffers, this->period_size);
this->tx_offset += this->period_size;
if (result != this->period_size) {
printf("Playback write failed. Expected %d samples, sent only %d\n", this->period_size, result);
printf("Playback write failed. Expected %lu samples, sent only %d\n", this->period_size, result);
#ifdef ALSA_PLAYBACK_LOG
snd_pcm_status_t *pcm_stat;
snd_pcm_status_alloca(&pcm_stat);
@ -387,6 +396,7 @@ int playback_callback(alsa_driver_t *alsa_driver_playback) {
#endif
}
fivehztx_(); //Call fortran routine
return result;
}
int capture_callback(alsa_driver_t *alsa_driver_capture) {
@ -431,6 +441,7 @@ int capture_callback(alsa_driver_t *alsa_driver_capture) {
snd_pcm_status_dump(pcm_stat, jcd_out);
#endif
fivehz_(); //Call fortran routine
return result;
}
int playback_xrun(alsa_driver_t *alsa_driver_playback) {
@ -441,6 +452,7 @@ int playback_xrun(alsa_driver_t *alsa_driver_playback) {
snd_pcm_status(this->audio_fd, pcm_stat);
snd_pcm_status_dump(pcm_stat, jcd_out);
snd_pcm_prepare(this->audio_fd);
return 0;
}
int capture_xrun(alsa_driver_t *alsa_driver_capture) {
@ -450,6 +462,7 @@ int capture_xrun(alsa_driver_t *alsa_driver_capture) {
printf("capture xrun\n");
snd_pcm_status(this->audio_fd, pcm_stat);
snd_pcm_status_dump(pcm_stat, jcd_out);
return 0;
}
void ao_alsa_loop(void *iarg) {
@ -478,9 +491,9 @@ void ao_alsa_loop(void *iarg) {
capture_index = nfds;
nfds += capture_nfds;
while(1) {
if (poll (pfd, nfds, 100000) < 0) {
if (poll (pfd, nfds, 200000) < 0) {
printf("poll failed\n");
return;
continue;
}
snd_pcm_poll_descriptors_revents(alsa_driver_playback.audio_fd, &pfd[0], playback_nfds, &playback_revents);
snd_pcm_poll_descriptors_revents(alsa_driver_capture.audio_fd, &pfd[capture_index], capture_nfds, &capture_revents);
@ -506,7 +519,7 @@ void ao_alsa_loop(void *iarg) {
return;
}
extern void decode1_(int *iarg);
void decode1_(void *iarg);
int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
int *nbuflen, int *iwrite, short iwave[],
@ -517,7 +530,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
{
pthread_t thread1,thread2;
int iret1,iret2;
int iarg1 = 1,iarg2 = 2;
int iarg1 = 1;
//int32_t rate=11025;
int32_t rate=*nfsample;
alsa_driver_capture.app_buffer_y1 = y1;
@ -537,7 +550,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
alsa_driver_playback.transmitting = Transmitting;
alsa_driver_playback.ndsec = ndsec;
// printf("start_threads: creating thread for decode1\n");
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);
iret1 = pthread_create(&thread1,NULL,(void*)&decode1_,&iarg1);
/* Open audio card. */
printf("Using ALSA sound.\n");
ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK);
@ -546,9 +559,10 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
/*
* Start audio io thread
*/
iret2 = pthread_create(&thread2, NULL, ao_alsa_loop, NULL);
iret2 = pthread_create(&thread2, NULL, (void *)&ao_alsa_loop, NULL);
snd_pcm_prepare(alsa_driver_capture.audio_fd);
snd_pcm_start(alsa_driver_capture.audio_fd);
snd_pcm_prepare(alsa_driver_playback.audio_fd);
//snd_pcm_start(alsa_driver_playback.audio_fd);
return 0;
}

10
sync.f
View File

@ -2,13 +2,15 @@
C Input data are in the y# arrays: detected sigs in four tone-channels,
C before decimation by NSPD.
parameter (NSPD=25)
real y1(npts)
real y2(npts)
real y3(npts)
real y4(npts)
real zf(NSPD)
real tmp1
real tmp2
complex csum
integer nsum(NSPD)
real z(65538) !Ready for FSK110
@ -51,7 +53,7 @@ C Now find the apparent baud rate.
ia=391.0/df !Was 341/df
ib=491.0/df !Was 541/df
do i=ia,ib
z(i)=real(cz(i))**2 + imag(cz(i))**2
z(i)=real(cz(i))**2 + aimag(cz(i))**2
if(z(i).gt.zmax) then
zmax=z(i)
baud=df*i
@ -64,7 +66,9 @@ C Find phase of signal at 441 Hz.
pha=j*twopi/NSPD
csum=csum+zf(j)*cmplx(cos(pha),-sin(pha))
enddo
pha=-atan2(imag(csum),real(csum))
tmp1=aimag(csum)
tmp2=real(csum)
pha=-atan2(tmp1,tmp2)
jpk=nint(NSPD*pha/twopi)
if(jpk.lt.1) jpk=jpk+NSPD

View File

@ -10,7 +10,7 @@ C Finds sync tone and determines aproximate values for jstart and f0.
complex z
equivalence (x,cx)
ps(z)=real(z)**2 + imag(z)**2 !Power spectrum function
ps(z)=real(z)**2 + aimag(z)**2 !Power spectrum function
call zero(s2,6*128) !Clear average
df=11025./512.

View File

@ -17,7 +17,7 @@ C Returns a refined value of f0, the sync-tone frequency.
complex z
equivalence (x,c)
ps(z)=real(z)**2 + imag(z)**2 !Power spectrum ASF
ps(z)=real(z)**2 + aimag(z)**2 !Power spectrum ASF
C Accumulate a high-resolution average spectrum
df=11025.0/NFFT

View File

@ -10,7 +10,7 @@ C Gets a refined value of jstart.
complex c,c1,zz
common/hcom/c(NMAX)
ps(zz)=real(zz)**2 + imag(zz)**2 !Power spectrum function
ps(zz)=real(zz)**2 + aimag(zz)**2 !Power spectrum function
C Convert data to baseband (complex result) using quadrature LO.
twopi=8*atan(1.d0)

17
wsjt.py
View File

@ -1,4 +1,4 @@
#------------------------------------------------------------------ WSJT
#------------------------------------------------------------------- WSJT
from Tkinter import *
from tkFileDialog import *
import Pmw
@ -1279,13 +1279,14 @@ def update():
azdist()
g.nfreq=nfreq.get()
g.AzSun,g.ElSun,g.AzMoon,g.ElMoon,g.AzMoonB,g.ElMoonB,g.ntsky, \
g.ndop,g.ndop00,g.dbMoon,g.RAMoon,g.DecMoon,g.HA8,g.Dgrd, \
g.sd,g.poloffset,g.MaxNR,g.dfdt,g.dfdt0,g.RaAux,g.DecAux, \
g.AzAux,g.ElAux = Audio.astro0(utc[0],utc[1],utc[2], \
utchours,nfreq.get(),options.MyGrid.get().upper(), \
options.auxra.get()+' '[:9], \
options.auxdec.get()+' '[:9])
if Audio.gcom2.ndecoding==0:
g.AzSun,g.ElSun,g.AzMoon,g.ElMoon,g.AzMoonB,g.ElMoonB,g.ntsky, \
g.ndop,g.ndop00,g.dbMoon,g.RAMoon,g.DecMoon,g.HA8,g.Dgrd, \
g.sd,g.poloffset,g.MaxNR,g.dfdt,g.dfdt0,g.RaAux,g.DecAux, \
g.AzAux,g.ElAux = Audio.astro0(utc[0],utc[1],utc[2], \
utchours,nfreq.get(),options.MyGrid.get().upper(), \
options.auxra.get()+' '[:9], \
options.auxdec.get()+' '[:9])
if mode.get()[:4]=='JT65' or mode.get()[:2]=='CW' :
graph2.delete(ALL)

View File

View File

@ -12,7 +12,7 @@ subroutine wsjtgen
parameter (NMSGMAX=28) !Max characters per message
parameter (NSPD=25) !Samples per dit
parameter (NDPC=3) !Dits per character
parameter (NWMAX=60*11025) !Max length of waveform
parameter (NWMAX=661500) !Max length of waveform = 60*11025
parameter (NTONES=4) !Number of FSK tones
integer itone(84)
@ -74,10 +74,13 @@ subroutine wsjtgen
go to 999
14 read(18) hdr
if(ndata.gt.NTxMax) ndata=NTxMax
nwave=ndata
call rfile(18,iwave,2*nwave,ierr)
call rfile(18,iwave,ndata,ierr)
close(18)
if(ierr.ne.0) print*,'Error reading test file ',msg(2:)
nwave=ndata/2
do i=nwave,NTXMAX
iwave(i)=0
enddo
endif
go to 999
endif