From 13a7029d7c0ef07ac8f8f9136e5688dd28775f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Sun, 12 Aug 2001 22:52:44 +0000 Subject: [PATCH] Initial release git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@626 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- kachina/505dsp.c | 174 ++++++++++++++ kachina/Makefile.am | 12 + kachina/Makefile.in | 419 ++++++++++++++++++++++++++++++++++ kachina/kachina.c | 227 ++++++++++++++++++ kachina/kachina.h | 50 ++++ winradio/linradio/Makefile.am | 1 + winradio/linradio/Makefile.in | 229 +++++++++++++++++++ 7 files changed, 1112 insertions(+) create mode 100644 kachina/505dsp.c create mode 100644 kachina/Makefile.am create mode 100644 kachina/Makefile.in create mode 100644 kachina/kachina.c create mode 100644 kachina/kachina.h create mode 100644 winradio/linradio/Makefile.am create mode 100644 winradio/linradio/Makefile.in diff --git a/kachina/505dsp.c b/kachina/505dsp.c new file mode 100644 index 000000000..e0ac8e642 --- /dev/null +++ b/kachina/505dsp.c @@ -0,0 +1,174 @@ +/* + * Hamlib Kachina backend - 505DSP description + * Copyright (c) 2001 by Stephane Fillod + * + * $Id: 505dsp.c,v 1.1 2001-08-12 22:52:44 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 +#include /* Standard input/output definitions */ +#include /* String function definitions */ +#include /* UNIX standard function definitions */ +#include /* File control definitions */ +#include /* Error number definitions */ +#include /* POSIX terminal control definitions */ +#include + +#include +#include +#include "kachina.h" + + +#define K505DSP_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) +#define K505DSP_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) +#define K505DSP_AM_TX_MODES RIG_MODE_AM + +#define K505DSP_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TONE|RIG_FUNC_COMP) + +#define K505DSP_LEVEL_ALL (RIG_LEVEL_SQLSTAT|RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) + +#define K505DSP_PARM_ALL (RIG_PARM_NONE) + +#define K505DSP_VFO (RIG_VFO_A) + +#define K505DSP_STR_CAL { 2, { \ + { 0, -60 }, \ + { 127, 20 }, \ + } } + +static const struct kachina_priv_caps k505dsp_priv_caps = { + K505DSP_STR_CAL +}; + +/* + * 505DSP rig capabilities. + * + * protocol is documented at + * http://www.kachina-az.com/develope.htm + * + * TODO: + * - so many ... + */ +const struct rig_caps k505dsp_caps = { +rig_model: RIG_MODEL_505DSP, +model_name:"505DSP", +mfg_name: "Kachina", +version: "0.1", +copyright: "LGPL", +status: RIG_STATUS_UNTESTED, +rig_type: RIG_TYPE_COMPUTER, +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: 0, +timeout: 200, +retry: 2, + +has_get_func: K505DSP_FUNC, +has_set_func: K505DSP_FUNC, +has_get_level: K505DSP_LEVEL_ALL, +has_set_level: RIG_LEVEL_SET(K505DSP_LEVEL_ALL), +has_get_parm: K505DSP_PARM_ALL, +has_set_parm: RIG_PARM_SET(K505DSP_PARM_ALL), +level_gran: {}, /* FIXME: granularity */ +parm_gran: {}, +ctcss_list: common_ctcss_list, +dcs_list: NULL, +preamp: { 10, RIG_DBLST_END }, +attenuator: { 20, RIG_DBLST_END }, +max_rit: Hz(9900), +max_xit: Hz(0), +max_ifshift: Hz(1270), +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(30),MHz(30),K505DSP_ALL_MODES,-1,-1,K505DSP_VFO}, + RIG_FRNG_END, + }, +tx_range_list2: { + {kHz(1800),MHz(2)-100,K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {kHz(1800),MHz(2)-100,K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {kHz(3500),MHz(4)-100,K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {kHz(3500),MHz(4)-100,K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {MHz(7),kHz(7300),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {MHz(7),kHz(7300),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {kHz(10100),kHz(10150),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {kHz(10100),kHz(10150),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {MHz(14),kHz(14350),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {MHz(14),kHz(14350),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {kHz(18068),kHz(18168),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {kHz(18068),kHz(18168),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {MHz(21),kHz(21450),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {MHz(21),kHz(21450),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {kHz(24895),kHz(24995),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {kHz(24895),kHz(24995),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + {MHz(28),kHz(29700),K505DSP_OTHER_TX_MODES,W(10),W(100),K505DSP_VFO}, + {MHz(28),kHz(29700),K505DSP_AM_TX_MODES,W(4),W(25),K505DSP_VFO}, + RIG_FRNG_END, + }, +tuning_steps: { + {K505DSP_ALL_MODES,1}, /* FIXME: add other ts */ + RIG_TS_END, + }, + /* mode/filter list, remember: order matters! */ +filters: { + {RIG_MODE_SSB, kHz(2.4)}, + {RIG_MODE_SSB, kHz(2.7)}, + {RIG_MODE_SSB, kHz(2.1)}, + {RIG_MODE_SSB, kHz(3.5)}, + {RIG_MODE_SSB, kHz(1.7)}, + {RIG_MODE_CW, kHz(1)}, + {RIG_MODE_CW, Hz(500)}, + {RIG_MODE_CW, kHz(2.4)}, + {RIG_MODE_CW, Hz(200)}, + {RIG_MODE_CW, Hz(100)}, + {RIG_MODE_AM, kHz(6)}, + {RIG_MODE_FM, kHz(6)}, + RIG_FLT_END, + }, +priv: (void*)&k505dsp_priv_caps, + +set_freq: kachina_set_freq, +set_mode: kachina_set_mode, + +}; + +/* + * Function definitions below + */ + diff --git a/kachina/Makefile.am b/kachina/Makefile.am new file mode 100644 index 000000000..7381ad7c7 --- /dev/null +++ b/kachina/Makefile.am @@ -0,0 +1,12 @@ +ALINCOSRCLIST = 505dsp.c + +lib_LTLIBRARIES = libhamlib-kachina.la +libhamlib_kachina_la_SOURCES = $(ALINCOSRCLIST) kachina.c +libhamlib_kachina_la_LDFLAGS = -no-undefined -module -avoid-version +#libhamlib_kachina_la_LIBADD = ../src/libhamlib.la + +lib_LIBRARIES = libhamlib-kachina.a +libhamlib_kachina_a_SOURCES = $(ALINCOSRCLIST) kachina.c +libhamlib_kachina_a_LIBADD = ../src/libhamlib.la + +noinst_HEADERS = kachina.h diff --git a/kachina/Makefile.in b/kachina/Makefile.in new file mode 100644 index 000000000..5cdec7ce9 --- /dev/null +++ b/kachina/Makefile.in @@ -0,0 +1,419 @@ +# 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@ +AS = @AS@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +DLL_PRELOAD = @DLL_PRELOAD@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +INCLTDL = @INCLTDL@ +INCLUDES = @INCLUDES@ +LIBHAMLIBTCL = @LIBHAMLIBTCL@ +LIBLTDL = @LIBLTDL@ +LIBOBJS = @LIBOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTHAMLIBTCL = @LTHAMLIBTCL@ +MAKEINFO = @MAKEINFO@ +NET = @NET@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RIGMATRIX = @RIGMATRIX@ +STRIP = @STRIP@ +VERSION = @VERSION@ +hamlibdocdir = @hamlibdocdir@ + +ALINCOSRCLIST = 505dsp.c + +lib_LTLIBRARIES = libhamlib-kachina.la +libhamlib_kachina_la_SOURCES = $(ALINCOSRCLIST) kachina.c +libhamlib_kachina_la_LDFLAGS = -no-undefined -module -avoid-version +#libhamlib_kachina_la_LIBADD = ../src/libhamlib.la + +lib_LIBRARIES = libhamlib-kachina.a +libhamlib_kachina_a_SOURCES = $(ALINCOSRCLIST) kachina.c +libhamlib_kachina_a_LIBADD = ../src/libhamlib.la + +noinst_HEADERS = kachina.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_kachina_a_DEPENDENCIES = ../src/libhamlib.la +libhamlib_kachina_a_OBJECTS = 505dsp.$(OBJEXT) kachina.$(OBJEXT) +AR = ar +LTLIBRARIES = $(lib_LTLIBRARIES) + +libhamlib_kachina_la_LIBADD = +libhamlib_kachina_la_OBJECTS = 505dsp.lo kachina.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/505dsp.P .deps/kachina.P +SOURCES = $(libhamlib_kachina_a_SOURCES) $(libhamlib_kachina_la_SOURCES) +OBJECTS = $(libhamlib_kachina_a_OBJECTS) $(libhamlib_kachina_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu kachina/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-kachina.a: $(libhamlib_kachina_a_OBJECTS) $(libhamlib_kachina_a_DEPENDENCIES) + -rm -f libhamlib-kachina.a + $(AR) cru libhamlib-kachina.a $(libhamlib_kachina_a_OBJECTS) $(libhamlib_kachina_a_LIBADD) + $(RANLIB) libhamlib-kachina.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-kachina.la: $(libhamlib_kachina_la_OBJECTS) $(libhamlib_kachina_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libhamlib_kachina_la_LDFLAGS) $(libhamlib_kachina_la_OBJECTS) $(libhamlib_kachina_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 = kachina + +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 kachina/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: diff --git a/kachina/kachina.c b/kachina/kachina.c new file mode 100644 index 000000000..03078308d --- /dev/null +++ b/kachina/kachina.c @@ -0,0 +1,227 @@ +/* + * Hamlib Kachina backend - main file + * Copyright (c) 2001 by Stephane Fillod + * + * $Id: kachina.c,v 1.1 2001-08-12 22:52:44 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 +#include /* Standard input/output definitions */ +#include /* String function definitions */ +#include /* UNIX standard function definitions */ +#include /* File control definitions */ +#include /* Error number definitions */ +#include /* POSIX terminal control definitions */ +#include +#include + +#if defined(__CYGWIN__) +# undef HAMLIB_DLL +# include +# include +# include +# include +# define HAMLIB_DLL +# include +#else +# include +# include +# include +# include +#endif + +#include "kachina.h" + + +/* + * protocol format + */ +#define STX 0x02 +#define ETX 0x03 +#define GDCMD 0xff +#define ERRCMD 0xfe + +/* + * modes in use by the "M" command + */ +#define M_AM 0x01 +#define M_CW 0x02 +#define M_FM 0x03 +#define M_USB 0x04 +#define M_LSB 0x05 + +#define DDS_CONST 2.2369621333 +#define DDS_BASE 75000000 + +/* uppermost 2 bits of the high byte + * designating the antenna port in DDS calculation + */ +#define PORT_AB 0x00 +#define PORT_A 0x40 +#define PORT_B 0x80 +#define PORT_BA 0xc0 + +/* + * kachina_transaction + * We assume that rig!=NULL, rig->state!= NULL + * Otherwise, you'll get a nice seg fault. You've been warned! + * TODO: error case handling + */ +int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2) +{ + int count, retval; + struct rig_state *rs; + unsigned char buf4[4]; + + rs = &rig->state; + + buf4[0] = STX; + buf4[1] = cmd1; + buf4[2] = cmd2; + buf4[3] = ETX; + + retval = write_block(&rs->rigport, buf4, 4); + if (retval != RIG_OK) + return retval; + + count = fread_block(&rs->rigport, buf4, 1); + if (count != 1) + return count; + + return (buf4[0]==GDCMD) ? RIG_OK : -RIG_EPROTO; +} + +int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data, int data_len) +{ + int cmd_len, count, retval; + struct rig_state *rs; + unsigned char buf[16]; + + rs = &rig->state; + + buf[0] = STX; + buf[1] = cmd1; + memcpy(buf+2, data, data_len); + buf[data_len+2] = ETX; + + cmd_len = data_len+3; + + retval = write_block(&rs->rigport, buf, cmd_len); + if (retval != RIG_OK) + return retval; + + count = fread_block(&rs->rigport, buf, 1); + if (count != 1) + return count; + + return (buf[0]==GDCMD) ? RIG_OK : -RIG_EPROTO; +} + +/* + * convert a frequency in Hz in the range of 30kHz to 30MHz + * to DDS value, as expected by the Kachina. + */ +void inline freq2dds(freq_t freq, int ant_port, unsigned char fbuf[4]) +{ + double dds; + unsigned long dds_ulong; + + dds = DDS_CONST * ( DDS_BASE + freq); + dds_ulong = (unsigned long)dds; + + /* + * byte 0 transferred first, + * dds is big endian format + */ + fbuf[0] = ant_port | ((dds_ulong>>24) & 0x3f); + fbuf[1] = (dds_ulong>>16) & 0xff; + fbuf[2] = (dds_ulong>>8) & 0xff; + fbuf[3] = dds_ulong & 0xff; +} + +/* + * kachina_set_freq + * Assumes rig!=NULL + */ +int kachina_set_freq(RIG *rig, vfo_t vfo, freq_t freq) +{ + int retval; + unsigned char freqbuf[4]; + + freq2dds(freq, PORT_A, freqbuf); + + /* receive frequency */ + retval = kachina_trans_n(rig, 'R', freqbuf, 4); + if (retval != RIG_OK) + return retval; + + /* transmit frequency */ + retval = kachina_trans_n(rig, 'T', freqbuf, 4); + if (retval != RIG_OK) + return retval; + + return RIG_OK; +} + +/* + * kachina_set_mode + * Assumes rig!=NULL + * + * FIXME: pbwidth handling + */ +int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) +{ + int retval; + unsigned char k_mode; + + switch (mode) { + case RIG_MODE_CW: k_mode = M_CW; break; + case RIG_MODE_USB: k_mode = M_USB; break; + case RIG_MODE_LSB: k_mode = M_LSB; break; + case RIG_MODE_FM: k_mode = M_FM; break; + case RIG_MODE_AM: k_mode = M_AM; break; + default: + rig_debug(RIG_DEBUG_ERR, + "kachina_set_mode: unsupported mode %d\n", + mode); + return -RIG_EINVAL; + } + + retval = kachina_transaction (rig, 'M', k_mode); + if (retval != RIG_OK) + return retval; + + return retval; +} + +/* + * init_kachina is called by rig_backend_load + */ +int init_kachina(void *be_handle) +{ + rig_debug(RIG_DEBUG_VERBOSE, "kachina: _init called\n"); + + rig_register(&k505dsp_caps); + + return RIG_OK; +} + diff --git a/kachina/kachina.h b/kachina/kachina.h new file mode 100644 index 000000000..c634e445b --- /dev/null +++ b/kachina/kachina.h @@ -0,0 +1,50 @@ +/* + * Hamlib Kachina backend - main header + * Copyright (c) 2001 by Stephane Fillod + * + * $Id: kachina.h,v 1.1 2001-08-12 22:52:44 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 _KACHINA_H +#define _KACHINA_H 1 + +#if defined(__CYGWIN__) +# undef HAMLIB_DLL +# include +# include +# define HAMLIB_DLL +# include +#else +# include +# include +#endif + +struct kachina_priv_caps { + cal_table_t str_cal; +}; + +int kachina_set_freq(RIG *rig, vfo_t vfo, freq_t freq); +int kachina_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); + +extern const struct rig_caps k505dsp_caps; + +extern HAMLIB_EXPORT(int) init_kachina(void *be_handle); + + +#endif /* _KACHINA_H */ + diff --git a/winradio/linradio/Makefile.am b/winradio/linradio/Makefile.am new file mode 100644 index 000000000..7312d5a5e --- /dev/null +++ b/winradio/linradio/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = radio_ioctl.h wrapi.h diff --git a/winradio/linradio/Makefile.in b/winradio/linradio/Makefile.in new file mode 100644 index 000000000..11bf85295 --- /dev/null +++ b/winradio/linradio/Makefile.in @@ -0,0 +1,229 @@ +# 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@ +AS = @AS@ +CC = @CC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +DLLTOOL = @DLLTOOL@ +DLL_PRELOAD = @DLL_PRELOAD@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +GCJ = @GCJ@ +GCJFLAGS = @GCJFLAGS@ +INCLTDL = @INCLTDL@ +INCLUDES = @INCLUDES@ +LIBHAMLIBTCL = @LIBHAMLIBTCL@ +LIBLTDL = @LIBLTDL@ +LIBOBJS = @LIBOBJS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTHAMLIBTCL = @LTHAMLIBTCL@ +MAKEINFO = @MAKEINFO@ +NET = @NET@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RIGMATRIX = @RIGMATRIX@ +STRIP = @STRIP@ +VERSION = @VERSION@ +hamlibdocdir = @hamlibdocdir@ + +noinst_HEADERS = radio_ioctl.h wrapi.h +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../include/config.h +CONFIG_CLEAN_FILES = +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu winradio/linradio/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +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 = winradio/linradio + +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 winradio/linradio/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 +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-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: uninstall-am +all-am: Makefile $(HEADERS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +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-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-tags 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: tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir 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: