Initial release

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@586 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.2
Stéphane Fillod, F8CFE 2001-07-14 16:45:40 +00:00
rodzic a273617c2c
commit 74a83db752
10 zmienionych plików z 1873 dodań i 0 usunięć

12
tentec/Makefile.am 100644
Wyświetl plik

@ -0,0 +1,12 @@
TENTECSRCLIST = rx320.c
lib_LTLIBRARIES = libhamlib-tentec.la
libhamlib_tentec_la_SOURCES = $(TENTECSRCLIST) tentec.c
libhamlib_tentec_la_LDFLAGS = -no-undefined -module -avoid-version
libhamlib_tentec_la_LIBADD = ../src/libhamlib.la
lib_LIBRARIES = libhamlib-tentec.a
libhamlib_tentec_a_SOURCES = $(TENTECSRCLIST) tentec.c
libhamlib_tentec_a_LIBADD = ../src/libhamlib.la
noinst_HEADERS = tentec.h

423
tentec/Makefile.in 100644
Wyświetl plik

@ -0,0 +1,423 @@
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AR = @AR@
AS = @AS@
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@
DLL_PRELOAD = @DLL_PRELOAD@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
INCLTDL = @INCLTDL@
INCLUDES = @INCLUDES@
LIBHAMLIBTCL = @LIBHAMLIBTCL@
LIBLTDL = @LIBLTDL@
LIBOBJS = @LIBOBJS@
LIBTOOL = @LIBTOOL@
LIBWINRADIO = @LIBWINRADIO@
LN_S = @LN_S@
LTHAMLIBTCL = @LTHAMLIBTCL@
LTLIBWINRADIO = @LTLIBWINRADIO@
MAKEINFO = @MAKEINFO@
NET = @NET@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
RIGMATRIX = @RIGMATRIX@
STRIP = @STRIP@
VERSION = @VERSION@
V_MAJOR = @V_MAJOR@
V_MINOR = @V_MINOR@
WINDRES = @WINDRES@
WINRADIODEPS = @WINRADIODEPS@
WINRADIOLNK = @WINRADIOLNK@
hamlibdocdir = @hamlibdocdir@
TENTECSRCLIST = rx320.c
lib_LTLIBRARIES = libhamlib-tentec.la
libhamlib_tentec_la_SOURCES = $(TENTECSRCLIST) tentec.c
libhamlib_tentec_la_LDFLAGS = -no-undefined -module -avoid-version
libhamlib_tentec_la_LIBADD = ../src/libhamlib.la
lib_LIBRARIES = libhamlib-tentec.a
libhamlib_tentec_a_SOURCES = $(TENTECSRCLIST) tentec.c
libhamlib_tentec_a_LIBADD = ../src/libhamlib.la
noinst_HEADERS = tentec.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(lib_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libhamlib_tentec_a_DEPENDENCIES = ../src/libhamlib.la
libhamlib_tentec_a_OBJECTS = rx320.$(OBJEXT) tentec.$(OBJEXT)
LTLIBRARIES = $(lib_LTLIBRARIES)
libhamlib_tentec_la_DEPENDENCIES = ../src/libhamlib.la
libhamlib_tentec_la_OBJECTS = rx320.lo tentec.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/rx320.P .deps/tentec.P
SOURCES = $(libhamlib_tentec_a_SOURCES) $(libhamlib_tentec_la_SOURCES)
OBJECTS = $(libhamlib_tentec_a_OBJECTS) $(libhamlib_tentec_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu tentec/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLIBRARIES:
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
distclean-libLIBRARIES:
maintainer-clean-libLIBRARIES:
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
@$(POST_INSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \
$(RANLIB) $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LIBRARIES)'; for p in $$list; do \
rm -f $(DESTDIR)$(libdir)/$$p; \
done
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libhamlib-tentec.a: $(libhamlib_tentec_a_OBJECTS) $(libhamlib_tentec_a_DEPENDENCIES)
-rm -f libhamlib-tentec.a
$(AR) cru libhamlib-tentec.a $(libhamlib_tentec_a_OBJECTS) $(libhamlib_tentec_a_LIBADD)
$(RANLIB) libhamlib-tentec.a
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
libhamlib-tentec.la: $(libhamlib_tentec_la_OBJECTS) $(libhamlib_tentec_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libhamlib_tentec_la_LDFLAGS) $(libhamlib_tentec_la_OBJECTS) $(libhamlib_tentec_la_LIBADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = tentec
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tentec/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLIBRARIES install-libLTLIBRARIES
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLIBRARIES uninstall-libLTLIBRARIES
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-libLTLIBRARIES \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-libLIBRARIES clean-compile clean-libtool \
clean-libLTLIBRARIES clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-libLIBRARIES distclean-compile \
distclean-libtool distclean-libLTLIBRARIES \
distclean-tags distclean-depend distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-libLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \
clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \
install-libLIBRARIES mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile mostlyclean-libtool \
distclean-libtool clean-libtool maintainer-clean-libtool \
mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

148
tentec/rx320.c 100644
Wyświetl plik

@ -0,0 +1,148 @@
/*
* Hamlib TEnTenc backend - RX-320 PC-Radio capabilities
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: rx320.c,v 1.1 2001-07-14 16:42:48 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include "tentec.h"
#define RX320_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB)
#define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_STRENGTH)
#define RX320_VFO (RIG_VFO_A)
/*
* a bit coarse, but I don't have a RX320, and the manual is not
* verbose on the subject. Please test it and report! --SF
*/
#define RX320_STR_CAL { 2, { \
{ 0, -60 }, \
{ 10000, 20 }, \
} }
static const struct tentec_priv_caps rx320_priv_caps = {
RX320_STR_CAL
};
/*
* rx320 receiver capabilities.
*
* protocol is documented at
* http://www.tentec.com/rx320prg.zip
*
* TODO:
*/
const struct rig_caps rx320_caps = {
rig_model: RIG_MODEL_RX320,
model_name:"RX-320",
mfg_name: "Ten-Tec",
version: "0.1",
copyright: "LGPL",
status: RIG_STATUS_UNTESTED,
rig_type: RIG_TYPE_PCRECEIVER,
ptt_type: RIG_PTT_NONE,
dcd_type: RIG_DCD_NONE,
port_type: RIG_PORT_SERIAL,
serial_rate_min: 1200,
serial_rate_max: 1200,
serial_data_bits: 8,
serial_stop_bits: 1,
serial_parity: RIG_PARITY_NONE,
serial_handshake: RIG_HANDSHAKE_NONE,
write_delay: 0,
post_write_delay: 0,
timeout: 200,
retry: 3,
has_get_func: RIG_FUNC_NONE,
has_set_func: RIG_FUNC_NONE,
has_get_level: RX320_LEVELS,
has_set_level: RIG_LEVEL_SET(RX320_LEVELS),
has_get_parm: RIG_PARM_NONE,
has_set_parm: RIG_PARM_NONE,
level_gran: {}, /* FIXME: granularity */
parm_gran: {},
ctcss_list: NULL,
dcs_list: NULL,
preamp: { RIG_DBLST_END },
attenuator: { RIG_DBLST_END },
max_rit: Hz(0),
max_xit: Hz(0),
max_ifshift: Hz(0),
targetable_vfo: 0,
transceive: RIG_TRN_OFF,
bank_qty: 0,
chan_desc_sz: 0,
chan_list: {
RIG_CHAN_END,
},
rx_range_list1: { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
tx_range_list1: { RIG_FRNG_END, },
rx_range_list2: {
{kHz(100),MHz(30),RX320_MODES,-1,-1,RX320_VFO},
RIG_FRNG_END,
},
tx_range_list2: { RIG_FRNG_END, },
tuning_steps: {
{RX320_MODES,10}, /* FIXME: add other ts */
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
filters: {
{RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)},
{RIG_MODE_AM, kHz(6)},
RIG_FLT_END,
},
priv: (void*)&rx320_priv_caps,
rig_init: tentec_init,
rig_cleanup: tentec_cleanup,
set_freq: tentec_set_freq,
get_freq: tentec_get_freq,
set_mode: tentec_set_mode,
get_mode: tentec_get_mode,
set_level: tentec_set_level,
get_level: tentec_get_level,
get_info: tentec_get_info,
};
/*
* Function definitions below
*/

454
tentec/tentec.c 100644
Wyświetl plik

@ -0,0 +1,454 @@
/*
* Hamlib Tentec backend - main file
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: tentec.c,v 1.1 2001-07-14 16:42:48 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <math.h>
#if defined(__CYGWIN__)
# undef HAMLIB_DLL
# include <hamlib/rig.h>
# include <serial.h>
# include <misc.h>
# include <cal.h>
# define HAMLIB_DLL
# include <hamlib/rig_dll.h>
#else
# include <hamlib/rig.h>
# include <serial.h>
# include <misc.h>
# include <cal.h>
#endif
#include "tentec.h"
static void tentec_tuning_factor_calc(RIG *rig);
#define EOM "\015" /* CR */
#define TT_AM '0'
#define TT_USB '1'
#define TT_LSB '2'
#define TT_CW '3'
#define TT_FM '4'
static int tentec_filters[] = {
6000,5700,5400,5100,4800,4500,4200,3900,3600,3300,3000,2850,2700,2550,2400,
2250,2100,1950,1800,
1650,1500,1350,1200,1050, 900, 750, 675, 600, 525, 450, 375, 330, 300,8000
};
/*
* tentec_transaction
* read exactly data_len bytes
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
{
int i, count, retval;
struct rig_state *rs;
rs = &rig->state;
retval = write_block(&rs->rigport, cmd, cmd_len);
if (retval != RIG_OK)
return retval;
/* no data expected, TODO: flush input? */
if (!data || !data_len)
return 0;
/*
* buffered read are quite helpful here!
* However, an automate with a state model would be more efficient..
*/
i = 0;
do {
count = fread_block(&rs->rigport, data+i, 1);
if (count > 0)
i += count;
else if (count < 0)
return count;
} while (i < *data_len);
*data_len = i;
return RIG_OK;
}
/*
* tentec_init:
* Basically, it just sets up *priv
*/
int tentec_init(RIG *rig)
{
struct tentec_priv_data *priv;
struct tentec_priv_caps *priv_caps;
priv = (struct tentec_priv_data*)malloc(sizeof(struct tentec_priv_data));
if (!priv) {
/* whoops! memory shortage! */
return -RIG_ENOMEM;
}
priv_caps = (struct tentec_priv_caps *)rig->caps->priv;
memset(priv, 0, sizeof(struct tentec_priv_data));
/*
* set arbitrary initial status
*/
priv->freq = MHz(145);
priv->mode = RIG_MODE_AM;
priv->width = kHz(6);
priv->cwbfo = 0;
priv->agc = 0.5; /* medium */
priv->lnvol = priv->spkvol = 0.0; /* mute */
tentec_tuning_factor_calc(rig);
memcpy(&priv->str_cal, &priv_caps->str_cal, sizeof(cal_table_t));
rig->state.priv = (rig_ptr_t)priv;
return RIG_OK;
}
/*
* Tentec generic tentec_cleanup routine
* the serial port is closed by the frontend
*/
int tentec_cleanup(RIG *rig)
{
if (rig->state.priv)
free(rig->state.priv);
rig->state.priv = NULL;
return RIG_OK;
}
/*
* Tuning Factor Calculations
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes priv->mode in supported modes.
*/
static void tentec_tuning_factor_calc(RIG *rig)
{
struct tentec_priv_data *priv;
double tfreq, adjtfreq, mcor, fcor;
priv = (struct tentec_priv_data *)rig->state.priv;
switch (priv->mode) {
case RIG_MODE_AM:
case RIG_MODE_FM:
mcor=0; break;
case RIG_MODE_CW:
case RIG_MODE_LSB:
mcor=-1; break;
case RIG_MODE_USB:
mcor=1; break;
default:
rig_debug(RIG_DEBUG_BUG,
"tentec_tuning_factor_calc: invalid mode!\n");
mcor=1;
}
tfreq = priv->freq/(double)MHz(1);
fcor = priv->width/2.0+200;
adjtfreq = tfreq - 0.00125 + (mcor*((fcor+priv->cwbfo)/1000000));
priv->ctf = floor(adjtfreq*400);
priv->ftf = floor(((adjtfreq*400) - priv->ctf)*2500*5.46);
priv->ctf += 18000;
priv->btf = floor((fcor + priv->cwbfo + 8000)*2.73);
}
/*
* tentec_set_freq
* assumes rig!=NULL, rig->state.priv!=NULL
* assumes priv->mode in AM,CW,LSB or USB.
*/
int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct tentec_priv_data *priv;
struct rig_state *rs = &rig->state;
int freq_len, retval;
char freqbuf[16];
priv = (struct tentec_priv_data *)rig->state.priv;
tentec_tuning_factor_calc(rig);
freq_len = sprintf(freqbuf, "N%c%c%c%c%c%c" EOM,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff);
retval = write_block(&rs->rigport, freqbuf, freq_len);
if (retval != RIG_OK)
return retval;
priv->freq = freq;
return RIG_OK;
}
/*
* tentec_get_freq
* Assumes rig!=NULL, freq!=NULL
*/
int tentec_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
*freq = priv->freq;
return RIG_OK;
}
/*
* tentec_set_mode
* Assumes rig!=NULL
*/
int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
char ttmode;
rmode_t saved_mode;
pbwidth_t saved_width;
int mdbuf_len, ttfilter, retval;
char mdbuf[32];
switch (mode) {
case RIG_MODE_USB: ttmode = TT_USB; break;
case RIG_MODE_LSB: ttmode = TT_LSB; break;
case RIG_MODE_CW: ttmode = TT_CW; break;
case RIG_MODE_AM: ttmode = TT_AM; break;
case RIG_MODE_FM: ttmode = TT_FM; break;
default:
rig_debug(RIG_DEBUG_ERR,
"tentec_set_mode: unsupported mode %d\n",
mode);
return -RIG_EINVAL;
}
if (width == RIG_PASSBAND_NORMAL)
width = rig_passband_normal(rig, mode);
for (ttfilter=0; tentec_filters[ttfilter] != 0; ttfilter++) {
if (tentec_filters[ttfilter] == width)
break;
}
if (tentec_filters[ttfilter] != width) {
rig_debug(RIG_DEBUG_ERR,
"tentec_set_mode: unsupported width %d\n",
width);
return -RIG_EINVAL;
}
/* backup current values
* in case we fail to write to port
*/
saved_mode = priv->mode;
saved_width = priv->width;
priv->mode = mode;
priv->width = width;
tentec_tuning_factor_calc(rig);
mdbuf_len = sprintf(mdbuf, "W%c" EOM
"N%c%c%c%c%c%c" EOM
"M%c" EOM,
ttfilter,
priv->ctf >> 8, priv->ctf & 0xff,
priv->ftf >> 8, priv->ftf & 0xff,
priv->btf >> 8, priv->btf & 0xff,
ttmode);
retval = write_block(&rs->rigport, mdbuf, mdbuf_len);
if (retval != RIG_OK) {
priv->mode = saved_mode;
priv->width = saved_width;
return retval;
}
return RIG_OK;
}
/*
* tentec_get_mode
* Assumes rig!=NULL, mode!=NULL
*/
int tentec_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
*mode = priv->mode;
*width = priv->width;
return RIG_OK;
}
/*
* tentec_set_level
* Assumes rig!=NULL
* FIXME: cannot support PREAMP and ATT both at same time (make sens though)
*/
int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
struct rig_state *rs = &rig->state;
int cmd_len, retval;
char cmdbuf[32];
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (level) {
case RIG_LEVEL_AGC:
cmd_len = sprintf(cmdbuf, "G%c" EOM, val.f<0.4 ? '1' : (
val.f>0.6 ? '3' : '2') );
retval = write_block(&rs->rigport, cmdbuf, cmd_len);
if (retval == RIG_OK)
priv->agc = val.f;
return retval;
case RIG_LEVEL_AF:
/* FIXME: support also separate Lineout setting
* -> need to create RIG_LEVEL_LINEOUT ?
*/
cmd_len = sprintf(cmdbuf, "C%c%c" EOM, 0, (int)rint(val.f*63));
retval = write_block(&rs->rigport, cmdbuf, cmd_len);
if (retval == RIG_OK)
priv->lnvol = priv->spkvol = val.f;
return retval;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level);
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* tentec_get_level
* Assumes rig!=NULL, val!=NULL
*/
int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct tentec_priv_data *priv = (struct tentec_priv_data *)rig->state.priv;
int retval, lvl_len;
char lvlbuf[32];
/* Optimize:
* sort the switch cases with the most frequent first
*/
switch (level) {
case RIG_LEVEL_STRENGTH:
/* read A/D converted value */
lvl_len = 4;
retval = tentec_transaction (rig, "X" EOM, 2, lvlbuf, &lvl_len);
if (retval != RIG_OK)
return retval;
if (lvl_len != 4) {
rig_debug(RIG_DEBUG_ERR,"tentec_get_level: wrong answer"
"len=%d\n", lvl_len);
return -RIG_ERJCTED;
}
lvlbuf[4] = '\0';
val->i = rig_raw2val((lvlbuf[1]<<8) + lvlbuf[1], &priv->str_cal);
break;
case RIG_LEVEL_AGC:
val->f = priv->agc;
break;
case RIG_LEVEL_AF:
val->f = priv->spkvol;
break;
default:
rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d\n", level);
return -RIG_EINVAL;
}
return RIG_OK;
}
/*
* tentec_get_info
* Assumes rig!=NULL
*/
const char *tentec_get_info(RIG *rig)
{
static char buf[100]; /* FIXME: reentrancy */
int firmware_len, retval;
/*
* protocol version
*/
firmware_len = 7;
retval = tentec_transaction (rig, "?" EOM, 2, buf, &firmware_len);
if (retval != RIG_OK || firmware_len != 7) {
rig_debug(RIG_DEBUG_ERR,"tentec_get_info: ack NG, len=%d\n",
firmware_len);
return NULL;
}
return buf;
}
/*
* init_tentec is called by rig_backend_load
*/
int init_tentec(void *be_handle)
{
rig_debug(RIG_DEBUG_VERBOSE, "tentec: _init called\n");
rig_register(&rx320_caps);
return RIG_OK;
}

75
tentec/tentec.h 100644
Wyświetl plik

@ -0,0 +1,75 @@
/*
* Hamlib Tentec backend - main header
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: tentec.h,v 1.1 2001-07-14 16:42:48 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _TENTEC_H
#define _TENTEC_H 1
#if defined(__CYGWIN__)
# undef HAMLIB_DLL
# include <hamlib/rig.h>
# include <cal.h>
# define HAMLIB_DLL
# include <hamlib/rig_dll.h>
#else
# include <hamlib/rig.h>
# include <cal.h>
#endif
struct tentec_priv_caps {
cal_table_t str_cal;
};
struct tentec_priv_data {
rmode_t mode; /* detection mode */
freq_t freq; /* tuned frequency */
pbwidth_t width; /* filter bandwidth in Hz */
int cwbfo; /* BFO frequency: 0 [0-2000Hz] */
float lnvol; /* line-out volume: 30 [0..63] */
float spkvol; /* speaker volume: 30 [0..63] */
float agc; /* AGC: medium*/
/* calculated by tentec_tuning_factor_calc() */
int ctf; /* Coarse Tune Factor */
int ftf; /* Fine Tune Factor */
int btf; /* Bfo Tune Factor, btval is ignored by RX-320 in AM MODE */
/* S-meter calibration data */
cal_table_t str_cal;
};
int tentec_init(RIG *rig);
int tentec_cleanup(RIG *rig);
int tentec_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int tentec_get_freq(RIG *rig, vfo_t vfo, freq_t *freq);
int tentec_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width);
int tentec_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width);
int tentec_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val);
int tentec_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val);
const char* tentec_get_info(RIG *rig);
extern const struct rig_caps rx320_caps;
extern HAMLIB_EXPORT(int) init_tentec(void *be_handle);
#endif /* _TENTEC_H */

12
uniden/Makefile.am 100644
Wyświetl plik

@ -0,0 +1,12 @@
UNIDENSRC = bc895.c
lib_LTLIBRARIES = libhamlib-uniden.la
libhamlib_uniden_la_SOURCES = $(UNIDENSRC) uniden.c
libhamlib_uniden_la_LDFLAGS = -no-undefined -module -avoid-version
libhamlib_uniden_la_LIBADD = ../src/libhamlib.la
lib_LIBRARIES = libhamlib-uniden.a
libhamlib_uniden_a_SOURCES = $(UNIDENSRC) uniden.c
libhamlib_uniden_a_LIBADD = ../src/libhamlib.la
noinst_HEADERS = uniden.h

423
uniden/Makefile.in 100644
Wyświetl plik

@ -0,0 +1,423 @@
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AR = @AR@
AS = @AS@
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@
DLL_PRELOAD = @DLL_PRELOAD@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
INCLTDL = @INCLTDL@
INCLUDES = @INCLUDES@
LIBHAMLIBTCL = @LIBHAMLIBTCL@
LIBLTDL = @LIBLTDL@
LIBOBJS = @LIBOBJS@
LIBTOOL = @LIBTOOL@
LIBWINRADIO = @LIBWINRADIO@
LN_S = @LN_S@
LTHAMLIBTCL = @LTHAMLIBTCL@
LTLIBWINRADIO = @LTLIBWINRADIO@
MAKEINFO = @MAKEINFO@
NET = @NET@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
RIGMATRIX = @RIGMATRIX@
STRIP = @STRIP@
VERSION = @VERSION@
V_MAJOR = @V_MAJOR@
V_MINOR = @V_MINOR@
WINDRES = @WINDRES@
WINRADIODEPS = @WINRADIODEPS@
WINRADIOLNK = @WINRADIOLNK@
hamlibdocdir = @hamlibdocdir@
UNIDENSRC = bc895.c
lib_LTLIBRARIES = libhamlib-uniden.la
libhamlib_uniden_la_SOURCES = $(UNIDENSRC) uniden.c
libhamlib_uniden_la_LDFLAGS = -no-undefined -module -avoid-version
libhamlib_uniden_la_LIBADD = ../src/libhamlib.la
lib_LIBRARIES = libhamlib-uniden.a
libhamlib_uniden_a_SOURCES = $(UNIDENSRC) uniden.c
libhamlib_uniden_a_LIBADD = ../src/libhamlib.la
noinst_HEADERS = uniden.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../include/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(lib_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../include
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libhamlib_uniden_a_DEPENDENCIES = ../src/libhamlib.la
libhamlib_uniden_a_OBJECTS = bc895.$(OBJEXT) uniden.$(OBJEXT)
LTLIBRARIES = $(lib_LTLIBRARIES)
libhamlib_uniden_la_DEPENDENCIES = ../src/libhamlib.la
libhamlib_uniden_la_OBJECTS = bc895.lo uniden.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(noinst_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
DEP_FILES = .deps/bc895.P .deps/uniden.P
SOURCES = $(libhamlib_uniden_a_SOURCES) $(libhamlib_uniden_la_SOURCES)
OBJECTS = $(libhamlib_uniden_a_OBJECTS) $(libhamlib_uniden_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu uniden/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLIBRARIES:
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
distclean-libLIBRARIES:
maintainer-clean-libLIBRARIES:
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
@$(POST_INSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \
$(RANLIB) $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LIBRARIES)'; for p in $$list; do \
rm -f $(DESTDIR)$(libdir)/$$p; \
done
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libhamlib-uniden.a: $(libhamlib_uniden_a_OBJECTS) $(libhamlib_uniden_a_DEPENDENCIES)
-rm -f libhamlib-uniden.a
$(AR) cru libhamlib-uniden.a $(libhamlib_uniden_a_OBJECTS) $(libhamlib_uniden_a_LIBADD)
$(RANLIB) libhamlib-uniden.a
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
libhamlib-uniden.la: $(libhamlib_uniden_la_OBJECTS) $(libhamlib_uniden_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libhamlib_uniden_la_LDFLAGS) $(libhamlib_uniden_la_OBJECTS) $(libhamlib_uniden_la_LIBADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = uniden
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu uniden/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-include $(DEP_FILES)
mostlyclean-depend:
clean-depend:
distclean-depend:
-rm -rf .deps
maintainer-clean-depend:
%.o: %.c
@echo '$(COMPILE) -c $<'; \
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
%.lo: %.c
@echo '$(LTCOMPILE) -c $<'; \
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLIBRARIES install-libLTLIBRARIES
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLIBRARIES uninstall-libLTLIBRARIES
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-libLTLIBRARIES \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-libLIBRARIES clean-compile clean-libtool \
clean-libLTLIBRARIES clean-tags clean-depend \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-libLIBRARIES distclean-compile \
distclean-libtool distclean-libLTLIBRARIES \
distclean-tags distclean-depend distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-libLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-libLTLIBRARIES maintainer-clean-tags \
maintainer-clean-depend maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \
clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \
install-libLIBRARIES mostlyclean-compile distclean-compile \
clean-compile maintainer-clean-compile mostlyclean-libtool \
distclean-libtool clean-libtool maintainer-clean-libtool \
mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir \
mostlyclean-depend distclean-depend clean-depend \
maintainer-clean-depend info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

130
uniden/bc895.c 100644
Wyświetl plik

@ -0,0 +1,130 @@
/*
* Hamlib Uniden backend - BC895 description
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: bc895.c,v 1.1 2001-07-14 16:45:40 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <hamlib/rig.h>
#include <hamlib/riglist.h>
#include "uniden.h"
#define BC895_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM)
#define BC895_FUNC (RIG_FUNC_SQL)
#define BC895_LEVEL_ALL (RIG_LEVEL_NONE)
#define BC895_PARM_ALL (RIG_PARM_NONE)
#define BC895_VFO RIG_VFO_A
/*
* bc895 rig capabilities.
*
* TODO: check this with manual or web site.
*/
const struct rig_caps bc895_caps = {
rig_model: RIG_MODEL_BC895,
model_name:"BC895xlt",
mfg_name: "Uniden",
version: "0.1",
copyright: "LGPL",
status: RIG_STATUS_UNTESTED,
rig_type: RIG_TYPE_TRUNKSCANNER,
ptt_type: RIG_PTT_NONE,
dcd_type: RIG_DCD_NONE,
port_type: RIG_PORT_SERIAL,
serial_rate_min: 9600,
serial_rate_max: 9600,
serial_data_bits: 8,
serial_stop_bits: 1,
serial_parity: RIG_PARITY_NONE,
serial_handshake: RIG_HANDSHAKE_NONE,
write_delay: 0,
post_write_delay: 1,
timeout: 200,
retry: 3,
has_get_func: BC895_FUNC,
has_set_func: BC895_FUNC,
has_get_level: BC895_LEVEL_ALL,
has_set_level: RIG_LEVEL_SET(BC895_LEVEL_ALL),
has_get_parm: BC895_PARM_ALL,
has_set_parm: RIG_PARM_SET(BC895_PARM_ALL),
level_gran: {}, /* FIXME: granularity */
parm_gran: {},
ctcss_list: NULL, /* FIXME: CTCSS list? */
dcs_list: NULL,
preamp: { RIG_DBLST_END },
attenuator: { RIG_DBLST_END },
max_rit: Hz(0),
max_xit: Hz(0),
max_ifshift: Hz(0),
targetable_vfo: 0,
transceive: RIG_TRN_OFF,
bank_qty: 0,
chan_desc_sz: 0,
chan_list: {
{ 1, 300, RIG_MTYPE_MEM, 0 },
RIG_CHAN_END,
},
rx_range_list1: { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */
tx_range_list1: { RIG_FRNG_END, },
rx_range_list2: {
{MHz(29),MHz(956),BC895_MODES,-1,-1,BC895_VFO},
RIG_FRNG_END,
},
tx_range_list2: { RIG_FRNG_END, },
tuning_steps: {
{BC895_MODES,10}, /* FIXME: add other ts */
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
filters: {
{RIG_MODE_AM|RIG_MODE_FM, kHz(8)},
{RIG_MODE_WFM, kHz(230)},
RIG_FLT_END,
},
priv: NULL,
set_freq: uniden_set_freq,
set_mem: uniden_set_mem,
};
/*
* Function definitions below
*/

149
uniden/uniden.c 100644
Wyświetl plik

@ -0,0 +1,149 @@
/*
* Hamlib Uniden backend - main file
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: uniden.c,v 1.1 2001-07-14 16:45:40 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <sys/ioctl.h>
#include <math.h>
#if defined(__CYGWIN__)
# undef HAMLIB_DLL
# include <hamlib/rig.h>
# include <serial.h>
# include <misc.h>
# define HAMLIB_DLL
# include <hamlib/rig_dll.h>
#else
# include <hamlib/rig.h>
# include <serial.h>
# include <misc.h>
#endif
#include "uniden.h"
/*
* Uniden backend: should work for BC895xlt, also for BC235xlt
* and most probably for the RadioShack PRO-2042, which is RadioShack's
* version of the Uniden BC235xlt.
* Protocol information available at http://www.cantonmaine.com/pro2052.htm
*
* It seems like this rig has no VFO, I mean only mem channels.
* Is that correct? --SF
*/
#define EOM "\r"
/*
* uniden_transaction
* We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL
* Otherwise, you'll get a nice seg fault. You've been warned!
*/
int uniden_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len)
{
int i, count, retval;
struct rig_state *rs;
rs = &rig->state;
retval = write_block(&rs->rigport, cmd, cmd_len);
if (retval != RIG_OK)
return retval;
/* no data expected, TODO: flush input? */
if (!data || !data_len)
return 0;
/*
* buffered read are quite helpful here!
* However, an automate with a state model would be more efficient..
*
* FIXME: should read until CR or LF?
*/
i = 0;
do {
count = fread_block(&rs->rigport, data+i, 1);
if (count > 0)
i += count;
else if (count < 0)
return count;
} while (count > 0);
*data_len = i;
return RIG_OK;
}
/*
* uniden_set_freq
* Assumes rig!=NULL
*/
int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
char freqbuf[16];
int freq_len;
/* max 8 digits */
if (freq >= GHz(1))
return -RIG_EINVAL;
/* exactly 8 digits */
freq_len = sprintf(freqbuf, "RF%08Ld" EOM, freq);
return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL);
}
/*
* uniden_set_mem
* Assumes rig!=NULL
*/
int uniden_set_mem(RIG *rig, vfo_t vfo, int ch)
{
char cmdbuf[16];
int cmd_len;
cmd_len = sprintf(cmdbuf, "MA%03d" EOM, ch);
return uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL);
}
/*
* init_uniden is called by rig_backend_load
*/
int init_uniden(void *be_handle)
{
rig_debug(RIG_DEBUG_VERBOSE, "uniden: _init called\n");
rig_register(&bc895_caps);
return RIG_OK;
}

47
uniden/uniden.h 100644
Wyświetl plik

@ -0,0 +1,47 @@
/*
* Hamlib Uniden backend - main header
* Copyright (c) 2001 by Stephane Fillod
*
* $Id: uniden.h,v 1.1 2001-07-14 16:45:40 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _UNIDEN_H
#define _UNIDEN_H 1
#if defined(__CYGWIN__)
# undef HAMLIB_DLL
# include <hamlib/rig.h>
# include <cal.h>
# define HAMLIB_DLL
# include <hamlib/rig_dll.h>
#else
# include <hamlib/rig.h>
# include <cal.h>
#endif
int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq);
int uniden_set_mem(RIG *rig, vfo_t vfo, int ch);
extern const struct rig_caps bc895_caps;
extern int init_uniden(void *be_handle);
#endif /* _UNIDEN_H */